mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 01:21:14 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c8b8b28bcc
@ -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 := false
|
||||
if ast.NodeSuperBlock == targetNode.Type {
|
||||
// 在布局节点后插入
|
||||
@ -474,6 +482,15 @@ func isMovingFoldHeadingIntoSelf(targetNode *ast.Node, headingChildren []*ast.No
|
||||
return 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 error
|
||||
block := treenode.GetBlockTree(operation.ParentID)
|
||||
|
Loading…
Reference in New Issue
Block a user