Skip to content

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

:bug: Preserve IME input when replacing paragraphs starting with inline math https://github.com/siyuan-note/siyuan/issues/18074

Daniel023892762ef4
diff --git a/app/src/protyle/render/mathRender.ts b/app/src/protyle/render/mathRender.ts
index 7eb0155148..1d70cfd260 100644
--- a/app/src/protyle/render/mathRender.ts
+++ b/app/src/protyle/render/mathRender.ts
@@ -124,6 +124,9 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
} else if (!hasPreviousSibling(mathElement) && ["TH", "TD"].includes(mathElement.parentElement.tagName)) {
// 单元格中只有数学公式时,光标无法移动到数学公式前
mathElement.insertAdjacentText("afterbegin", Constants.ZWSP);
+ } else if (!hasPreviousSibling(mathElement)) {
+ // 段首公式前保留可编辑文本,使全选后的组合输入从文本边界开始。
+ mathElement.insertAdjacentText("beforebegin", Constants.ZWSP);
}
}