mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-24 17:11:43 +00:00
fixed emoji bugs when editing
This commit is contained in:
parent
12e6621f37
commit
0d70eb6b3c
8 changed files with 52 additions and 10 deletions
|
|
@ -1,12 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-panel" v-if="selectedChannelID === data.channelID">
|
<div class="edit-panel" v-if="selectedChannelID === data.channelID">
|
||||||
<div class="title">Edit Message:</div>
|
<div class="title">Edit Message:</div>
|
||||||
<div class="message">{{data.message}}</div>
|
<div class="message" v-html="message"></div>
|
||||||
<div class="close-button" @click="close">Cancel</div>
|
<div class="close-button" @click="close">Cancel</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import messageFormatter from "@/utils/messageFormatter.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['data'],
|
props: ['data'],
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -26,6 +28,9 @@ export default {
|
||||||
document.removeEventListener('keydown', this.keyDownEvent)
|
document.removeEventListener('keydown', this.keyDownEvent)
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
message() {
|
||||||
|
return messageFormatter(this.data.message)
|
||||||
|
},
|
||||||
selectedChannelID() {
|
selectedChannelID() {
|
||||||
return this.$store.getters.selectedChannelID;
|
return this.$store.getters.selectedChannelID;
|
||||||
},
|
},
|
||||||
|
|
@ -70,5 +75,6 @@ export default {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,7 @@ export default {
|
||||||
if (!editMessage) {
|
if (!editMessage) {
|
||||||
this.message = ""
|
this.message = ""
|
||||||
} else {
|
} else {
|
||||||
this.message = editMessage.message
|
this.message = emojiParser.emojiToShortcode(editMessage.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -408,11 +408,11 @@ export default {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
color: white;
|
color: white;
|
||||||
overflow-wrap: anywhere;
|
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
.other-information {
|
.other-information {
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="survey-warning" v-if="surveyErrorMessage">{{ surveyErrorMessage }}</div>
|
|
||||||
<div class="survey-valid" v-if="surveyValidMessage">{{ surveyValidMessage }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="survey-warning" v-if="surveyErrorMessage">{{ surveyErrorMessage }}</div>
|
||||||
|
<div class="survey-valid" v-if="surveyValidMessage">{{ surveyValidMessage }}</div>
|
||||||
<div class="button" v-if="loaded" @click="surveySubmitButton">Save</div>
|
<div class="button" v-if="loaded" @click="surveySubmitButton">Save</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -58,9 +58,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const { ok, error, result } = await userService.getSurvey();
|
const { ok, error, result } = await userService.getSurvey();
|
||||||
|
|
@ -141,6 +138,7 @@ export default {
|
||||||
.survey {
|
.survey {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
.survey-inner {
|
.survey-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -154,6 +152,7 @@ export default {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.survey-content {
|
.survey-content {
|
||||||
|
|
@ -164,11 +163,13 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown {
|
.dropdown {
|
||||||
|
|
|
||||||
|
|
@ -154,10 +154,10 @@ const actions = {
|
||||||
this._vm.$socket.emit('notification:dismiss', {channelID: data.message.channelID});
|
this._vm.$socket.emit('notification:dismiss', {channelID: data.message.channelID});
|
||||||
} else {
|
} else {
|
||||||
bus.$emit('title:change', data.message.creator.username + " sent a message.");
|
bus.$emit('title:change', data.message.creator.username + " sent a message.");
|
||||||
|
// send notification if other users message the recipient
|
||||||
|
if (data.message.creator.uniqueID === context.getters.user.uniqueID) return;
|
||||||
desktopNotification();
|
desktopNotification();
|
||||||
}
|
}
|
||||||
// send notification if other users message the recipient
|
|
||||||
if (data.message.creator.uniqueID === context.getters.user.uniqueID) return;
|
|
||||||
const notification = {
|
const notification = {
|
||||||
channelID: data.message.channelID,
|
channelID: data.message.channelID,
|
||||||
lastMessageID: data.message.messageID,
|
lastMessageID: data.message.messageID,
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,14 @@ module.exports = {
|
||||||
icon: require('twemoji/2/svg/2764.svg'),
|
icon: require('twemoji/2/svg/2764.svg'),
|
||||||
color: '#dd2e44'
|
color: '#dd2e44'
|
||||||
},
|
},
|
||||||
|
4: {
|
||||||
|
name: 'Idea Queen',
|
||||||
|
icon: require('twemoji/2/svg/1f4a0.svg'),
|
||||||
|
color: '#78d4ff'
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
name: 'Bug Catcher',
|
||||||
|
icon: require('twemoji/2/svg/1f41b.svg'),
|
||||||
|
color: '#e234eb'
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,20 @@
|
||||||
|
|
||||||
const config = [
|
const config = [
|
||||||
|
|
||||||
|
{
|
||||||
|
version: 5.8,
|
||||||
|
title: "Bug fixes",
|
||||||
|
shortTitle: "",
|
||||||
|
date: "04/08/2019",
|
||||||
|
headColor: "rgba(79, 38, 50, 0.77)",
|
||||||
|
new: [
|
||||||
|
"Added more badges (Bug Catcher, Idea Queen)",
|
||||||
|
],
|
||||||
|
fix: [
|
||||||
|
"Fixed a bug where desktop notifications would show for your own messages.",
|
||||||
|
"Fixed a bug where editing custom emojis would break.",
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
version: 5.7,
|
version: 5.7,
|
||||||
title: "Redesigned survey + user pop-out",
|
title: "Redesigned survey + user pop-out",
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,17 @@ export default {
|
||||||
return x
|
return x
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
emojiToShortcode: message => {
|
||||||
|
// replace default emojis
|
||||||
|
for (let emoji of emojis) {
|
||||||
|
const search = emoji.unicode;
|
||||||
|
const replace = `:${emoji.shortcodes[0]}:`
|
||||||
|
message = message.split(search).join(replace)
|
||||||
|
}
|
||||||
|
// replace custom emojis
|
||||||
|
message = message.replace(/<:([-\w]+):[-\w]+>/g, ':$1:')
|
||||||
|
return message
|
||||||
|
},
|
||||||
replaceEmojis: (string) => {
|
replaceEmojis: (string) => {
|
||||||
|
|
||||||
return twemoji.parse(string,
|
return twemoji.parse(string,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue