From 00d58cb4dc73155f16e5619c74db46aa6b034d8c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 29 Aug 2023 23:02:10 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20windows=20=E4=B8=8B=E5=9B=9E=E8=BD=A6?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=9D=97=E8=BE=93=E5=85=A5abc=EF=BC=8C?= =?UTF-8?q?=E9=80=89=E4=B8=AD=20bc=20ctrl+m=20=E5=90=8E=E5=85=89=E6=A0=87?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/wysiwyg/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index fa2539635..e1cec17ae 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();