diff --git a/package.json b/package.json index 5453bccdd..933d66065 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "browserslist:update": "npx browserslist@latest --update-db" }, "dependencies": { + "@github/hotkey": "^1.6.0", "@kyvg/vue3-notification": "2.3.4", "@sentry/tracing": "6.14.3", "@sentry/vue": "6.14.3", diff --git a/src/components/home/MenuButton.vue b/src/components/home/MenuButton.vue index ec5caeeac..14a2e4699 100644 --- a/src/components/home/MenuButton.vue +++ b/src/components/home/MenuButton.vue @@ -1,16 +1,17 @@ \ No newline at end of file diff --git a/src/components/misc/keyboard-shortcuts/index.vue b/src/components/misc/keyboard-shortcuts/index.vue new file mode 100644 index 000000000..c46d209e6 --- /dev/null +++ b/src/components/misc/keyboard-shortcuts/index.vue @@ -0,0 +1,54 @@ + + + + + \ No newline at end of file diff --git a/src/components/misc/keyboard-shortcuts/shortcuts.js b/src/components/misc/keyboard-shortcuts/shortcuts.js new file mode 100644 index 000000000..bcc5014b4 --- /dev/null +++ b/src/components/misc/keyboard-shortcuts/shortcuts.js @@ -0,0 +1,88 @@ +import {isAppleDevice} from '@/helpers/isAppleDevice' + +const ctrl = isAppleDevice() ? '⌘' : 'ctrl' + +export const KEYBOARD_SHORTCUTS = [ + { + title: 'keyboardShortcuts.general', + available: () => null, + shortcuts: [ + { + title: 'keyboardShortcuts.toggleMenu', + keys: [ctrl, 'e'], + }, + { + title: 'keyboardShortcuts.quickSearch', + keys: [ctrl, 'k'], + }, + ], + }, + { + title: 'list.kanban.title', + available: (route) => route.name === 'list.kanban', + shortcuts: [ + { + title: 'keyboardShortcuts.task.done', + keys: [ctrl, 'click'], + }, + ], + }, + { + title: 'keyboardShortcuts.list.title', + available: (route) => route.name.startsWith('list.'), + shortcuts: [ + { + title: 'keyboardShortcuts.list.switchToListView', + keys: ['g', 'l'], + combination: 'then', + }, + { + title: 'keyboardShortcuts.list.switchToGanttView', + keys: ['g', 'g'], + combination: 'then', + }, + { + title: 'keyboardShortcuts.list.switchToTableView', + keys: ['g', 't'], + combination: 'then', + }, + { + title: 'keyboardShortcuts.list.switchToKanbanView', + keys: ['g', 'k'], + combination: 'then', + }, + ], + }, + { + title: 'keyboardShortcuts.task.title', + available: (route) => [ + 'task.detail', + 'task.list.detail', + 'task.gantt.detail', + 'task.kanban.detail', + 'task.detail', + ].includes(route.name), + shortcuts: [ + { + title: 'keyboardShortcuts.task.assign', + keys: ['a'], + }, + { + title: 'keyboardShortcuts.task.labels', + keys: ['l'], + }, + { + title: 'keyboardShortcuts.task.dueDate', + keys: ['d'], + }, + { + title: 'keyboardShortcuts.task.attachment', + keys: ['f'], + }, + { + title: 'keyboardShortcuts.task.related', + keys: ['r'], + }, + ], + }, +] diff --git a/src/components/misc/shortcut.vue b/src/components/misc/shortcut.vue index 5d155db20..8c1809eaf 100644 --- a/src/components/misc/shortcut.vue +++ b/src/components/misc/shortcut.vue @@ -1,10 +1,10 @@ diff --git a/src/components/modal/modal.vue b/src/components/modal/modal.vue index 0f05b2190..76fcac454 100644 --- a/src/components/modal/modal.vue +++ b/src/components/modal/modal.vue @@ -12,8 +12,7 @@ class="modal-container" :class="{'has-overflow': overflow}" @click.self.prevent.stop="$emit('close')" - @shortkey="$emit('close')" - v-shortkey="['esc']" + v-shortcut="'Escape'" >