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

Vanessa0ab814f7e4f7
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 8f887e84a6..ad586828e1 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -257,8 +257,8 @@ export class Toolbar {
return;
}
// 对已有字体样式的文字再次添加字体样式
- if (focusAdd && action === "add" && types.includes("bold") &&
- this.range.toString() === this.range.commonAncestorContainer.textContent) {
+ if (focusAdd && action === "add" && types.includes("bold") && this.range.startContainer.nodeType === 3 &&
+ this.range.startContainer.parentNode.isSameNode(this.range.endContainer.parentNode)) {
return;
}
let startElement = this.range.startContainer as Element;