diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 907e837950b..4913f58ae05 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -2091,7 +2091,7 @@ export class WYSIWYG { ) { // 搜狗输入法不走 keydown,需重新记录历史状态 if (range.toString() === "" && // windows 下回车新建块输入abc,选中 bc ctrl+m 后光标错误 - !this.preventKeyup && + (!this.preventKeyup || event.code === "Space") && 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 c1f85726c07..6524bcd02ad 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -166,8 +166,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // 有可能输入 shift+. ,因此需要使用 event.key 来进行判断 if (event.key !== "PageUp" && event.key !== "PageDown" && event.key !== "Home" && event.key !== "End" && event.key.indexOf("Arrow") === -1 && event.key !== "Escape" && event.key !== "Shift" && event.key !== "Meta" && event.key !== "Alt" && event.key !== "Control" && event.key !== "CapsLock" && - !isNotEditBlock(nodeElement) && - !/^F\d{1,2}$/.test(event.key) && typeof protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] === "undefined") { + !isNotEditBlock(nodeElement) && !/^F\d{1,2}$/.test(event.key)) { const cloneRange = range.cloneRange(); range.insertNode(document.createElement("wbr")); protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = nodeElement.outerHTML;