mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/14511
This commit is contained in:
parent
ffafbae979
commit
7ac0491a70
1 changed files with 14 additions and 12 deletions
|
@ -3002,22 +3002,24 @@ func removeAttributeViewBlock(srcIDs []string, avID string, tx *Transaction) (er
|
||||||
trees := map[string]*parse.Tree{}
|
trees := map[string]*parse.Tree{}
|
||||||
for _, keyValues := range attrView.KeyValues {
|
for _, keyValues := range attrView.KeyValues {
|
||||||
tmp := keyValues.Values[:0]
|
tmp := keyValues.Values[:0]
|
||||||
for i, values := range keyValues.Values {
|
for i, val := range keyValues.Values {
|
||||||
if !gulu.Str.Contains(values.BlockID, srcIDs) {
|
if !gulu.Str.Contains(val.BlockID, srcIDs) {
|
||||||
tmp = append(tmp, keyValues.Values[i])
|
tmp = append(tmp, keyValues.Values[i])
|
||||||
} else {
|
} else {
|
||||||
// Remove av block also remove node attr https://github.com/siyuan-note/siyuan/issues/9091#issuecomment-1709824006
|
// Remove av block also remove node attr https://github.com/siyuan-note/siyuan/issues/9091#issuecomment-1709824006
|
||||||
if bt := treenode.GetBlockTree(values.BlockID); nil != bt {
|
if !val.IsDetached && nil != val.Block {
|
||||||
tree := trees[bt.RootID]
|
if bt := treenode.GetBlockTree(val.Block.ID); nil != bt {
|
||||||
if nil == tree {
|
tree := trees[bt.RootID]
|
||||||
tree, _ = LoadTreeByBlockID(values.BlockID)
|
if nil == tree {
|
||||||
}
|
tree, _ = LoadTreeByBlockID(val.Block.ID)
|
||||||
|
}
|
||||||
|
|
||||||
if nil != tree {
|
if nil != tree {
|
||||||
trees[bt.RootID] = tree
|
trees[bt.RootID] = tree
|
||||||
if node := treenode.GetNodeInTree(tree, values.BlockID); nil != node {
|
if node := treenode.GetNodeInTree(tree, val.BlockID); nil != node {
|
||||||
if err = removeNodeAvID(node, avID, tx, tree); err != nil {
|
if err = removeNodeAvID(node, avID, tx, tree); err != nil {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue