forked from vikunja/frontend
feat: add v-shortcut directive for keyboard shortcuts
This commit is contained in:
parent
a47d106926
commit
eef8a6ff42
|
@ -16,6 +16,7 @@
|
||||||
"browserslist:update": "npx browserslist@latest --update-db"
|
"browserslist:update": "npx browserslist@latest --update-db"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@github/hotkey": "^1.6.0",
|
||||||
"@kyvg/vue3-notification": "2.3.4",
|
"@kyvg/vue3-notification": "2.3.4",
|
||||||
"@sentry/tracing": "6.14.0",
|
"@sentry/tracing": "6.14.0",
|
||||||
"@sentry/vue": "6.14.0",
|
"@sentry/vue": "6.14.0",
|
||||||
|
|
10
src/directives/shortcut.ts
Normal file
10
src/directives/shortcut.ts
Normal 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
|
|
@ -60,9 +60,11 @@ app.use(shortkey, {prevent: ['input', 'textarea', '.input', '[contenteditable]']
|
||||||
// directives
|
// directives
|
||||||
import focus from './directives/focus'
|
import focus from './directives/focus'
|
||||||
import tooltip from './directives/tooltip'
|
import tooltip from './directives/tooltip'
|
||||||
|
import shortcut from '@/directives/shortcut'
|
||||||
|
|
||||||
app.directive('focus', focus)
|
app.directive('focus', focus)
|
||||||
app.directive('tooltip', tooltip)
|
app.directive('tooltip', tooltip)
|
||||||
|
app.directive('shortcut', shortcut)
|
||||||
|
|
||||||
// global components
|
// global components
|
||||||
import FontAwesomeIcon from './icons'
|
import FontAwesomeIcon from './icons'
|
||||||
|
|
|
@ -997,6 +997,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.0-5.tgz#6251e6917198362fa56510eb256cfb6aa6d30a32"
|
resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.0-5.tgz#6251e6917198362fa56510eb256cfb6aa6d30a32"
|
||||||
integrity sha512-aNmBT4bOecrFsZTog1l6AJDQHPP3ocXV+WQ3Ogy8WZCqstB/ahfhH4CPu5i4N9Hw0MBKXqE+LX+NbUxcj8cVTw==
|
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":
|
"@hapi/hoek@^9.0.0":
|
||||||
version "9.2.0"
|
version "9.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
|
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user