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/17800

Vanessaf44fccb287fb
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index 454e5cfa5a..fc1caf2088 100644
--- a/app/src/protyle/wysiwyg/enter.ts
+++ b/app/src/protyle/wysiwyg/enter.ts
@@ -198,19 +198,19 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
} else {
newElement = genEmptyElement(false, true);
}
+ blockElement.insertAdjacentElement("beforebegin", newElement);
const newId = newElement.getAttribute("data-node-id");
transaction(protyle, [{
action: "insert",
data: newElement.outerHTML,
id: newId,
- previousID: blockElement.previousElementSibling ? blockElement.previousElementSibling.getAttribute("data-node-id") : "",
+ previousID: blockElement.previousElementSibling?.previousElementSibling?.getAttribute("data-node-id"),
parentID: getParentBlock(blockElement).getAttribute("data-node-id") || protyle.block.parentID
}], [{
action: "delete",
id: newId,
}]);
newElement.querySelector("wbr").remove();
- blockElement.insertAdjacentElement("beforebegin", newElement);
removeEmptyNode(newElement);
return true;
}