aboutsummaryrefslogtreecommitdiff
path: root/src/components/emoji_picker/emoji_picker.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/emoji_picker/emoji_picker.js')
-rw-r--r--src/components/emoji_picker/emoji_picker.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js
index 7d5a3d8f..d04649dc 100644
--- a/src/components/emoji_picker/emoji_picker.js
+++ b/src/components/emoji_picker/emoji_picker.js
@@ -38,6 +38,8 @@ const filterByKeyword = (list, keyword = '') => {
return orderedEmojiList.flat()
}
+const packOf = emoji => (emoji.tags.filter(k => k.startsWith('pack:'))[0] || '').slice(5)
+
const EmojiPicker = {
props: {
enableStickerPicker: {
@@ -174,9 +176,12 @@ const EmojiPicker = {
}
return 0
},
+ allEmojis () {
+ return this.$store.state.instance.customEmoji || []
+ },
filteredEmoji () {
return filterByKeyword(
- this.$store.state.instance.customEmoji || [],
+ this.allEmojis,
trim(this.keyword)
)
},
@@ -184,7 +189,6 @@ const EmojiPicker = {
return this.filteredEmoji.slice(0, this.customEmojiBufferSlice)
},
groupedCustomEmojis () {
- const packOf = emoji => (emoji.tags.filter(k => k.startsWith('pack:'))[0] || '').slice(5)
return this.customEmojiBuffer.reduce((res, emoji) => {
const pack = packOf(emoji)
if (!res[pack]) {
@@ -201,6 +205,26 @@ const EmojiPicker = {
return res
}, {})
},
+ allEmojiGroups () {
+ return this.allEmojis
+ .reduce((res, emoji) => {
+ const packName = packOf(emoji)
+ const packId = `custom-${packName}`
+ if (res.filter(k => k.id === packId).length === 0) {
+ res.push({
+ id: packId,
+ text: packName,
+ image: emoji.imageUrl
+ })
+ }
+ return res
+ }, [])
+ .concat({
+ id: 'standard',
+ text: this.$t('emoji.unicode'),
+ icon: 'box-open'
+ })
+ },
emojis () {
const standardEmojis = this.$store.state.instance.emoji || []
// const customEmojis = this.customEmojiBuffer