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

Vanessac6e816e59619
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index 0824e8a171..6ae8344064 100644
--- a/app/src/protyle/wysiwyg/enter.ts
+++ b/app/src/protyle/wysiwyg/enter.ts
@@ -407,7 +407,13 @@ const listEnter = (protyle: IProtyle, blockElement: HTMLElement, range: Range) =
newElement = genListItemElement(listItemElement, 0, false);
const newEditElement = getContenteditableElement(newElement);
newEditElement.appendChild(range.extractContents());
- newEditElement.parentElement.after(subListElement);
+ let subListNextElement = subListElement.nextElementSibling;
+ newElement.lastElementChild.before(subListElement);
+ // https://github.com/siyuan-note/siyuan/issues/13016
+ while (!subListNextElement.classList.contains("protyle-attr")) {
+ subListNextElement = subListNextElement.nextElementSibling;
+ newElement.lastElementChild.before(subListNextElement.previousElementSibling);
+ }
listItemElement.insertAdjacentElement("afterend", newElement);
if (listItemElement.getAttribute("data-subtype") === "o") {
updateListOrder(listItemElement.parentElement);
@@ -455,7 +461,7 @@ const listEnter = (protyle: IProtyle, blockElement: HTMLElement, range: Range) =
}
range.insertNode(document.createElement("wbr"));
const listItemHTML = listItemElement.outerHTML;
- const html = listItemElement.parentElement.outerHTML;
+ const oldHTML = listItemElement.parentElement.outerHTML;
if (range.toString() !== "") {
// 选中数学公式后回车取消选中 https://github.com/siyuan-note/siyuan/issues/12637#issuecomment-2381106949
const mathElement = hasClosestByAttribute(range.startContainer, "data-type", "inline-math");
@@ -513,7 +519,7 @@ const listEnter = (protyle: IProtyle, blockElement: HTMLElement, range: Range) =
data: listItemHTML
}]);
} else {
- updateTransaction(protyle, listItemElement.parentElement.getAttribute("data-node-id"), listItemElement.parentElement.outerHTML, html);
+ updateTransaction(protyle, listItemElement.parentElement.getAttribute("data-node-id"), listItemElement.parentElement.outerHTML, oldHTML);
}
focusByWbr(newElement, range);
scrollCenter(protyle);