From d5e9ca94b796a407784ba22edc8ef405412637f2 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Mon, 2 Sep 2019 04:45:01 +0900 Subject: [PATCH] Prevent users from opening note menu when already opened (#5367) --- src/client/app/common/scripts/note-mixin.ts | 10 ++++++++-- src/client/app/common/views/components/note-menu.vue | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index e433ba49c..9e1c81e2b 100644 --- a/src/client/app/common/scripts/note-mixin.ts +++ b/src/client/app/common/scripts/note-mixin.ts @@ -27,7 +27,8 @@ export default (opts: Opts = {}) => ({ data() { return { showContent: false, - hideThisNote: false + hideThisNote: false, + openingMenu: false }; }, @@ -192,11 +193,16 @@ export default (opts: Opts = {}) => ({ }, menu(viaKeyboard = false) { + if (this.openingMenu) return; + this.openingMenu = true; this.$root.new(MkNoteMenu, { source: this.$refs.menuButton, note: this.appearNote, animation: !viaKeyboard - }).$once('closed', this.focus); + }).$once('closed', () => { + this.openingMenu = false; + this.focus(); + }); }, toggleShowContent() { diff --git a/src/client/app/common/views/components/note-menu.vue b/src/client/app/common/views/components/note-menu.vue index e76e1a0b1..1dcf58dd3 100644 --- a/src/client/app/common/views/components/note-menu.vue +++ b/src/client/app/common/views/components/note-menu.vue @@ -227,6 +227,7 @@ export default Vue.extend({ }, closed() { + this.$emit('closed'); this.$nextTick(() => { this.destroyDom(); });