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 16137

Vanessa426be24f54cf
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index c5ca10c817..75544bccce 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",