diff --git a/src/client/components/emoji-picker.vue b/src/client/components/emoji-picker.vue index 247e59e8a1..e36161d3dd 100644 --- a/src/client/components/emoji-picker.vue +++ b/src/client/components/emoji-picker.vue @@ -34,12 +34,10 @@
@@ -47,14 +45,12 @@
{{ $t('recentUsed') }}
-
@@ -320,6 +316,10 @@ export default defineComponent({ }, methods: { + getKey(emoji: any) { + return typeof emoji === 'string' ? emoji : (emoji.char || `:${emoji.name}:`); + }, + chosen(emoji: any, ev) { if (ev) { const el = ev.currentTarget || ev.target; @@ -329,15 +329,15 @@ export default defineComponent({ os.popup(Particle, { x, y }, {}, 'end'); } - const getKey = (emoji: any) => typeof emoji === 'string' ? emoji : emoji.char || `:${emoji.name}:`; - this.$emit('done', getKey(emoji)); + const key = this.getKey(emoji); + this.$emit('done', key); this.$refs.modal.close(); // 最近使った絵文字更新 - let recents = this.$store.state.device.recentEmojis || []; - recents = recents.filter((e: any) => getKey(e) !== getKey(emoji)); - recents.unshift(emoji) - this.$store.commit('device/set', { key: 'recentEmojis', value: recents.splice(0, 16) }); + let recents = this.$store.state.device.recentlyUsedEmojis; + recents = recents.filter((e: any) => e !== key); + recents.unshift(key); + this.$store.commit('device/set', { key: 'recentlyUsedEmojis', value: recents.splice(0, 16) }); }, paste(event) { diff --git a/src/client/components/emoji.vue b/src/client/components/emoji.vue index 458b0a7fab..b2bf7f0169 100644 --- a/src/client/components/emoji.vue +++ b/src/client/components/emoji.vue @@ -2,7 +2,7 @@ {{ char }} -:{{ name }}: +{{ emoji }}