Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/7953

Vanessa6215e1c6ab84
diff --git a/app/src/protyle/toolbar/InlineMath.ts b/app/src/protyle/toolbar/InlineMath.ts
index 671014033f..80b6224891 100644
--- a/app/src/protyle/toolbar/InlineMath.ts
+++ b/app/src/protyle/toolbar/InlineMath.ts
@@ -28,7 +28,7 @@ export class InlineMath extends ToolbarItem {
let hasMath = false;
// https://github.com/siyuan-note/siyuan/issues/6007
range.cloneContents().childNodes.forEach((item: HTMLElement) => {
- if ((item.nodeType !== 3 && item.getAttribute("data-type").indexOf("inline-math") > -1) ||
+ if ((item.nodeType !== 3 && (item.getAttribute("data-type") || "").indexOf("inline-math") > -1) ||
(item.nodeType == 3 && item.textContent === "")) {
// 是否仅选中数学公式
hasMath = true;
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 0dd1703433..d97257937c 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -901,14 +901,15 @@ export class Toolbar {
}
return;
}
- if (this.subElement.clientHeight <= window.innerHeight - nodeRect.bottom || this.subElement.clientHeight <= nodeRect.top) {
+ const bottom = nodeRect.bottom === nodeRect.top ? nodeRect.bottom + 26 : nodeRect.bottom;
+ if (this.subElement.clientHeight <= window.innerHeight - bottom || this.subElement.clientHeight <= nodeRect.top) {
if (types.includes("inline-math") || isInlineMemo) {
- setPosition(this.subElement, nodeRect.left, nodeRect.bottom, nodeRect.height);
+ setPosition(this.subElement, nodeRect.left, bottom, nodeRect.height || 26);
} else {
- setPosition(this.subElement, nodeRect.left + (nodeRect.width - this.subElement.clientWidth) / 2, nodeRect.bottom, nodeRect.height);
+ setPosition(this.subElement, nodeRect.left + (nodeRect.width - this.subElement.clientWidth) / 2, bottom, nodeRect.height || 26);
}
} else {
- setPosition(this.subElement, nodeRect.right, nodeRect.bottom);
+ setPosition(this.subElement, nodeRect.right, bottom);
}
};
const headerElement = this.subElement.querySelector(".block__icons");