Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14290

Vanessa708da7c7535b
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index d7f5e517b7..5625451f4e 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -485,15 +485,17 @@ export class Toolbar {
item.textContent = item.textContent.substring(0, item.textContent.length - 1);
removeText += "\n";
}
- const inlineElement = document.createElement("span");
- inlineElement.setAttribute("data-type", type);
- inlineElement.textContent = item.textContent;
- setFontStyle(inlineElement, textObj);
+ if (item.textContent) {
+ const inlineElement = document.createElement("span");
+ inlineElement.setAttribute("data-type", type);
+ inlineElement.textContent = item.textContent;
+ setFontStyle(inlineElement, textObj);
- if (type === "text" && !inlineElement.getAttribute("style")) {
- newNodes.push(item);
- } else {
- newNodes.push(inlineElement);
+ if (type === "text" && !inlineElement.getAttribute("style")) {
+ newNodes.push(item);
+ } else {
+ newNodes.push(inlineElement);
+ }
}
} else if (item.nodeType === 1) {
let types = (item.getAttribute("data-type") || "").split(" ");