emojify message content

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/1035/head
Robin Appelman 2020-09-28 16:30:15 +02:00
rodzic 34ec87cd4f
commit 6e57649ce5
3 zmienionych plików z 76 dodań i 3 usunięć

Wyświetl plik

@ -34,6 +34,7 @@
"@nextcloud/axios": "^1.4.0",
"@nextcloud/initial-state": "^1.1.2",
"@nextcloud/logger": "^1.1.2",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^2.6.8",
"he": "^1.2.0",
"linkifyjs": "^2.1.8",

Wyświetl plik

@ -0,0 +1,36 @@
<template>
<img class="emoji" draggable="false" :alt="emoji" :src="emojiUrl"/>
</template>
<script>
import {generateFilePath} from '@nextcloud/router'
import twemoji from 'twemoji'
// avoid using a string literal like '\u200D' here because minifiers expand it inline
const U200D = String.fromCharCode(0x200D);
const UFE0Fg = /\uFE0F/g;
export default {
name: 'Emoji',
props: {
emoji: {type: String}
},
data: function () {
return {}
},
computed: {
icon () {
return twemoji.convert.toCodePoint(this.emoji.indexOf(U200D) < 0 ?
this.emoji.replace(UFE0Fg, '') :
this.emoji
);
},
emojiUrl () {
return generateFilePath('social', 'img', 'twemoji/' + this.icon + '.svg')
}
}
}
</script>
<style scoped>
</style>

File diff suppressed because one or more lines are too long