mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-17 13:31:11 +00:00
92 lines
No EOL
1.7 KiB
Vue
92 lines
No EOL
1.7 KiB
Vue
<template>
|
|
<div class="edit-panel" v-if="selectedChannelID === data.channelID">
|
|
<div class="title">Edit Message:</div>
|
|
<div class="message" v-html="message"></div>
|
|
<div class="close-button" @click="close">Cancel</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import messageFormatter from "@/utils/messageFormatter.js";
|
|
import { bus } from "../../main";
|
|
|
|
export default {
|
|
props: ['data'],
|
|
methods: {
|
|
close() {
|
|
this.$store.dispatch("setEditMessage", null);
|
|
},
|
|
keyDownEvent(event) {
|
|
if(event.keyCode !== 27) return; // 27 = escape
|
|
this.close();
|
|
}
|
|
},
|
|
mounted() {
|
|
bus.$emit('scrollDown')
|
|
},
|
|
created() {
|
|
document.addEventListener('keydown', this.keyDownEvent)
|
|
},
|
|
destroyed() {
|
|
this.$store.dispatch("setEditMessage", null);
|
|
document.removeEventListener('keydown', this.keyDownEvent)
|
|
},
|
|
computed: {
|
|
message() {
|
|
return messageFormatter(this.data.message)
|
|
},
|
|
selectedChannelID() {
|
|
return this.$store.getters.selectedChannelID;
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
.edit-panel {
|
|
padding: 10px;
|
|
color: white;
|
|
background: #0f272a;
|
|
display: flex;
|
|
flex-direction: column;
|
|
z-index:1;
|
|
margin-bottom: 0;
|
|
}
|
|
.top{
|
|
display: flex;
|
|
}
|
|
.title {
|
|
flex: 1;
|
|
}
|
|
.close-button {
|
|
color: white;
|
|
background: #304548;
|
|
padding: 4px;
|
|
align-self: flex-end;
|
|
transition: 0.3s;
|
|
user-select: none;
|
|
cursor: pointer;
|
|
}
|
|
.close-button:hover {
|
|
background: #485b5d;
|
|
}
|
|
.message {
|
|
color: rgb(214, 214, 214);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
</style>
|
|
|
|
|
|
<style>
|
|
.edit-panel img.emoji {
|
|
object-fit: contain;
|
|
height: 2em;
|
|
width: 2em;
|
|
margin: 1px;
|
|
vertical-align: -9px;
|
|
}
|
|
</style> |