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

View file

@ -692,6 +692,10 @@ func (tx *Transaction) doAppendInsert(operation *Operation) (ret *TxErr) {
return &TxErr{code: TxErrCodeBlockNotFound, id: operation.ParentID} return &TxErr{code: TxErrCodeBlockNotFound, id: operation.ParentID}
} }
isContainer := node.IsContainerBlock() isContainer := node.IsContainerBlock()
if !isContainer {
slices.Reverse(toInserts)
}
for i := 0; i < len(toInserts); i++ { for i := 0; i < len(toInserts); i++ {
toInsert := toInserts[i] toInsert := toInserts[i]
if isContainer { if isContainer {
@ -720,6 +724,9 @@ func (tx *Transaction) doAppendInsert(operation *Operation) (ret *TxErr) {
} else { } else {
node.InsertAfter(toInsert) node.InsertAfter(toInsert)
} }
createdUpdated(toInsert)
tx.nodes[toInsert.ID] = toInsert
} }
createdUpdated(insertedNode) createdUpdated(insertedNode)