Browse Source

修复数字键不能输入问题

master
Cmen 3 years ago
parent
commit
f3b7f2e2f1
  1. 4
      src/utils/hotkeys.ts

4
src/utils/hotkeys.ts

@ -18,8 +18,6 @@ window.onkeydown = function (e) {
// console.log(key); // console.log(key);
if (listeners == null || listeners.length === 0) return; if (listeners == null || listeners.length === 0) return;
e.stopPropagation();
e.preventDefault();
// 异或操作. // 异或操作.
const xor = (a: boolean, b: boolean) => a !== b; const xor = (a: boolean, b: boolean) => a !== b;
@ -30,6 +28,8 @@ window.onkeydown = function (e) {
if (xor(shift, e.shiftKey)) return; if (xor(shift, e.shiftKey)) return;
if (xor(alt, e.altKey)) return; if (xor(alt, e.altKey)) return;
e.stopPropagation();
e.preventDefault();
callback(); callback();
}); });
}; };

Loading…
Cancel
Save