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

Vanessa381a7b88ff21
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index a9735d89ed..47bf013648 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -179,11 +179,15 @@ export class Protyle {
if (this.protyle.wysiwyg.element.childElementCount === 0 && this.protyle.block.parentID &&
!(item.action === "delete" && typeof item.data?.createEmptyParagraph === "boolean" && !item.data.createEmptyParagraph)) {
if (item.action === "delete" && this.protyle.block.showAll) {
- zoomOut({
- protyle: this.protyle,
- id: this.protyle.block.rootID,
- focusId: this.protyle.block.id
- });
+ if (this.protyle.options.handleEmptyContent) {
+ this.protyle.options.handleEmptyContent();
+ } else {
+ zoomOut({
+ protyle: this.protyle,
+ id: this.protyle.block.rootID,
+ focusId: this.protyle.block.id
+ });
+ }
} else {
const newID = Lute.NewNodeID();
const emptyElement = genEmptyElement(false, false, newID);
diff --git a/app/src/types/protyle.d.ts b/app/src/types/protyle.d.ts
index 3b6b45376e..f61b00d99d 100644
--- a/app/src/types/protyle.d.ts
+++ b/app/src/types/protyle.d.ts
@@ -483,6 +483,8 @@ interface IProtyleOptions {
preventInsetEmptyBlock?: boolean
}
+ handleEmptyContent?(): void
+
/** 编辑器异步渲染完成后的回调方法 */
after?(protyle: import("../protyle").Protyle): void;
}