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

Vanessa692d11ab2abb
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 1948b24977..745bf8c7c6 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -34,16 +34,25 @@ const removeTopElement = (updateElement: Element, protyle: IProtyle) => {
});
}
topAloneElement.remove();
- if (protyle.block.rootID === protyle.block.id && protyle.wysiwyg.element.childElementCount === 0) {
- const newId = Lute.NewNodeID();
- const newElement = genEmptyElement(false, false, newId);
- doOperations.push({
- action: "insert",
- data: newElement.outerHTML,
- id: newId,
- parentID: protyle.block.parentID
- });
- protyle.wysiwyg.element.innerHTML = newElement.outerHTML;
+ if (protyle.wysiwyg.element.childElementCount === 0) {
+ if (protyle.block.rootID === protyle.block.id) {
+ const newId = Lute.NewNodeID();
+ const newElement = genEmptyElement(false, false, newId);
+ doOperations.push({
+ action: "insert",
+ data: newElement.outerHTML,
+ id: newId,
+ parentID: protyle.block.parentID
+ });
+ protyle.wysiwyg.element.innerHTML = newElement.outerHTML;
+ } else {
+ zoomOut({
+ protyle,
+ id: protyle.block.rootID,
+ isPushBack: false,
+ focusId: protyle.block.id,
+ })
+ }
}
if (doOperations.length > 0) {
transaction(protyle, doOperations, []);