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/9690

Vanessa21dd205fde26
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index a23e5f53eb..22d27358d1 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -6,7 +6,7 @@ import {
focusByWbr,
getEditorRange,
getSelectionOffset, getSelectionPosition,
- selectAll,
+ selectAll, setFirstNodeRange,
} from "../util/selection";
import {
hasClosestBlock,
@@ -860,6 +860,23 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.preventDefault();
return;
}
+ // https://github.com/siyuan-note/siyuan/issues/9690
+ const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN")
+ if (position.start === 2 && inlineElement &&
+ getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 &&
+ inlineElement.textContent.startsWith(Constants.ZWSP)) {
+ focusBlock(nodeElement);
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
+ if (position.start === 1 && !inlineElement && editElement.textContent.startsWith(Constants.ZWSP)) {
+ setFirstNodeRange(editElement, range);
+ removeBlock(protyle, nodeElement, range);
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
}
} else if (nodeElement.classList.contains("code-block") && getContenteditableElement(nodeElement).textContent === "\n") {
// 空代码块全选删除异常 https://github.com/siyuan-note/siyuan/issues/6706