mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
♻️ Refactor av data structure
This commit is contained in:
parent
f123a9a210
commit
870c238ed6
2 changed files with 6 additions and 4 deletions
|
|
@ -82,9 +82,10 @@ type KeySelectOption struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Value struct {
|
type Value struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
KeyID string `json:"keyID"`
|
KeyID string `json:"keyID"`
|
||||||
BlockID string `json:"blockID"`
|
BlockID string `json:"blockID"`
|
||||||
|
Type KeyType `json:"type"`
|
||||||
|
|
||||||
Block *ValueBlock `json:"block,omitempty"`
|
Block *ValueBlock `json:"block,omitempty"`
|
||||||
Text *ValueText `json:"text,omitempty"`
|
Text *ValueText `json:"text,omitempty"`
|
||||||
|
|
|
||||||
|
|
@ -694,12 +694,13 @@ func updateAttributeViewCell(operation *Operation, tx *Transaction) (err error)
|
||||||
for _, value := range keyValues.Values {
|
for _, value := range keyValues.Values {
|
||||||
if operation.ID == value.ID {
|
if operation.ID == value.ID {
|
||||||
val = value
|
val = value
|
||||||
|
val.Type = keyValues.Key.Type
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil == val {
|
if nil == val {
|
||||||
val = &av.Value{ID: operation.ID, KeyID: keyValues.Key.ID, BlockID: operation.RowID}
|
val = &av.Value{ID: operation.ID, KeyID: keyValues.Key.ID, BlockID: operation.RowID, Type: keyValues.Key.Type}
|
||||||
keyValues.Values = append(keyValues.Values, val)
|
keyValues.Values = append(keyValues.Values, val)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue