diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 30f55fd2a..778c41c65 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); }); }