This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/directives/shortcut.ts

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