From 89b5d976ee3a2144db49d0d52cbaddc4115bb139 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 13 Oct 2018 12:48:33 +0900 Subject: Add some keyboard shortcuts of note --- src/client/app/common/scripts/note-mixin.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/client/app/common/scripts/note-mixin.ts') diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index 17182e2757..491c77747a 100644 --- a/src/client/app/common/scripts/note-mixin.ts +++ b/src/client/app/common/scripts/note-mixin.ts @@ -1,7 +1,8 @@ import parse from '../../../../mfm/parse'; import { sum } from '../../../../prelude/array'; -import MkNoteMenu from '..//views/components/note-menu.vue'; +import MkNoteMenu from '../views/components/note-menu.vue'; import MkReactionPicker from '../views/components/reaction-picker.vue'; +import Ok from '../views/components/ok.vue'; function focus(el, fn) { const target = fn(el); @@ -31,6 +32,8 @@ export default (opts: Opts = {}) => ({ 'r|left': () => this.reply(true), 'e|a|plus': () => this.react(true), 'q|right': () => this.renote(true), + 'f|b': this.favorite, + 'delete|ctrl+d': this.del, 'ctrl+q|ctrl+right': this.renoteDirectly, 'up|k|shift+tab': this.focusBefore, 'down|j|tab': this.focusAfter, @@ -129,6 +132,20 @@ export default (opts: Opts = {}) => ({ }); }, + favorite() { + (this as any).api('notes/favorites/create', { + noteId: this.appearNote.id + }).then(() => { + (this as any).os.new(Ok); + }); + }, + + del() { + (this as any).api('notes/delete', { + noteId: this.appearNote.id + }); + }, + menu(viaKeyboard = false) { (this as any).os.new(MkNoteMenu, { source: this.$refs.menuButton, -- cgit v1.2.3-freya