Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/9643

Vanessa87032626e25b
diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts
index c9aae57af1..d11969775a 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 2ab743502d..13a9d84dfe 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 83365b81a6..a23e5f53eb 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));