Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/12637

Vanessa18c41e000dcc
diff --git a/app/src/protyle/render/mathRender.ts b/app/src/protyle/render/mathRender.ts
index 3c53725660..0678e88009 100644
--- a/app/src/protyle/render/mathRender.ts
+++ b/app/src/protyle/render/mathRender.ts
@@ -72,7 +72,7 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
mathElement.style.overflowY = "";
mathElement.style.display = "";
}
- const nextSibling = hasNextSibling(mathElement);
+ const nextSibling = hasNextSibling(mathElement) as HTMLElement;
if (!nextSibling) {
// 表格编辑问题 https://ld246.com/article/1629191424824
if (mathElement.parentElement.tagName !== "TH" && mathElement.parentElement.tagName !== "TD") {
@@ -83,7 +83,11 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
// 随着浏览器的升级,从 beforeend 修改为 afterend
mathElement.insertAdjacentText("afterend", Constants.ZWSP);
}
- } else if (nextSibling && nextSibling.nodeType !== 3 && (nextSibling as HTMLElement).getAttribute("data-type")?.indexOf("inline-math") > -1) {
+ } else if (nextSibling && nextSibling.nodeType !== 3 &&
+ (
+ nextSibling.getAttribute("data-type")?.indexOf("inline-math") > -1 ||
+ nextSibling.classList.contains("img")
+ )) {
// 相邻的数学公式删除或光标移动有问题
mathElement.after(document.createTextNode(Constants.ZWSP));
} else if (nextSibling &&