From e0f1f789c3833dd7c640f4a59f708df62126b8ec Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 13 Aug 2025 17:23:27 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/13261 --- kernel/model/attribute_view.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 4db1cc3cc..9f3a19000 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -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, + }) } }