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/6065

Vanessa35307911d171
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 48a5a307a2..2954911091 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);
}