From 35307911d1717de3aa404e93a54dd58f356d8946 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 5 Oct 2022 23:26:37 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/6065 --- app/src/protyle/toolbar/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 48a5a307a..295491109 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -570,8 +570,9 @@ export class Toolbar { } else if (newNodes.length > 0) { const lastNewNode = newNodes[newNodes.length - 1]; if (lastNewNode.nodeType !== 3 && (lastNewNode as HTMLElement).getAttribute("data-type") === "inline-math") { - if (lastNewNode.nextSibling) { - this.range.setStart(lastNewNode.nextSibling, 0); + const mathNextSibling = hasNextSibling(lastNewNode); + if (mathNextSibling) { // https://github.com/siyuan-note/siyuan/issues/6065 + this.range.setStart(mathNextSibling, 0); } else { this.range.setStartAfter(lastNewNode); }