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/15523
This commit is contained in:
parent
31667b0964
commit
e871f4913f
2 changed files with 22 additions and 2 deletions
|
@ -200,7 +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"` // 分组排序值
|
||||
GroupSort int `json:"groupSort"` // 分组排序值,用于手动排序
|
||||
}
|
||||
|
||||
// GetGroupValue 获取分组视图的分组值。
|
||||
|
|
|
@ -1742,11 +1742,11 @@ func genAttrViewGroups(view *av.View, attrView *av.AttributeView) {
|
|||
v.GroupVal.MSelect = []*av.ValueSelect{{Content: opt.Name, Color: opt.Color}}
|
||||
}
|
||||
}
|
||||
v.GroupSort = -1
|
||||
view.Groups = append(view.Groups, v)
|
||||
}
|
||||
|
||||
view.GroupCreated = time.Now().UnixMilli()
|
||||
|
||||
setAttrViewGroupStates(view, groupStates)
|
||||
}
|
||||
|
||||
|
@ -1784,6 +1784,26 @@ func setAttrViewGroupStates(view *av.View, groupStates map[string]*GroupState) {
|
|||
groupView.GroupSort = state.Sort
|
||||
}
|
||||
}
|
||||
|
||||
defaultGroup := view.GetGroupByGroupValue(groupValueDefault)
|
||||
if nil != defaultGroup {
|
||||
if -1 == defaultGroup.GroupSort {
|
||||
view.RemoveGroupByID(defaultGroup.ID)
|
||||
} else {
|
||||
defaultGroup = nil
|
||||
}
|
||||
}
|
||||
|
||||
for i, groupView := range view.Groups {
|
||||
if i != groupView.GroupSort && -1 == groupView.GroupSort {
|
||||
groupView.GroupSort = i
|
||||
}
|
||||
}
|
||||
|
||||
if nil != defaultGroup {
|
||||
view.Groups = append(view.Groups, defaultGroup)
|
||||
defaultGroup.GroupSort = len(view.Groups) - 1
|
||||
}
|
||||
}
|
||||
|
||||
func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, err error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue