Vanessa 2024-09-28 23:24:49 +08:00
parent 077604f65b
commit 18c41e000d

View file

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