Vanessa 2025-09-22 15:34:16 +08:00
parent 088afbc2ea
commit 7735a018f3

View file

@ -1720,6 +1720,22 @@ export class Gutter {
itemElement.remove(); 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); transaction(protyle, response.data.doOperations, response.data.undoOperations);
}); });
}); });
@ -1738,6 +1754,22 @@ export class Gutter {
itemElement.remove(); 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); transaction(protyle, response.data.doOperations, response.data.undoOperations);
}); });
} }