feat: add v-shortcut directive for keyboard shortcuts

This commit is contained in:
kolaente 2021-11-03 19:18:07 +01:00
parent a47d106926
commit eef8a6ff42
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 18 additions and 0 deletions

View File

@ -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",

View File

@ -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

View File

@ -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'

View File

@ -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"