mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +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
|
||||
}
|
||||
|
||||
oldHideEmpty := false
|
||||
if nil != view.Group {
|
||||
oldHideEmpty = view.Group.HideEmpty
|
||||
}
|
||||
|
||||
groupStates := getAttrViewGroupStates(view)
|
||||
view.Group = group
|
||||
regenAttrViewViewGroups(attrView, "force")
|
||||
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)
|
||||
ReloadAttrView(avID)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue