From 18c41e000dcc2b45397fbd77ede796378d0d9b44 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 28 Sep 2024 23:24:49 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/12637 --- app/src/protyle/render/mathRender.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/render/mathRender.ts b/app/src/protyle/render/mathRender.ts index 3c5372566..0678e8800 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 &&