An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/9054
Vanessa9532a3eab641
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex da32330f9c..40b653ad04 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -1,7 +1,7 @@import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "./hasClosest";import * as dayjs from "dayjs";import {transaction, updateTransaction} from "../wysiwyg/transaction";-import {getContenteditableElement} from "../wysiwyg/getBlock";+import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";import {fixTableRange, focusBlock, focusByWbr, getEditorRange} from "./selection";import {mathRender} from "../render/mathRender";import {Constants} from "../../constants";@@ -150,6 +150,15 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,editableElement.innerHTML = replaceInnerHTML;}}+ const editWbrElement = editableElement.querySelector("wbr")+ if (editWbrElement && editableElement && !trimStartText.endsWith("\n")) {+ // 数学公式后无换行,后期渲染后添加导致 rang 错误,中文输入错误 https://github.com/siyuan-note/siyuan/issues/9054+ const previousElement = hasPreviousSibling(editWbrElement) as HTMLElement+ if (previousElement && previousElement.nodeType !== 3 && previousElement.dataset.type.indexOf("inline-math") > -1 &&+ !hasNextSibling(editWbrElement)) {+ editWbrElement.insertAdjacentText("afterend", "\n");+ }+ }mathRender(blockElement);updateTransaction(protyle, id, blockElement.outerHTML, oldHTML);focusByWbr(protyle.wysiwyg.element, range);