🎨 Improve update tx

This commit is contained in:
Daniel 2023-09-14 09:31:23 +08:00
parent 49c076b4e5
commit 205e4a8436
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -454,9 +454,9 @@ func (tx *Transaction) doPrependInsert(operation *Operation) (ret *TxErr) {
var err error
block := treenode.GetBlockTree(operation.ParentID)
if nil == block {
msg := fmt.Sprintf("not found parent block [%s]", operation.ParentID)
logging.LogErrorf(msg)
return &TxErr{code: TxErrCodeBlockNotFound, id: operation.ParentID}
logging.LogErrorf("not found parent block [%s]", operation.ParentID)
util.ReloadUI() // 比如分屏后编辑器状态不一致,这里强制重新载入界面
return
}
tree, err := tx.loadTree(block.ID)
if nil != err {
@ -538,9 +538,9 @@ func (tx *Transaction) doAppendInsert(operation *Operation) (ret *TxErr) {
var err error
block := treenode.GetBlockTree(operation.ParentID)
if nil == block {
msg := fmt.Sprintf("not found parent block [%s]", operation.ParentID)
logging.LogErrorf(msg)
return &TxErr{code: TxErrCodeBlockNotFound, id: operation.ParentID}
logging.LogErrorf("not found parent block [%s]", operation.ParentID)
util.ReloadUI() // 比如分屏后编辑器状态不一致,这里强制重新载入界面
return
}
tree, err := tx.loadTree(block.ID)
if nil != err {
@ -779,9 +779,9 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
}
}
if nil == block {
msg := fmt.Sprintf("not found next block [%s]", operation.NextID)
logging.LogErrorf(msg)
return &TxErr{code: TxErrCodeBlockNotFound, id: operation.NextID}
logging.LogErrorf("not found block [%s, %s, %s]", operation.ParentID, operation.PreviousID, operation.NextID)
util.ReloadUI() // 比如分屏后编辑器状态不一致,这里强制重新载入界面
return
}
tree, err := tx.loadTree(block.ID)