An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix https://github.com/siyuan-note/siyuan/issues/6007
Vanessac03b24fc01da
diff --git a/app/src/protyle/toolbar/InlineMath.ts b/app/src/protyle/toolbar/InlineMath.tsindex dc834c2b2b..663a9c09e7 100644--- a/app/src/protyle/toolbar/InlineMath.ts+++ b/app/src/protyle/toolbar/InlineMath.ts@@ -25,21 +25,24 @@ export class InlineMath extends ToolbarItem {}if (!mathElement && range.startOffset === range.startContainer.textContent.length && range.startContainer.nodeType === 3) {let isMath = true;+ let hasMath = false;+ // https://github.com/siyuan-note/siyuan/issues/6007range.cloneContents().childNodes.forEach((item: HTMLElement) => {if ((item.nodeType !== 3 && item.getAttribute("data-type").indexOf("inline-math") > -1) ||(item.nodeType == 3 && item.textContent === "")) {// 是否仅选中数学公式+ hasMath = true;} else {isMath = false;}});- if (isMath) {+ if (isMath && hasMath) {const nextSibling = hasNextSibling(range.startContainer) as HTMLElement;if (nextSibling && nextSibling.nodeType !== 3 && nextSibling.getAttribute("data-type").indexOf("inline-math") > -1) {mathElement = nextSibling;} else {const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement;- if (previousSibling && previousSibling.nodeType !== 3 && previousSibling.getAttribute("data-type").indexOf("inline-math") > -1) {+ if (range.startOffset === 0 && previousSibling && previousSibling.nodeType !== 3 && previousSibling.getAttribute("data-type").indexOf("inline-math") > -1) {mathElement = previousSibling;}}