From 89b5d976ee3a2144db49d0d52cbaddc4115bb139 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 13 Oct 2018 12:48:33 +0900 Subject: [PATCH] Add some keyboard shortcuts of note --- src/client/app/common/scripts/note-mixin.ts | 19 ++++++++++++++++++- src/docs/keyboard-shortcut.ja-JP.md | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index 17182e275..491c77747 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, diff --git a/src/docs/keyboard-shortcut.ja-JP.md b/src/docs/keyboard-shortcut.ja-JP.md index 264387242..d1d8989a8 100644 --- a/src/docs/keyboard-shortcut.ja-JP.md +++ b/src/docs/keyboard-shortcut.ja-JP.md @@ -30,6 +30,8 @@ Ctrl + , Ctrl + Q即刻Renoteする(フォームを開かずに)- E, A, +リアクションフォームを開くEmote, reAction 0~9数字に対応したリアクションをする(対応については後述)- + F, Bお気に入りに登録Favorite, Bookmark + Del, Ctrl + D投稿を削除Delete M, O投稿に対するメニューを開くMore, Other SCWで隠された部分を表示 or 隠すShow, See Escフォーカスを外す-