From 5ea91f3824c5b7689b549a6939a317244baca07c Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 27 Sep 2022 00:35:50 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/5958 --- app/src/protyle/util/hotKey.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/util/hotKey.ts b/app/src/protyle/util/hotKey.ts index 074f09875..30225f70c 100644 --- a/app/src/protyle/util/hotKey.ts +++ b/app/src/protyle/util/hotKey.ts @@ -90,7 +90,8 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => { const hasShift = hotKeys.length > 2 && (hotKeys[0] === "⇧"); if (isCtrl(event) && !event.altKey && ((!hasShift && !event.shiftKey) || (hasShift && event.shiftKey))) { const keyCode = (hasShift ? hotKeys[2] : hotKeys[1]); - let isMatchKey = event.key.toLowerCase() === keyCode.toLowerCase(); + let isMatchKey = (/^[0-9]$/.test(keyCode) ? (event.code === "Digit" + keyCode || event.code === "Numpad" + keyCode) : event.code === "Key" + keyCode) || + event.code === keyCode || event.key.toLowerCase() === keyCode.toLowerCase(); // 更新 electron 后不需要判断 Mac,但 Mac 下中英文有区别,需使用 keyCode 辅助 if (Constants.KEYCODE[event.keyCode]) { if (event.shiftKey) {