Display all emoji groups on emoji picker header
This commit is contained in:
parent
ff2242e85d
commit
992d57ef69
|
@ -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
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
display: flex;
|
||||
height: 32px;
|
||||
padding: 10px 7px 5px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
|
@ -63,6 +64,9 @@
|
|||
|
||||
.emoji-tabs {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.emoji-groups {
|
||||
|
@ -70,6 +74,7 @@
|
|||
}
|
||||
|
||||
.additional-tabs {
|
||||
display: block;
|
||||
border-left: 1px solid;
|
||||
border-left-color: $fallback--icon;
|
||||
border-left-color: var(--icon, $fallback--icon);
|
||||
|
@ -79,7 +84,6 @@
|
|||
|
||||
.additional-tabs,
|
||||
.emoji-tabs {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
flex-basis: auto;
|
||||
flex-shrink: 1;
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
<div class="heading">
|
||||
<span class="emoji-tabs">
|
||||
<span
|
||||
v-for="group in emojis"
|
||||
v-for="group in allEmojiGroups"
|
||||
:key="group.id"
|
||||
class="emoji-tabs-item"
|
||||
:class="{
|
||||
active: activeGroupView === group.id,
|
||||
disabled: group.emojis.length === 0
|
||||
disabled: false
|
||||
}"
|
||||
:title="group.text"
|
||||
@click.prevent="highlight(group.id)"
|
||||
|
|
Loading…
Reference in New Issue