From 68bbbd134dbdb0a0537d75dca044c30cb9c81b72 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 25 Nov 2024 11:15:25 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/13244 --- app/src/protyle/wysiwyg/index.ts | 1 + app/src/protyle/wysiwyg/keydown.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 4d6bd2fd8..907e83795 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -2091,6 +2091,7 @@ export class WYSIWYG { ) { // 搜狗输入法不走 keydown,需重新记录历史状态 if (range.toString() === "" && // windows 下回车新建块输入abc,选中 bc ctrl+m 后光标错误 + !this.preventKeyup && 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; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index b6ccabffe..c1f85726c 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -175,6 +175,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // 光标位于引用结尾后 ctrl+b 偶尔会失效 range = cloneRange; // 会导致 protyle.toolbar.range 和 range 不一致,先在有问题的地方重置一下 https://github.com/siyuan-note/siyuan/issues/10933 + protyle.wysiwyg.preventKeyup = true; // 搜狗输入法进入此代码记录的话,keyup 就不再记录,否则 transaction 清空后 keyup 再次记录,下一次 keydown 就不会记录 https://github.com/siyuan-note/siyuan/issues/13244 } if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&