🧑‍💻 Improve kernel API appendBlock and insertBlock https://github.com/siyuan-note/siyuan/issues/15798

This commit is contained in:
Daniel 2025-09-07 20:58:38 +08:00
parent 29244a1f8c
commit 6510d7dbf0
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1255,11 +1255,19 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
node.FirstChild.InsertAfter(remain)
}
} else {
for i := len(remains) - 1; 0 <= i; i-- {
remain := remains[i]
node.PrependChild(remain)
if !node.IsContainerBlock() {
for i := len(remains) - 1; 0 <= i; i-- {
remain := remains[i]
node.InsertAfter(remain)
}
node.InsertAfter(insertedNode)
} else {
for i := len(remains) - 1; 0 <= i; i-- {
remain := remains[i]
node.PrependChild(remain)
}
node.PrependChild(insertedNode)
}
node.PrependChild(insertedNode)
}
}
}