From 764a158cd7e112186cbf54cb77599bcd22ea7d69 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 28 Feb 2021 01:09:59 +0900 Subject: [PATCH] Resolve #7270 --- src/client/components/emoji-picker-dialog.vue | 9 ++++- src/client/components/emoji-picker.vue | 35 ++++++++---------- src/client/components/note-detailed.vue | 22 ++++------- src/client/components/note.vue | 22 ++++------- src/client/components/ui/modal.vue | 26 +++++++++---- src/client/os.ts | 37 +++++++++++++++++++ src/client/ui/chat/note.vue | 25 ++++--------- 7 files changed, 101 insertions(+), 75 deletions(-) diff --git a/src/client/components/emoji-picker-dialog.vue b/src/client/components/emoji-picker-dialog.vue index 177b5db44d..3450d219c3 100644 --- a/src/client/components/emoji-picker-dialog.vue +++ b/src/client/components/emoji-picker-dialog.vue @@ -1,6 +1,6 @@ @@ -16,6 +16,11 @@ export default defineComponent({ }, props: { + manualShowing: { + type: Boolean, + required: false, + default: null, + }, src: { required: false }, diff --git a/src/client/components/emoji-picker.vue b/src/client/components/emoji-picker.vue index b11f0a62fa..41e667dd98 100644 --- a/src/client/components/emoji-picker.vue +++ b/src/client/components/emoji-picker.vue @@ -54,23 +54,17 @@ -
+
{{ $ts.customEmojis }}
- + {{ category || $ts.other }}
-
+
{{ $ts.emoji }}
- + {{ category }}
-
+
{{ $ts.tags }}
- + {{ tag }}
@@ -127,9 +121,6 @@ export default defineComponent({ searchResultCustom: [], searchResultUnicode: [], tab: 'index', - showingCustomEmojis: false, - showingEmojis: false, - showingTags: false, categories: ['face', 'people', 'animals_and_nature', 'food_and_drink', 'activity', 'travel_and_places', 'objects', 'symbols', 'flags'], faGlobe, faClock, faChevronDown, faAsterisk, faLaugh, faUtensils, faLeaf, faShapes, faBicycle, faHashtag, }; @@ -279,14 +270,18 @@ export default defineComponent({ }, mounted() { - if (!isMobile && !isDeviceTouch) { - this.$refs.search.focus({ - preventScroll: true - }); - } + this.focus(); }, methods: { + focus() { + if (!isMobile && !isDeviceTouch) { + this.$refs.search.focus({ + preventScroll: true + }); + } + }, + getKey(emoji: any) { return typeof emoji === 'string' ? emoji : (emoji.char || `:${emoji.name}:`); }, diff --git a/src/client/components/note-detailed.vue b/src/client/components/note-detailed.vue index e1927133ae..7df87c6b01 100644 --- a/src/client/components/note-detailed.vue +++ b/src/client/components/note-detailed.vue @@ -523,20 +523,14 @@ export default defineComponent({ react(viaKeyboard = false) { pleaseLogin(); this.blur(); - os.popup(import('@/components/emoji-picker-dialog.vue'), { - src: this.$refs.reactButton, - asReactionPicker: true - }, { - done: reaction => { - if (reaction) { - os.api('notes/reactions/create', { - noteId: this.appearNote.id, - reaction: reaction - }); - } - this.focus(); - }, - }, 'closed'); + os.pickReaction(this.$refs.reactButton, reaction => { + os.api('notes/reactions/create', { + noteId: this.appearNote.id, + reaction: reaction + }); + }, () => { + this.focus(); + }); }, reactDirectly(reaction) { diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 6af0668e2e..dab7643762 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -498,20 +498,14 @@ export default defineComponent({ react(viaKeyboard = false) { pleaseLogin(); this.blur(); - os.popup(import('@/components/emoji-picker-dialog.vue'), { - src: this.$refs.reactButton, - asReactionPicker: true - }, { - done: reaction => { - if (reaction) { - os.api('notes/reactions/create', { - noteId: this.appearNote.id, - reaction: reaction - }); - } - this.focus(); - }, - }, 'closed'); + os.pickReaction(this.$refs.reactButton, reaction => { + os.api('notes/reactions/create', { + noteId: this.appearNote.id, + reaction: reaction + }); + }, () => { + this.focus(); + }); }, reactDirectly(reaction) { diff --git a/src/client/components/ui/modal.vue b/src/client/components/ui/modal.vue index 405fa4aaa5..1c8ae63907 100644 --- a/src/client/components/ui/modal.vue +++ b/src/client/components/ui/modal.vue @@ -1,11 +1,13 @@