mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
788a8d9a39
commit
426be24f54
1 changed files with 7 additions and 1 deletions
|
|
@ -180,7 +180,13 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
|
|||
|
||||
// 段首换行
|
||||
if (editableElement.textContent !== "" && range.toString() === "" && position.start === 0) {
|
||||
const newElement = genEmptyElement(false, true);
|
||||
let newElement;
|
||||
if (blockElement.previousElementSibling.getAttribute("data-type") === "NodeHeading" &&
|
||||
blockElement.previousElementSibling.getAttribute("fold") === "1") {
|
||||
newElement = genHeadingElement(blockElement.previousElementSibling, false, true) as HTMLDivElement;
|
||||
} else {
|
||||
newElement = genEmptyElement(false, true);
|
||||
}
|
||||
const newId = newElement.getAttribute("data-node-id");
|
||||
transaction(protyle, [{
|
||||
action: "insert",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue