From 7bbf022978b5f79bbb58ad31389c83b949218a52 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 21 Oct 2018 16:18:02 +0900 Subject: [PATCH] Refactor --- src/client/app/common/scripts/note-mixin.ts | 4 --- .../views/pages/deck/deck.column-core.vue | 26 ++++++++----------- .../desktop/views/pages/deck/deck.column.vue | 12 ++++++++- .../views/pages/deck/deck.direct-column.vue | 8 ++---- .../desktop/views/pages/deck/deck.direct.vue | 8 ++---- .../views/pages/deck/deck.hashtag-tl.vue | 8 ++---- .../desktop/views/pages/deck/deck.list-tl.vue | 8 ++---- .../views/pages/deck/deck.mentions-column.vue | 8 ++---- .../views/pages/deck/deck.mentions.vue | 8 ++---- .../desktop/views/pages/deck/deck.notes.vue | 7 +---- .../views/pages/deck/deck.tl-column.vue | 9 +------ .../app/desktop/views/pages/deck/deck.tl.vue | 8 ++---- 12 files changed, 38 insertions(+), 76 deletions(-) diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index 1556d06601..cd3d3ae760 100644 --- a/src/client/app/common/scripts/note-mixin.ts +++ b/src/client/app/common/scripts/note-mixin.ts @@ -37,10 +37,6 @@ export default (opts: Opts = {}) => ({ 'ctrl+q': this.renoteDirectly, 'up|k|shift+tab': this.focusBefore, 'down|j|tab': this.focusAfter, - 'shift+up': () => this.$emit('parentFocus', 'up'), - 'shift+down': () => this.$emit('parentFocus', 'down'), - 'shift+left': () => this.$emit('parentFocus', 'left'), - 'shift+right': () => this.$emit('parentFocus', 'right'), 'esc': this.blur, 'm|o': () => this.menu(true), 's': this.toggleShowContent, diff --git a/src/client/app/desktop/views/pages/deck/deck.column-core.vue b/src/client/app/desktop/views/pages/deck/deck.column-core.vue index dd2483c5c2..974c58235d 100644 --- a/src/client/app/desktop/views/pages/deck/deck.column-core.vue +++ b/src/client/app/desktop/views/pages/deck/deck.column-core.vue @@ -1,14 +1,14 @@ diff --git a/src/client/app/desktop/views/pages/deck/deck.column.vue b/src/client/app/desktop/views/pages/deck/deck.column.vue index aced5848e4..9b812cce65 100644 --- a/src/client/app/desktop/views/pages/deck/deck.column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.column.vue @@ -2,7 +2,8 @@
+ @drop.prevent.stop="onDrop" + v-hotkey="keymap">
this.$parent.$emit('parentFocus', 'up'), + 'shift+down': () => this.$parent.$emit('parentFocus', 'down'), + 'shift+left': () => this.$parent.$emit('parentFocus', 'left'), + 'shift+right': () => this.$parent.$emit('parentFocus', 'right'), + }; } }, diff --git a/src/client/app/desktop/views/pages/deck/deck.direct-column.vue b/src/client/app/desktop/views/pages/deck/deck.direct-column.vue index def1111694..7744a755e6 100644 --- a/src/client/app/desktop/views/pages/deck/deck.direct-column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.direct-column.vue @@ -2,7 +2,7 @@ %fa:envelope R%{{ name }} - + @@ -38,11 +38,7 @@ export default Vue.extend({ methods: { focus() { this.$refs.tl.focus(); - }, - - parentFocus(direction) { - this.$emit('parentFocus', direction); - }, + } } }); diff --git a/src/client/app/desktop/views/pages/deck/deck.direct.vue b/src/client/app/desktop/views/pages/deck/deck.direct.vue index 877c156045..47fb15370b 100644 --- a/src/client/app/desktop/views/pages/deck/deck.direct.vue +++ b/src/client/app/desktop/views/pages/deck/deck.direct.vue @@ -1,5 +1,5 @@ diff --git a/src/client/app/desktop/views/pages/deck/deck.hashtag-tl.vue b/src/client/app/desktop/views/pages/deck/deck.hashtag-tl.vue index 9be5d8a8c9..a4fdc2ce72 100644 --- a/src/client/app/desktop/views/pages/deck/deck.hashtag-tl.vue +++ b/src/client/app/desktop/views/pages/deck/deck.hashtag-tl.vue @@ -1,5 +1,5 @@ diff --git a/src/client/app/desktop/views/pages/deck/deck.list-tl.vue b/src/client/app/desktop/views/pages/deck/deck.list-tl.vue index cd27743f92..714c267668 100644 --- a/src/client/app/desktop/views/pages/deck/deck.list-tl.vue +++ b/src/client/app/desktop/views/pages/deck/deck.list-tl.vue @@ -1,5 +1,5 @@ diff --git a/src/client/app/desktop/views/pages/deck/deck.mentions-column.vue b/src/client/app/desktop/views/pages/deck/deck.mentions-column.vue index ef0e4ad787..6598832bab 100644 --- a/src/client/app/desktop/views/pages/deck/deck.mentions-column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.mentions-column.vue @@ -2,7 +2,7 @@ %fa:at%{{ name }} - + @@ -38,11 +38,7 @@ export default Vue.extend({ methods: { focus() { this.$refs.tl.focus(); - }, - - parentFocus(direction) { - this.$emit('parentFocus', direction); - }, + } } }); diff --git a/src/client/app/desktop/views/pages/deck/deck.mentions.vue b/src/client/app/desktop/views/pages/deck/deck.mentions.vue index 29bf7d95c4..7890e68409 100644 --- a/src/client/app/desktop/views/pages/deck/deck.mentions.vue +++ b/src/client/app/desktop/views/pages/deck/deck.mentions.vue @@ -1,5 +1,5 @@ diff --git a/src/client/app/desktop/views/pages/deck/deck.notes.vue b/src/client/app/desktop/views/pages/deck/deck.notes.vue index e545f18256..be202affe4 100644 --- a/src/client/app/desktop/views/pages/deck/deck.notes.vue +++ b/src/client/app/desktop/views/pages/deck/deck.notes.vue @@ -22,8 +22,7 @@ :key="note.id" @update:note="onNoteUpdated(i, $event)" :media-view="mediaView" - :mini="true" - @parentFocus="parentFocus"/> + :mini="true"/>

%fa:angle-up%{{ note._datetext }} %fa:angle-down%{{ _notes[i + 1]._datetext }} @@ -111,10 +110,6 @@ export default Vue.extend({ (this.$refs.notes as any).children[0].focus ? (this.$refs.notes as any).children[0].focus() : (this.$refs.notes as any).$el.children[0].focus(); }, - parentFocus(direction) { - this.$emit('parentFocus', direction); - }, - onNoteUpdated(i, note) { Vue.set((this as any).notes, i, note); }, diff --git a/src/client/app/desktop/views/pages/deck/deck.tl-column.vue b/src/client/app/desktop/views/pages/deck/deck.tl-column.vue index 6aa4711dae..6faef36439 100644 --- a/src/client/app/desktop/views/pages/deck/deck.tl-column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.tl-column.vue @@ -20,21 +20,18 @@ :media-only="column.isMediaOnly" :media-view="column.isMediaView" ref="tl" - @parentFocus="parentFocus" /> @@ -100,11 +97,7 @@ export default Vue.extend({ focus() { this.$refs.tl.focus(); - }, - - parentFocus(direction) { - this.$emit('parentFocus', direction); - }, + } } }); diff --git a/src/client/app/desktop/views/pages/deck/deck.tl.vue b/src/client/app/desktop/views/pages/deck/deck.tl.vue index 318e661b71..e9507cdf29 100644 --- a/src/client/app/desktop/views/pages/deck/deck.tl.vue +++ b/src/client/app/desktop/views/pages/deck/deck.tl.vue @@ -1,5 +1,5 @@