diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-07-09 17:59:15 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-09 17:59:15 +0900 |
| commit | a5407131d4d15edca924e2718902cefd81e49ee2 (patch) | |
| tree | bad6d1e08071e9e14624a4d64fb851f137bb4fee /packages/frontend/src/components/MkNote.vue | |
| parent | Bump release actions to v2 (develop-stable(master) branches system) (#13941) (diff) | |
| download | sharkey-a5407131d4d15edca924e2718902cefd81e49ee2.tar.gz sharkey-a5407131d4d15edca924e2718902cefd81e49ee2.tar.bz2 sharkey-a5407131d4d15edca924e2718902cefd81e49ee2.zip | |
fix/refactor(frontend): hotkeyの改修 (#14157)
* improve(frontend): hotkeyの改修 (#234)
(cherry picked from commit 678be147f4db709dadf25d007cc2e679e98a370e)
* Change path, add missing script
Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com>
* fix
* fix
* add missing keycodes
* fix
* update changelog
---------
Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/components/MkNote.vue')
| -rw-r--r-- | packages/frontend/src/components/MkNote.vue | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 1313e4c58e..5f1820a379 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -198,6 +198,7 @@ import MkRippleEffect from '@/components/MkRippleEffect.vue'; import { showMovedDialog } from '@/scripts/show-moved-dialog.js'; import { shouldCollapsed } from '@/scripts/collapsed.js'; import { isEnabledUrlPreview } from '@/instance.js'; +import { type Keymap } from '@/scripts/hotkey.js'; const props = withDefaults(defineProps<{ note: Misskey.entities.Note; @@ -294,15 +295,53 @@ function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string } const keymap = { - 'r': () => reply(true), - 'e|a|plus': () => react(true), - 'q': () => renote(true), - 'up|k|shift+tab': focusBefore, - 'down|j|tab': focusAfter, - 'esc': blur, - 'm|o': () => showMenu(true), - 's': () => showContent.value !== showContent.value, -}; + 'r': () => { + if (renoteCollapsed.value) return; + reply(); + }, + 'e|a|plus': () => { + if (renoteCollapsed.value) return; + react(); + }, + 'q': () => { + if (renoteCollapsed.value) return; + renote(); + }, + 'm': () => { + if (renoteCollapsed.value) return; + showMenu(); + }, + 'c': () => { + if (renoteCollapsed.value) return; + if (!defaultStore.state.showClipButtonInNoteFooter) return; + clip(); + }, + 'o': () => { + if (renoteCollapsed.value) return; + galleryEl.value?.openGallery(); + }, + 'v|enter': () => { + if (renoteCollapsed.value) { + renoteCollapsed.value = false; + } else if (appearNote.value.cw != null) { + showContent.value = !showContent.value; + } else if (isLong) { + collapsed.value = !collapsed.value; + } + }, + 'esc': { + allowRepeat: true, + callback: () => blur(), + }, + 'up|k|shift+tab': { + allowRepeat: true, + callback: () => focusBefore(), + }, + 'down|j|tab': { + allowRepeat: true, + callback: () => focusAfter(), + }, +} as const satisfies Keymap; provide('react', (reaction: string) => { misskeyApi('notes/reactions/create', { |