From 0ff3c06e3948ff5164bd2416cc2cad382b6006b0 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 28 Sep 2022 21:24:30 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/6007 --- app/src/protyle/toolbar/InlineMath.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/protyle/toolbar/InlineMath.ts b/app/src/protyle/toolbar/InlineMath.ts index 663a9c09e..671014033 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;