mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve mirror databases refresh after updating database view layout https://github.com/siyuan-note/siyuan/issues/15233
This commit is contained in:
parent
e4fb89ee0e
commit
03a10b7c88
1 changed files with 19 additions and 6 deletions
|
|
@ -254,13 +254,26 @@ func ChangeAttrViewLayout(blockID, avID string, layout av.LayoutType) (err error
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
node.AttributeViewType = string(view.LayoutType)
|
changed := false
|
||||||
attrs := parse.IAL2Map(node.KramdownIAL)
|
attrs := parse.IAL2Map(node.KramdownIAL)
|
||||||
attrs[av.NodeAttrView] = view.ID
|
if blockID == bID { // 当前操作的镜像库
|
||||||
err = setNodeAttrs(node, tree, attrs)
|
attrs[av.NodeAttrView] = view.ID
|
||||||
if err != nil {
|
node.AttributeViewType = string(view.LayoutType)
|
||||||
logging.LogWarnf("set node [%s] attrs failed: %s", bID, err)
|
changed = true
|
||||||
return
|
} else {
|
||||||
|
if view.ID == attrs[av.NodeAttrView] {
|
||||||
|
// 仅更新和当前操作的镜像库指定的视图相同的镜像库
|
||||||
|
node.AttributeViewType = string(view.LayoutType)
|
||||||
|
changed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if changed {
|
||||||
|
err = setNodeAttrs(node, tree, attrs)
|
||||||
|
if err != nil {
|
||||||
|
logging.LogWarnf("set node [%s] attrs failed: %s", bID, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue