Skip to content

Commit

Permalink
Fix: ページ移動等してもメニュー等が閉じずに残ってしまう
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Oct 6, 2019
1 parent f95f511 commit 7671373
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/client/app/common/scripts/note-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,15 @@ export default (opts: Opts = {}) => ({

react(viaKeyboard = false) {
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) {
Expand Down Expand Up @@ -196,14 +199,17 @@ 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
}).$once('closed', () => {
this.openingMenu = false;
this.focus();
});
this.$once('hook:beforeDestroy', () => {
w.destroyDom();
});
},

toggleShowContent() {
Expand Down
5 changes: 4 additions & 1 deletion src/client/app/common/views/deck/deck.user-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,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();
});
}
}
});
Expand Down
6 changes: 6 additions & 0 deletions src/client/app/desktop/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,9 @@ export default Vue.extend({
w.$once('chosen', v => {
this.applyVisibility(v);
});
this.$once('hook:beforeDestroy', () => {
w.close();
});
},
applyVisibility(v :string) {
Expand Down Expand Up @@ -509,6 +512,9 @@ export default Vue.extend({
vm.$once('chosen', (emoji: string) => {
insertTextAtCursor(this.$refs.text, emoji + (emoji.startsWith(':') ? String.fromCharCode(0x200B) : ''));
});
this.$once('hook:beforeDestroy', () => {
vm.close();
});
},
togglePreview() {
Expand Down
5 changes: 4 additions & 1 deletion src/client/app/desktop/views/home/user/user.header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,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();
});
}
}
});
Expand Down

0 comments on commit 7671373

Please sign in to comment.