An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Prevent parent move into child https://github.com/siyuan-note/siyuan/issues/13131
Daniel818d1746c043
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex 3078bfb041..f16dfa013d 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -358,6 +358,10 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {return}+ if isMovingParentIntoChild(srcNode, targetNode) {+ return+ }+for i := len(headingChildren) - 1; -1 < i; i-- {c := headingChildren[i]targetNode.InsertAfter(c)@@ -407,6 +411,10 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {return}+ if isMovingParentIntoChild(srcNode, targetNode) {+ return+ }+processed := falseif ast.NodeSuperBlock == targetNode.Type {// 在布局节点后插入@@ -474,6 +482,15 @@ func isMovingFoldHeadingIntoSelf(targetNode *ast.Node, headingChildren []*ast.Noreturn false}+func isMovingParentIntoChild(srcNode, targetNode *ast.Node) bool {+ for parent := targetNode.Parent; nil != parent; parent = parent.Parent {+ if parent.ID == srcNode.ID {+ return true+ }+ }+ return false+}+func (tx *Transaction) doPrependInsert(operation *Operation) (ret *TxErr) {var err errorblock := treenode.GetBlockTree(operation.ParentID)