Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16744

Vanessa86d649f29b58
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index 7a94aa0f87..df6af84150 100644
--- a/app/src/protyle/wysiwyg/enter.ts
+++ b/app/src/protyle/wysiwyg/enter.ts
@@ -63,9 +63,14 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
// ```test` 不处理,正常渲染为段落块
} else if (blockElement.classList.contains("p")) { // https://github.com/siyuan-note/siyuan/issues/6953
const oldHTML = blockElement.outerHTML;
+ // https://github.com/siyuan-note/siyuan/issues/16744
+ range.extractContents();
+ const wbrElement = document.createElement("wbr");
+ range.insertNode(wbrElement);
+ wbrElement.after(document.createTextNode("\n"));
let replaceInnerHTML = editableElement.innerHTML.replace(/\n(~|·|`){3,}/g, "\n```").trim().replace(/^(~|·|`){3,}/g, "```");
if (!replaceInnerHTML.endsWith("\n```")) {
- replaceInnerHTML += "<wbr>\n```";
+ replaceInnerHTML += "\n```";
}
editableElement.innerHTML = replaceInnerHTML;
blockElement.outerHTML = protyle.lute.SpinBlockDOM(blockElement.outerHTML);