mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
This commit is contained in:
parent
7595477257
commit
e0f1f789c3
1 changed files with 20 additions and 4 deletions
|
|
@ -4707,10 +4707,26 @@ func updateAttributeViewColumnOptions(operation *Operation) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
if keyValues.Key.ID == operation.ID {
|
||||
keyValues.Key.Options = options
|
||||
break
|
||||
selectKey, _ := attrView.GetKey(operation.ID)
|
||||
if nil == selectKey {
|
||||
return
|
||||
}
|
||||
existingOptions := map[string]*av.SelectOption{}
|
||||
for _, opt := range selectKey.Options {
|
||||
existingOptions[opt.Name] = opt
|
||||
}
|
||||
for _, opt := range options {
|
||||
if existingOpt, exists := existingOptions[opt.Name]; exists {
|
||||
// 如果选项已经存在则更新颜色和描述
|
||||
existingOpt.Color = opt.Color
|
||||
existingOpt.Desc = opt.Desc
|
||||
} else {
|
||||
// 如果选项不存在则添加新选项
|
||||
selectKey.Options = append(selectKey.Options, &av.SelectOption{
|
||||
Name: opt.Name,
|
||||
Color: opt.Color,
|
||||
Desc: opt.Desc,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue