An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/14534
Vanessabfecf5160a13
diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.tsindex ce268b821d..7faedc256a 100644--- a/app/src/protyle/toolbar/Font.ts+++ b/app/src/protyle/toolbar/Font.ts@@ -368,7 +368,7 @@ export const setFontStyle = (textElement: HTMLElement, textOption: ITextOption)export const hasSameTextStyle = (currentElement: HTMLElement, sideElement: HTMLElement, textObj: ITextOption) => {if (!textObj) {// https://github.com/siyuan-note/siyuan/issues/14019- if (currentElement.nodeType !== 3 && sideElement.nodeType !== 3 &&+ if (currentElement && currentElement.nodeType !== 3 && sideElement.nodeType !== 3 &&// 当为 span 时,都经过 isArrayEqual 判断sideElement.style.color === currentElement.style.color &&sideElement.style.webkitTextFillColor === currentElement.style.webkitTextFillColor &&@@ -384,7 +384,7 @@ export const hasSameTextStyle = (currentElement: HTMLElement, sideElement: HTMLEreturn false;}if (textObj.type === "id") {- if (currentElement.nodeType !== 3) {+ if (currentElement && currentElement.nodeType !== 3) {return currentElement.getAttribute("data-id") === sideElement.getAttribute("data-id") &¤tElement.getAttribute("data-subtype") === sideElement.getAttribute("data-subtype") &¤tElement.textContent === sideElement.textContent;@@ -396,7 +396,7 @@ export const hasSameTextStyle = (currentElement: HTMLElement, sideElement: HTMLE}if (textObj.type === "file-annotation-ref") {- if (currentElement.nodeType !== 3) {+ if (currentElement && currentElement.nodeType !== 3) {return currentElement.getAttribute("data-id") === sideElement.getAttribute("data-id") &¤tElement.textContent === sideElement.textContent;}@@ -409,7 +409,7 @@ export const hasSameTextStyle = (currentElement: HTMLElement, sideElement: HTMLElet textShadow = "";let backgroundColor = "";let fontSize = "";- if (currentElement.nodeType !== 3) {+ if (currentElement && currentElement.nodeType !== 3) {color = currentElement.style.color;webkitTextFillColor = currentElement.style.webkitTextFillColor;webkitTextStroke = currentElement.style.webkitTextStroke;diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 4eda229df8..846217d4ad 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -242,12 +242,21 @@ export class Toolbar {}const rangeTypes = this.getCurrentType(this.range);- // https://github.com/siyuan-note/siyuan/issues/6501- // https://github.com/siyuan-note/siyuan/issues/12877- if (rangeTypes.length === 1 &&- ["block-ref", "virtual-block-ref", "file-annotation-ref", "a", "inline-memo", "inline-math", "tag"].includes(rangeTypes[0]) && type === "clear") {- return;+ if (rangeTypes.length === 1) {+ // https://github.com/siyuan-note/siyuan/issues/6501+ // https://github.com/siyuan-note/siyuan/issues/12877+ if (["block-ref", "virtual-block-ref", "file-annotation-ref", "a", "inline-memo", "inline-math", "tag"].includes(rangeTypes[0]) && type === "clear") {+ return;+ }+ // https://github.com/siyuan-note/siyuan/issues/14534+ if (rangeTypes[0] === "text" && type === "text" && textObj && this.range.startContainer.nodeType === 3 && this.range.startContainer.isSameNode(this.range.endContainer)) {+ const selectParentElement = this.range.startContainer.parentElement;+ if (selectParentElement && hasSameTextStyle(null, selectParentElement, textObj)) {+ return;+ }+ }}+const selectText = this.range.toString();fixTableRange(this.range);let previousElement: HTMLElement;