mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
🐛 Improve av https://github.com/siyuan-note/siyuan/issues/15472
This commit is contained in:
parent
a01c44a03d
commit
ec7ca366ba
1 changed files with 22 additions and 0 deletions
|
|
@ -415,11 +415,33 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oldHideEmpty := false
|
||||||
|
if nil != view.Group {
|
||||||
|
oldHideEmpty = view.Group.HideEmpty
|
||||||
|
}
|
||||||
|
|
||||||
groupStates := getAttrViewGroupStates(view)
|
groupStates := getAttrViewGroupStates(view)
|
||||||
view.Group = group
|
view.Group = group
|
||||||
regenAttrViewViewGroups(attrView, "force")
|
regenAttrViewViewGroups(attrView, "force")
|
||||||
setAttrViewGroupStates(view, groupStates)
|
setAttrViewGroupStates(view, groupStates)
|
||||||
|
|
||||||
|
if view.Group.HideEmpty != oldHideEmpty {
|
||||||
|
if !oldHideEmpty && view.Group.HideEmpty { // 启用隐藏空分组
|
||||||
|
for _, g := range view.Groups {
|
||||||
|
if g.GroupHidden == 0 && 1 > len(g.GroupItemIDs) {
|
||||||
|
g.GroupHidden = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if oldHideEmpty && !view.Group.HideEmpty { // 禁用隐藏空分组
|
||||||
|
for _, g := range view.Groups {
|
||||||
|
if g.GroupHidden == 1 && 1 > len(g.GroupItemIDs) {
|
||||||
|
g.GroupHidden = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = av.SaveAttributeView(attrView)
|
err = av.SaveAttributeView(attrView)
|
||||||
ReloadAttrView(avID)
|
ReloadAttrView(avID)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue