Vanessa 2025-07-29 20:44:52 +08:00
parent bf9721bf40
commit 227802b83c

View file

@ -48,6 +48,7 @@ import {getAllModels} from "../layout/getAll";
import {isSupportCSSHL} from "./render/searchMarkRender"; import {isSupportCSSHL} from "./render/searchMarkRender";
import {renderAVAttribute} from "./render/av/blockAttr"; import {renderAVAttribute} from "./render/av/blockAttr";
import {genEmptyElement} from "../block/util"; import {genEmptyElement} from "../block/util";
import {zoomOut} from "../menus/protyle";
export class Protyle { export class Protyle {
@ -179,16 +180,24 @@ export class Protyle {
// 反链面板移除元素后,文档为空 // 反链面板移除元素后,文档为空
if (this.protyle.wysiwyg.element.childElementCount === 0 && this.protyle.block.parentID && if (this.protyle.wysiwyg.element.childElementCount === 0 && this.protyle.block.parentID &&
!(item.action === "delete" && typeof item.data?.createEmptyParagraph === "boolean" && !item.data.createEmptyParagraph)) { !(item.action === "delete" && typeof item.data?.createEmptyParagraph === "boolean" && !item.data.createEmptyParagraph)) {
const newID = Lute.NewNodeID(); if (item.action === "delete" && this.protyle.block.showAll) {
const emptyElement = genEmptyElement(false, false, newID); zoomOut({
this.protyle.wysiwyg.element.append(emptyElement); protyle: this.protyle,
transaction(this.protyle, [{ id: this.protyle.block.rootID,
action: "insert", focusId: this.protyle.block.id
data: emptyElement.outerHTML, });
id: newID, } else {
parentID: this.protyle.block.parentID const newID = Lute.NewNodeID();
}]); const emptyElement = genEmptyElement(false, false, newID);
this.protyle.undo.clear(); this.protyle.wysiwyg.element.append(emptyElement);
transaction(this.protyle, [{
action: "insert",
data: emptyElement.outerHTML,
id: newID,
parentID: this.protyle.block.parentID
}]);
this.protyle.undo.clear();
}
} }
} }
}); });