From 84b29657f8de4706c204f5f987f147b14f2fc7c9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 16 Nov 2023 11:22:37 +0800 Subject: [PATCH] :bug: windows --- app/src/config/keymap.ts | 4 ++-- app/src/constants.ts | 2 +- app/src/protyle/util/hotKey.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts index e97e14084..d129a0a42 100644 --- a/app/src/config/keymap.ts +++ b/app/src/config/keymap.ts @@ -382,9 +382,9 @@ export const keymap = { } let hasConflict = false; if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) || - ["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr) || + ["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr) || // 跳转到下/上一个编辑页签不能包含 ctrl, 否则不能监听到 keyup - (keys[0] === "general" && ["goToEditTabNext", "goToEditTabPrev"].includes(keys[1]) && keymapStr.includes("⌘")) + (isMac() && keys[0] === "general" && ["goToEditTabNext", "goToEditTabPrev"].includes(keys[1]) && keymapStr.includes("⌘")) ) { showMessage(`${window.siyuan.languages.invalid} [${adoptKeymapStr}]`); hasConflict = true; diff --git a/app/src/constants.ts b/app/src/constants.ts index f92f27ba8..08beb0e29 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -221,7 +221,7 @@ export abstract class Constants { }; // 冲突不使用 "⌘S/Q" // "⌘", "⇧", "⌥", "⌃" - // "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", + // "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⇧⌘→", "⇧⌘←", // "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义 public static readonly SIYUAN_KEYMAP: IKeymap = { general: { diff --git a/app/src/protyle/util/hotKey.ts b/app/src/protyle/util/hotKey.ts index 73433f12b..86cc5166d 100644 --- a/app/src/protyle/util/hotKey.ts +++ b/app/src/protyle/util/hotKey.ts @@ -8,7 +8,7 @@ export const matchAuxiliaryHotKey = (hotKey: string, event: KeyboardEvent) => { return false; } } else { - if (event.ctrlKey) { + if (isMac() ? event.ctrlKey : (hotKey.includes("⌘") ? !event.ctrlKey : event.ctrlKey)) { return false; } } @@ -35,7 +35,7 @@ export const matchAuxiliaryHotKey = (hotKey: string, event: KeyboardEvent) => { return false; } } else { - if (isMac() ? event.metaKey : event.ctrlKey) { + if (isMac() ? event.metaKey : (hotKey.includes("⌃") ? !event.ctrlKey : event.ctrlKey)) { return false; } }