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

Vanessaa9132e9af459
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 82e41174ab..57b9bacce0 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -433,6 +433,20 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
}
}
}
+
+ // https://github.com/siyuan-note/siyuan/issues/14807
+ if (previousLastEditElement) {
+ let previousLastChild = previousLastEditElement.lastChild;
+ if (previousLastChild.nodeType === 3) {
+ if (!previousLastChild.textContent) {
+ previousLastChild = hasPreviousSibling(previousLastChild) as ChildNode;
+ }
+ if (previousLastChild && previousLastChild.nodeType === 3 && previousLastChild.textContent.endsWith("\n")) {
+ previousLastChild.textContent = previousLastChild.textContent.slice(0, -1);
+ }
+ }
+ }
+
const scroll = protyle.contentElement.scrollTop;
const leftNodes = range.extractContents();
range.selectNodeContents(previousLastEditElement);