diff --git a/package.json b/package.json index dac211098..30bbe219e 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "browserslist:update": "npx browserslist@latest --update-db" }, "dependencies": { + "@github/hotkey": "^1.6.0", "@kyvg/vue3-notification": "2.3.4", "@sentry/tracing": "6.14.0", "@sentry/vue": "6.14.0", diff --git a/src/directives/shortcut.ts b/src/directives/shortcut.ts new file mode 100644 index 000000000..24824d477 --- /dev/null +++ b/src/directives/shortcut.ts @@ -0,0 +1,10 @@ +import {Directive} from 'vue' +import {install} from '@github/hotkey' + +const directive: Directive = { + mounted(el, {value}) { + install(el, value) + }, +} + +export default directive diff --git a/src/main.ts b/src/main.ts index 62977e429..ff59bd507 100644 --- a/src/main.ts +++ b/src/main.ts @@ -60,9 +60,11 @@ app.use(shortkey, {prevent: ['input', 'textarea', '.input', '[contenteditable]'] // directives import focus from './directives/focus' import tooltip from './directives/tooltip' +import shortcut from '@/directives/shortcut' app.directive('focus', focus) app.directive('tooltip', tooltip) +app.directive('shortcut', shortcut) // global components import FontAwesomeIcon from './icons' diff --git a/yarn.lock b/yarn.lock index b8f923635..e067cffaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -997,6 +997,11 @@ resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.0-5.tgz#6251e6917198362fa56510eb256cfb6aa6d30a32" integrity sha512-aNmBT4bOecrFsZTog1l6AJDQHPP3ocXV+WQ3Ogy8WZCqstB/ahfhH4CPu5i4N9Hw0MBKXqE+LX+NbUxcj8cVTw== +"@github/hotkey@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@github/hotkey/-/hotkey-1.6.0.tgz#64da82a18ac11d24f9d5d61575a0a58ba101b2ab" + integrity sha512-pm/xBWrn0yyD2GFqPUBH4ne7mdpdrnmdHxwKV0hN/jnSKj01RTPxau65SAvBvWD1Pf2VRv/OEE4H9ECORBHGdg== + "@hapi/hoek@^9.0.0": version "9.2.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"