Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16113

Vanessa8c980af500bd
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index 75544bccce..053eacd638 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 {