From 52cffe0864524f10ef518d930b211831db597435 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Nov 2020 12:08:07 +0900 Subject: [PATCH] =?UTF-8?q?=E7=B5=B5=E6=96=87=E5=AD=97=E3=83=94=E3=83=83?= =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=81=A7=E6=9C=80=E8=BF=91=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E3=81=97=E3=81=9F=E7=B5=B5=E6=96=87=E5=AD=97=E3=81=8C=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=81=A3=E3=81=A6=E3=81=84=E3=82=8B=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit あとMkEmojiをリファクタリング --- src/client/components/emoji-picker.vue | 26 ++++++++++++------------- src/client/components/emoji.vue | 18 ++++++++--------- src/client/components/mfm.ts | 3 +-- src/client/components/reaction-icon.vue | 4 ++-- src/client/store.ts | 2 +- 5 files changed, 26 insertions(+), 27 deletions(-) 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 }}