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/12840
Vanessabf70e48392cf
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex bb64f3cc7a..e86ed96be9 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -83,20 +83,19 @@ export class Toolbar {return;}// https://github.com/siyuan-note/siyuan/issues/5157- let hasImg = false;let hasText = false;Array.from(range.cloneContents().childNodes).find(item => {- if (item.nodeType !== 1) {- if (item.textContent.length > 0 && item.textContent !== Constants.ZWSP) {+ // zwsp 不显示工具栏+ if (item.textContent.length > 0 && item.textContent !== Constants.ZWSP) {+ if (item.nodeType === 1 && (item as HTMLElement).classList.contains("img")) {+ // 图片不显示工具栏+ } else {hasText = true;return true;}- } else if ((item as HTMLElement).classList.contains("img")) {- hasImg = true;- return true;}});- if ((hasImg && !hasText) ||+ if (!hasText ||// 拖拽图片到最右侧(range.commonAncestorContainer.nodeType !== 3 && (range.commonAncestorContainer as HTMLElement).classList.contains("img"))) {this.element.classList.add("fn__none");@@ -370,7 +369,11 @@ export class Toolbar {}}contents.childNodes.forEach((item: HTMLElement, index) => {- if (item.nodeType !== 3 && item.tagName !== "BR" && item.tagName !== "IMG") {+ if (item.nodeType !== 3 && item.tagName !== "BR" && item.tagName !== "IMG" && !item.classList.contains("img")) {+ // 图片后有粗体,仅选中图片后,rang 中会包含一个空的粗体,需移除+ if (item.textContent === "") {+ return;+ }const types = (item.getAttribute("data-type") || "").split(" ");if (type === "clear") {for (let i = 0; i < types.length; i++) {@@ -484,12 +487,14 @@ export class Toolbar {hasSameTextStyle(item, nextElement, textObj)) {nextIndex = item.textContent.length;nextElement.innerHTML = item.textContent + nextElement.innerHTML;- } else {+ } else if (item.textContent !== Constants.ZWSP) {const inlineElement = document.createElement("span");inlineElement.setAttribute("data-type", type);inlineElement.textContent = item.textContent;setFontStyle(inlineElement, textObj);newNodes.push(inlineElement);+ } else {+ newNodes.push(item);}} else {let types = (item.getAttribute("data-type") || "").split(" ");@@ -500,7 +505,9 @@ export class Toolbar {i--;}}- types.push(type);+ if (!types.includes("img")) {+ types.push(type);+ }// 上标和下标不能同时存在 https://github.com/siyuan-note/insider/issues/1049if (type === "sub" && types.includes("sup")) {types.find((item, index) => {