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

Vanessa7735a018f35b
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 30f55fd2a4..778c41c655 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -1720,6 +1720,22 @@ export class Gutter {
itemElement.remove();
});
});
+ if (protyle.wysiwyg.element.childElementCount === 0) {
+ const newID = Lute.NewNodeID();
+ const emptyElement = genEmptyElement(false, false, newID);
+ protyle.wysiwyg.element.insertAdjacentElement("afterbegin", emptyElement);
+ response.data.doOperations.push({
+ action: "insert",
+ data: emptyElement.outerHTML,
+ id: newID,
+ parentID: protyle.block.parentID
+ });
+ response.data.undoOperations.push({
+ action: "delete",
+ id: newID,
+ });
+ focusBlock(emptyElement);
+ }
transaction(protyle, response.data.doOperations, response.data.undoOperations);
});
});
@@ -1738,6 +1754,22 @@ export class Gutter {
itemElement.remove();
});
});
+ if (protyle.wysiwyg.element.childElementCount === 0) {
+ const newID = Lute.NewNodeID();
+ const emptyElement = genEmptyElement(false, false, newID);
+ protyle.wysiwyg.element.insertAdjacentElement("afterbegin", emptyElement);
+ response.data.doOperations.push({
+ action: "insert",
+ data: emptyElement.outerHTML,
+ id: newID,
+ parentID: protyle.block.parentID
+ });
+ response.data.undoOperations.push({
+ action: "delete",
+ id: newID,
+ });
+ focusBlock(emptyElement);
+ }
transaction(protyle, response.data.doOperations, response.data.undoOperations);
});
}