frontend/src/directives/shortcut.ts
konrad 7f6f8963e7 feat: add keyboard shortcut to toggle task description edit (#2332)
Co-authored-by: kolaente <k@knt.li>
Reviewed-on: vikunja/frontend#2332
Reviewed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
2022-09-07 17:55:59 +00:00

21 lines
426 B
TypeScript

import type {Directive} from 'vue'
import {install, uninstall} from '@github/hotkey'
import {isAppleDevice} from '@/helpers/isAppleDevice'
const directive: Directive = {
mounted(el, {value}) {
if(value === '') {
return
}
if (isAppleDevice() && value.includes('Control')) {
value = value.replace('Control', 'Meta')
}
install(el, value)
},
beforeUnmount(el) {
uninstall(el)
},
}
export default directive