From 8c980af500bdc1c35ad8f18a4a33d01214b81d45 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 25 Oct 2025 10:30:20 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16113 --- app/src/protyle/wysiwyg/enter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index 75544bccc..053eacd63 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -181,7 +181,8 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle // 段首换行 if (editableElement.textContent !== "" && range.toString() === "" && position.start === 0) { let newElement; - if (blockElement.previousElementSibling.getAttribute("data-type") === "NodeHeading" && + if (blockElement.previousElementSibling && + blockElement.previousElementSibling.getAttribute("data-type") === "NodeHeading" && blockElement.previousElementSibling.getAttribute("fold") === "1") { newElement = genHeadingElement(blockElement.previousElementSibling, false, true) as HTMLDivElement; } else {