diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts index c9aae57af..d11969775 100644 --- a/app/src/config/keymap.ts +++ b/app/src/config/keymap.ts @@ -382,7 +382,7 @@ export const keymap = { } let hasConflict = false; if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) || - ["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) { + ["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) { showMessage(`${window.siyuan.languages.invalid} [${adoptKeymapStr}]`); hasConflict = true; } diff --git a/app/src/constants.ts b/app/src/constants.ts index 2ab743502..13a9d84df 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", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", + // "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D","⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", // "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义 public static readonly SIYUAN_KEYMAP: IKeymap = { general: { diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 83365b81a..a23e5f53e 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -718,7 +718,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // 删除,不可使用 isNotCtrl(event),否则软删除回导致 https://github.com/siyuan-note/siyuan/issues/5607 // 不可使用 !event.shiftKey,否则 https://ld246.com/article/1666434796806 - if (!event.altKey && (event.key === "Backspace" || event.key === "Delete")) { + if ((!event.altKey && (event.key === "Backspace" || event.key === "Delete")) || + matchHotKey("⌃D", event)) { if (protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) { removeBlock(protyle, nodeElement, range); event.stopPropagation(); @@ -800,7 +801,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { return; } const position = getSelectionOffset(editElement, protyle.wysiwyg.element, range); - if (event.key === "Delete") { + if (event.key === "Delete" || matchHotKey("⌃D", event)) { // 段末反向删除 https://github.com/siyuan-note/insider/issues/274 if (position.end === editElement.textContent.length) { const nextElement = getNextBlock(getTopAloneElement(nodeElement));