2021-11-03 18:18:07 +00:00
|
|
|
import {Directive} from 'vue'
|
2021-11-03 18:47:53 +00:00
|
|
|
import {install, uninstall} from '@github/hotkey'
|
2021-11-03 19:10:23 +00:00
|
|
|
import {isMac} from '@/helpers/isMac'
|
2021-11-03 18:18:07 +00:00
|
|
|
|
|
|
|
const directive: Directive = {
|
|
|
|
mounted(el, {value}) {
|
2021-11-03 19:10:23 +00:00
|
|
|
if (isMac() && value.includes('Control')) {
|
|
|
|
value = value.replace('Control', 'Meta')
|
|
|
|
}
|
2021-11-03 18:18:07 +00:00
|
|
|
install(el, value)
|
|
|
|
},
|
2021-11-03 18:47:53 +00:00
|
|
|
beforeUnmount(el) {
|
|
|
|
uninstall(el)
|
|
|
|
},
|
2021-11-03 18:18:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default directive
|