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

Vanessa35ccbaa0f091
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index e12375db83..3292758187 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -446,6 +446,7 @@ export class Toolbar {
}
}
contents.childNodes.forEach((item: HTMLElement, index) => {
+ let removeText = "";
if (item.nodeType === 3) {
if (index === 0 && previousElement && previousElement.nodeType !== 3 &&
type === previousElement.getAttribute("data-type") &&
@@ -467,6 +468,11 @@ export class Toolbar {
newNodes.push(document.createTextNode(Constants.ZWSP));
item.textContent = item.textContent.substring(1);
}
+ // https://github.com/siyuan-note/siyuan/issues/14204
+ while (item.textContent.endsWith("\n")) {
+ 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;
@@ -588,6 +594,9 @@ export class Toolbar {
newNodes.push(item);
}
}
+ if (removeText) {
+ newNodes.push(document.createTextNode(removeText));
+ }
});
}
}