|
@@ -1,4 +1,6 @@
|
|
|
let registerShortcuts = null
|
|
|
+const direction = ['ArrowRight', 'ArrowLeft', 'ArrowDown', 'ArrowUp']
|
|
|
+
|
|
|
|
|
|
export const xcHotKey = (keyList) => {
|
|
|
registerShortcuts = keyList
|
|
@@ -9,6 +11,7 @@ export const xcHotKey = (keyList) => {
|
|
|
|
|
|
export const logoutShortcut = () => {
|
|
|
document.onkeydown = null
|
|
|
+ registerShortcuts = null
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -24,7 +27,27 @@ const shortcutTrigger = (event) => {
|
|
|
if (event[pressSimultaneously] && event.key === key) {
|
|
|
event.returnValue = false
|
|
|
data[key]()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (key === 'direction') {
|
|
|
+ if ((event[pressSimultaneously] && direction.includes(event.code))) {
|
|
|
+ event.returnValue = false
|
|
|
+ data['direction'](event.key)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+ if (key === 'number') {
|
|
|
+ if (event[pressSimultaneously] && event.code === ('Digit' + event.key)) {
|
|
|
+ event.returnValue = false
|
|
|
+ data['number'](event.key)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (listKey === event.key) {
|
|
|
+ event.returnValue = false
|
|
|
+ registerShortcuts[listKey]()
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
}
|