mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Update av
This commit is contained in:
parent
abd64a3f00
commit
44db6a8d5f
1 changed files with 2 additions and 15 deletions
|
|
@ -167,19 +167,12 @@ func (tx *Transaction) doInsertAttrViewBlock(operation *Operation) (ret *TxErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doRemoveAttrViewBlock(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doRemoveAttrViewBlock(operation *Operation) (ret *TxErr) {
|
||||||
firstSrcID := operation.SrcIDs[0]
|
|
||||||
tree, err := tx.loadTree(firstSrcID)
|
|
||||||
if nil != err {
|
|
||||||
logging.LogErrorf("load tree [%s] failed: %s", firstSrcID, err)
|
|
||||||
return &TxErr{code: TxErrCodeBlockNotFound, id: firstSrcID}
|
|
||||||
}
|
|
||||||
|
|
||||||
var avs []*av.AttributeView
|
var avs []*av.AttributeView
|
||||||
avID := operation.ParentID
|
avID := operation.ParentID
|
||||||
for _, id := range operation.SrcIDs {
|
for _, id := range operation.SrcIDs {
|
||||||
var av *av.AttributeView
|
var av *av.AttributeView
|
||||||
var avErr error
|
var avErr error
|
||||||
if av, avErr = removeAttributeViewBlock(id, avID, tree); nil != avErr {
|
if av, avErr = removeAttributeViewBlock(id, avID); nil != avErr {
|
||||||
return &TxErr{code: TxErrWriteAttributeView, id: avID}
|
return &TxErr{code: TxErrWriteAttributeView, id: avID}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,13 +369,7 @@ func sortAttributeViewRow(rowID, previousRowID, avID string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeAttributeViewBlock(blockID, avID string, tree *parse.Tree) (ret *av.AttributeView, err error) {
|
func removeAttributeViewBlock(blockID, avID string) (ret *av.AttributeView, err error) {
|
||||||
node := treenode.GetNodeInTree(tree, blockID)
|
|
||||||
if nil == node {
|
|
||||||
err = ErrBlockNotFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ret, err = av.ParseAttributeView(avID)
|
ret, err = av.ParseAttributeView(avID)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue