mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Improve update database cell option https://github.com/siyuan-note/siyuan/issues/13439
This commit is contained in:
parent
9166956057
commit
0bcf1372f4
1 changed files with 6 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ package model
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
@ -3112,7 +3113,11 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID string, valueDa
|
||||||
for _, valOpt := range val.MSelect {
|
for _, valOpt := range val.MSelect {
|
||||||
if opt := key.GetOption(valOpt.Content); nil == opt {
|
if opt := key.GetOption(valOpt.Content); nil == opt {
|
||||||
// 不存在的选项新建保存
|
// 不存在的选项新建保存
|
||||||
opt = &av.SelectOption{Name: valOpt.Content, Color: valOpt.Color}
|
color := valOpt.Color
|
||||||
|
if "" == color {
|
||||||
|
color = fmt.Sprintf("%d", 1+rand.Intn(15))
|
||||||
|
}
|
||||||
|
opt = &av.SelectOption{Name: valOpt.Content, Color: color}
|
||||||
key.Options = append(key.Options, opt)
|
key.Options = append(key.Options, opt)
|
||||||
} else {
|
} else {
|
||||||
// 已经存在的选项颜色需要保持不变
|
// 已经存在的选项颜色需要保持不变
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue