From 426be24f54cf53beefd3ab1433309e4b3b47aa9f Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 22 Oct 2025 19:46:45 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16113 16137 --- app/src/protyle/wysiwyg/enter.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index c5ca10c81..75544bccc 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -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",