0
0

閉じずに残ってしまうメニューなどの修正 (#5496)

* Fix: ページ移動等してもメニュー等が閉じずに残ってしまう

* Fix: ページ移動してもメディアビューワーが残ってしまう
This commit is contained in:
MeiMei 2019-10-09 21:42:23 +09:00 committed by syuilo
parent d17c6adba4
commit a85f6edd8a
6 changed files with 31 additions and 7 deletions

View File

@ -143,12 +143,15 @@ export default (opts: Opts = {}) => ({
react(viaKeyboard = false) { react(viaKeyboard = false) {
pleaseLogin(this.$root); pleaseLogin(this.$root);
this.blur(); this.blur();
this.$root.new(MkReactionPicker, { const w = this.$root.new(MkReactionPicker, {
source: this.$refs.reactButton, source: this.$refs.reactButton,
note: this.appearNote, note: this.appearNote,
showFocus: viaKeyboard, showFocus: viaKeyboard,
animation: !viaKeyboard animation: !viaKeyboard
}).$once('closed', this.focus); }).$once('closed', this.focus);
this.$once('hook:beforeDestroy', () => {
w.close();
});
}, },
reactDirectly(reaction) { reactDirectly(reaction) {
@ -195,7 +198,7 @@ export default (opts: Opts = {}) => ({
menu(viaKeyboard = false) { menu(viaKeyboard = false) {
if (this.openingMenu) return; if (this.openingMenu) return;
this.openingMenu = true; this.openingMenu = true;
this.$root.new(MkNoteMenu, { const w = this.$root.new(MkNoteMenu, {
source: this.$refs.menuButton, source: this.$refs.menuButton,
note: this.appearNote, note: this.appearNote,
animation: !viaKeyboard animation: !viaKeyboard
@ -203,6 +206,9 @@ export default (opts: Opts = {}) => ({
this.openingMenu = false; this.openingMenu = false;
this.focus(); this.focus();
}); });
this.$once('hook:beforeDestroy', () => {
w.destroyDom();
});
}, },
toggleShowContent() { toggleShowContent() {

View File

@ -328,6 +328,9 @@ export default (opts) => ({
w.$once('chosen', v => { w.$once('chosen', v => {
this.applyVisibility(v); this.applyVisibility(v);
}); });
this.$once('hook:beforeDestroy', () => {
w.close();
});
}, },
applyVisibility(v: string) { applyVisibility(v: string) {
@ -457,6 +460,9 @@ export default (opts) => ({
vm.$once('chosen', emoji => { vm.$once('chosen', emoji => {
insertTextAtCursor(this.$refs.text, emoji); insertTextAtCursor(this.$refs.text, emoji);
}); });
this.$once('hook:beforeDestroy', () => {
vm.close();
});
}, },
saveDraft() { saveDraft() {

View File

@ -59,9 +59,12 @@ export default Vue.extend({
}, },
methods: { methods: {
onClick() { onClick() {
this.$root.new(ImageViewer, { const viewer = this.$root.new(ImageViewer, {
image: this.image image: this.image
}); });
this.$once('hook:beforeDestroy', () => {
viewer.close();
});
} }
} }
}); });

View File

@ -112,10 +112,13 @@ export default Vue.extend({
}, },
menu() { menu() {
this.$root.new(XUserMenu, { const w = this.$root.new(XUserMenu, {
source: this.$refs.menu, source: this.$refs.menu,
user: this.user user: this.user
}); });
this.$once('hook:beforeDestroy', () => {
w.destroyDom();
});
} }
} }
}); });

View File

@ -53,10 +53,13 @@ export default Vue.extend({
start = videoTag.currentTime start = videoTag.currentTime
videoTag.pause() videoTag.pause()
} }
this.$root.new(MkMediaVideoDialog, { const viewer = this.$root.new(MkMediaVideoDialog, {
video: this.video, video: this.video,
start, start,
}) });
this.$once('hook:beforeDestroy', () => {
viewer.close();
});
} }
} }
}) })

View File

@ -106,10 +106,13 @@ export default Vue.extend({
}, },
menu() { menu() {
this.$root.new(XUserMenu, { const w = this.$root.new(XUserMenu, {
source: this.$refs.menu, source: this.$refs.menu,
user: this.user user: this.user
}); });
this.$once('hook:beforeDestroy', () => {
w.destroyDom();
});
} }
} }
}); });