mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-06 12:19:42 +08:00
🎨 Improve av option editing https://github.com/siyuan-note/siyuan/issues/11484
This commit is contained in:
parent
23c6f278f1
commit
09d6b5a8b8
@ -3465,6 +3465,18 @@ func updateAttributeViewColumnOption(operation *Operation) (err error) {
|
||||
newName := data["newName"].(string)
|
||||
newColor := data["newColor"].(string)
|
||||
|
||||
found := false
|
||||
if oldName != newName {
|
||||
for _, opt := range key.Options {
|
||||
if newName == opt.Name { // 如果选项名已经存在则直接使用
|
||||
found = true
|
||||
newColor = opt.Color
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
for i, opt := range key.Options {
|
||||
if oldName == opt.Name {
|
||||
key.Options[i].Name = newName
|
||||
@ -3472,6 +3484,7 @@ func updateAttributeViewColumnOption(operation *Operation) (err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果存在选项对应的值,需要更新值中的选项
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
|
Loading…
Reference in New Issue
Block a user