From a85f6edd8a98de34fefb94f9c7f4e1a2a6c8b84a Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Wed, 9 Oct 2019 21:42:23 +0900 Subject: 閉じずに残ってしまうメニューなどの修正 (#5496) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: ページ移動等してもメニュー等が閉じずに残ってしまう * Fix: ページ移動してもメディアビューワーが残ってしまう --- src/client/app/common/scripts/note-mixin.ts | 10 ++++++++-- src/client/app/common/scripts/post-form.ts | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/client/app/common/scripts') diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index 9e1c81e2b7..54e90714e7 100644 --- a/src/client/app/common/scripts/note-mixin.ts +++ b/src/client/app/common/scripts/note-mixin.ts @@ -143,12 +143,15 @@ export default (opts: Opts = {}) => ({ react(viaKeyboard = false) { pleaseLogin(this.$root); this.blur(); - this.$root.new(MkReactionPicker, { + const w = this.$root.new(MkReactionPicker, { source: this.$refs.reactButton, note: this.appearNote, showFocus: viaKeyboard, animation: !viaKeyboard }).$once('closed', this.focus); + this.$once('hook:beforeDestroy', () => { + w.close(); + }); }, reactDirectly(reaction) { @@ -195,7 +198,7 @@ export default (opts: Opts = {}) => ({ menu(viaKeyboard = false) { if (this.openingMenu) return; this.openingMenu = true; - this.$root.new(MkNoteMenu, { + const w = this.$root.new(MkNoteMenu, { source: this.$refs.menuButton, note: this.appearNote, animation: !viaKeyboard @@ -203,6 +206,9 @@ export default (opts: Opts = {}) => ({ this.openingMenu = false; this.focus(); }); + this.$once('hook:beforeDestroy', () => { + w.destroyDom(); + }); }, toggleShowContent() { diff --git a/src/client/app/common/scripts/post-form.ts b/src/client/app/common/scripts/post-form.ts index 9b155f7fcb..496782fd30 100644 --- a/src/client/app/common/scripts/post-form.ts +++ b/src/client/app/common/scripts/post-form.ts @@ -328,6 +328,9 @@ export default (opts) => ({ w.$once('chosen', v => { this.applyVisibility(v); }); + this.$once('hook:beforeDestroy', () => { + w.close(); + }); }, applyVisibility(v: string) { @@ -457,6 +460,9 @@ export default (opts) => ({ vm.$once('chosen', emoji => { insertTextAtCursor(this.$refs.text, emoji); }); + this.$once('hook:beforeDestroy', () => { + vm.close(); + }); }, saveDraft() { -- cgit v1.2.3-freya