mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🐛 Improve av https://github.com/siyuan-note/siyuan/issues/15490
This commit is contained in:
parent
580ecd617d
commit
eba15bb41a
2 changed files with 9 additions and 0 deletions
|
|
@ -200,6 +200,7 @@ type View struct {
|
|||
GroupVal *Value `json:"groupVal,omitempty"` // 分组值
|
||||
GroupFolded bool `json:"groupFolded"` // 分组是否折叠
|
||||
GroupHidden int `json:"groupHidden"` // 分组是否隐藏,0:显示,1:空白隐藏,2:手动隐藏
|
||||
GroupSort int `json:"groupSort"` // 分组排序值
|
||||
}
|
||||
|
||||
// GetGroupValue 获取分组视图的分组值。
|
||||
|
|
|
|||
|
|
@ -198,6 +198,10 @@ func sortAttributeViewGroup(avID, blockID, previousGroupID, groupID string) (err
|
|||
}
|
||||
view.Groups = util.InsertElem(view.Groups, previousIndex, groupView)
|
||||
|
||||
for i, g := range view.Groups {
|
||||
g.GroupSort = i
|
||||
}
|
||||
|
||||
err = av.SaveAttributeView(attrView)
|
||||
return
|
||||
}
|
||||
|
|
@ -1797,6 +1801,7 @@ func renderAttributeView(attrView *av.AttributeView, blockID, viewID, query stri
|
|||
|
||||
func sortGroupViews(todayStart time.Time, view *av.View) {
|
||||
if av.GroupOrderMan == view.Group.Order {
|
||||
sort.Slice(view.Groups, func(i, j int) bool { return view.Groups[i].GroupSort < view.Groups[j].GroupSort })
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -2077,6 +2082,7 @@ type GroupState struct {
|
|||
ID string
|
||||
Folded bool
|
||||
Hidden int
|
||||
Sort int
|
||||
}
|
||||
|
||||
func getAttrViewGroupStates(view *av.View) (groupStates map[string]*GroupState) {
|
||||
|
|
@ -2090,6 +2096,7 @@ func getAttrViewGroupStates(view *av.View) (groupStates map[string]*GroupState)
|
|||
ID: groupView.ID,
|
||||
Folded: groupView.GroupFolded,
|
||||
Hidden: groupView.GroupHidden,
|
||||
Sort: groupView.GroupSort,
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
@ -2101,6 +2108,7 @@ func setAttrViewGroupStates(view *av.View, groupStates map[string]*GroupState) {
|
|||
groupView.ID = state.ID
|
||||
groupView.GroupFolded = state.Folded
|
||||
groupView.GroupHidden = state.Hidden
|
||||
groupView.GroupSort = state.Sort
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue