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,11 +3465,24 @@ func updateAttributeViewColumnOption(operation *Operation) (err error) {
|
|||||||
newName := data["newName"].(string)
|
newName := data["newName"].(string)
|
||||||
newColor := data["newColor"].(string)
|
newColor := data["newColor"].(string)
|
||||||
|
|
||||||
for i, opt := range key.Options {
|
found := false
|
||||||
if oldName == opt.Name {
|
if oldName != newName {
|
||||||
key.Options[i].Name = newName
|
for _, opt := range key.Options {
|
||||||
key.Options[i].Color = newColor
|
if newName == opt.Name { // 如果选项名已经存在则直接使用
|
||||||
break
|
found = true
|
||||||
|
newColor = opt.Color
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !found {
|
||||||
|
for i, opt := range key.Options {
|
||||||
|
if oldName == opt.Name {
|
||||||
|
key.Options[i].Name = newName
|
||||||
|
key.Options[i].Color = newColor
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user