Skip to content

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

:bug: windows 下回车新建块输入abc,选中 bc ctrl+m 后光标错误

Vanessa00d58cb4dc73
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index fa25396351..e1cec17ae4 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -21,7 +21,8 @@ import {isLocalPath, pathPosix} from "../../util/pathName";
import {genEmptyElement} from "../../block/util";
import {previewImage} from "../preview/image";
import {
- contentMenu, enterBack,
+ contentMenu,
+ enterBack,
fileAnnotationRefMenu,
imgMenu,
linkMenu,
@@ -1527,7 +1528,8 @@ export class WYSIWYG {
(!event.isComposing || (event.isComposing && range.toString() !== "")) // https://github.com/siyuan-note/siyuan/issues/4341
) {
// 搜狗输入法不走 keydown,需重新记录历史状态
- if (nodeElement && typeof protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] === "undefined") {
+ if (range.toString() === "" && // windows 下回车新建块输入abc,选中 bc ctrl+m 后光标错误
+ nodeElement && typeof protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] === "undefined") {
range.insertNode(document.createElement("wbr"));
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = nodeElement.outerHTML;
nodeElement.querySelector("wbr").remove();