From 9048b9e52f7df27262e1686c588b2f5e9a4c8dec Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 19 Nov 2024 15:15:37 +0800 Subject: [PATCH] :art: Improve av option editing https://github.com/siyuan-note/siyuan/issues/11484 --- kernel/model/attribute_view.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index bbbba9a4d..32acba973 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -3461,13 +3461,16 @@ func updateAttributeViewColumnOption(operation *Operation) (err error) { data := operation.Data.(map[string]interface{}) - oldName := data["oldName"].(string) - newName := data["newName"].(string) + rename := false + oldName := strings.TrimSpace(data["oldName"].(string)) + newName := strings.TrimSpace(data["newName"].(string)) + newDesc := strings.TrimSpace(data["newDesc"].(string)) newColor := data["newColor"].(string) - newDesc := data["newDesc"].(string) found := false if oldName != newName { + rename = true + for _, opt := range key.Options { if newName == opt.Name { // 如果选项已经存在则直接使用 found = true @@ -3507,7 +3510,7 @@ func updateAttributeViewColumnOption(operation *Operation) (err error) { break } } - if found { + if found && rename { idx := -1 for i, opt := range value.MSelect { if oldName == opt.Content {