Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/6007

Vanessa0ff3c06e3948
diff --git a/app/src/protyle/toolbar/InlineMath.ts b/app/src/protyle/toolbar/InlineMath.ts
index 663a9c09e7..671014033f 100644
--- a/app/src/protyle/toolbar/InlineMath.ts
+++ b/app/src/protyle/toolbar/InlineMath.ts
@@ -17,7 +17,7 @@ export class InlineMath extends ToolbarItem {
return;
}
let mathElement = hasClosestByAttribute(range.startContainer, "data-type", "inline-math") as Element;
- if (!mathElement && range.startContainer.nodeType !== 3) {
+ if (!mathElement && range.startContainer.nodeType !== 3 && range.startContainer.childNodes[range.startOffset]) {
const previousSibling = hasPreviousSibling(range.startContainer.childNodes[range.startOffset]) as HTMLElement;
if (previousSibling && previousSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
mathElement = previousSibling;