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: [PATCH] =?UTF-8?q?=E9=96=89=E3=81=98=E3=81=9A=E3=81=AB=E6=AE=8B?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=97=E3=81=BE=E3=81=86=E3=83=A1=E3=83=8B?= =?UTF-8?q?=E3=83=A5=E3=83=BC=E3=81=AA=E3=81=A9=E3=81=AE=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20(#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 ++++++ src/client/app/common/views/components/media-image.vue | 5 ++++- src/client/app/common/views/deck/deck.user-column.vue | 5 ++++- .../app/desktop/views/components/media-video.vue | 7 +++++-- src/client/app/desktop/views/home/user/user.header.vue | 5 ++++- 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index 9e1c81e2b..54e90714e 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 9b155f7fc..496782fd3 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() { diff --git a/src/client/app/common/views/components/media-image.vue b/src/client/app/common/views/components/media-image.vue index 6db4b40dd..b8b164aed 100644 --- a/src/client/app/common/views/components/media-image.vue +++ b/src/client/app/common/views/components/media-image.vue @@ -59,9 +59,12 @@ export default Vue.extend({ }, methods: { onClick() { - this.$root.new(ImageViewer, { + const viewer = this.$root.new(ImageViewer, { image: this.image }); + this.$once('hook:beforeDestroy', () => { + viewer.close(); + }); } } }); diff --git a/src/client/app/common/views/deck/deck.user-column.vue b/src/client/app/common/views/deck/deck.user-column.vue index 1383ff5ae..dd64dd1c1 100644 --- a/src/client/app/common/views/deck/deck.user-column.vue +++ b/src/client/app/common/views/deck/deck.user-column.vue @@ -112,10 +112,13 @@ export default Vue.extend({ }, menu() { - this.$root.new(XUserMenu, { + const w = this.$root.new(XUserMenu, { source: this.$refs.menu, user: this.user }); + this.$once('hook:beforeDestroy', () => { + w.destroyDom(); + }); } } }); diff --git a/src/client/app/desktop/views/components/media-video.vue b/src/client/app/desktop/views/components/media-video.vue index 7898c4717..c53da0f49 100644 --- a/src/client/app/desktop/views/components/media-video.vue +++ b/src/client/app/desktop/views/components/media-video.vue @@ -53,10 +53,13 @@ export default Vue.extend({ start = videoTag.currentTime videoTag.pause() } - this.$root.new(MkMediaVideoDialog, { + const viewer = this.$root.new(MkMediaVideoDialog, { video: this.video, start, - }) + }); + this.$once('hook:beforeDestroy', () => { + viewer.close(); + }); } } }) diff --git a/src/client/app/desktop/views/home/user/user.header.vue b/src/client/app/desktop/views/home/user/user.header.vue index 7172803ba..43a0a782b 100644 --- a/src/client/app/desktop/views/home/user/user.header.vue +++ b/src/client/app/desktop/views/home/user/user.header.vue @@ -106,10 +106,13 @@ export default Vue.extend({ }, menu() { - this.$root.new(XUserMenu, { + const w = this.$root.new(XUserMenu, { source: this.$refs.menu, user: this.user }); + this.$once('hook:beforeDestroy', () => { + w.destroyDom(); + }); } } });