An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Preserve child block order when duplicating folded headings https://github.com/siyuan-note/siyuan/issues/18375
Daniel43874750f9dc
diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.tsindex 48147a4fab..7fa5dbbd03 100644--- a/app/src/protyle/wysiwyg/commonHotkey.ts+++ b/app/src/protyle/wysiwyg/commonHotkey.ts@@ -348,10 +348,8 @@ export const duplicateBlock = async (nodeElements: Element[], protyle: IProtyle)});const foldElement = document.createElement("template");foldElement.innerHTML = responseHTML.data;- Array.from(foldElement.content.children).reverse().forEach((childItem: HTMLElement, childIndex) => {- if (childIndex === foldElement.content.children.length - 1) {- return;- }+ let previousID = newId;+ Array.from(foldElement.content.children).slice(1).forEach((childItem: HTMLElement) => {childItem.removeAttribute("parent-heading");childItem.querySelectorAll("[data-node-id]").forEach(subItem => {subItem.setAttribute("data-node-id", Lute.NewNodeID());@@ -367,12 +365,13 @@ export const duplicateBlock = async (nodeElements: Element[], protyle: IProtyle)action: "insert",data: childItem.outerHTML,id: newChildId,- previousID: newId,+ previousID,});undoOperations.push({action: "delete",id: newChildId,});+ previousID = newChildId;});}}