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 &&