🎨 Update av

This commit is contained in:
Daniel 2023-06-29 10:51:36 +08:00
parent 938f450097
commit 8602bde83f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -80,7 +80,7 @@ func (tx *Transaction) doUpdateAttrViewCell(operation *Operation) (ret *TxErr) {
return
}
c.Value = parseCellData(operation.Data, av.ColumnType(operation.Typ))
c.Value, c.RenderValue = parseCellData(operation)
attrs := parse.IAL2Map(node.KramdownIAL)
attrs[NodeAttrNamePrefixAvCol+c.ID] = c.Value
if err = setNodeAttrsWithTx(tx, node, tree, attrs); nil != err {
@ -293,12 +293,16 @@ func addAttributeViewBlock(blockID, avID string, tree *parse.Tree, tx *Transacti
return
}
func parseCellData(data interface{}, colType av.ColumnType) string {
func parseCellData(operation *Operation) (val, renderVal string) {
data := operation.Data
colType := av.ColumnType(operation.Typ)
switch colType {
case av.ColumnTypeText:
return data.(string)
val = data.(string)
renderVal = val
return
}
return ""
return
}
const NodeAttrNamePrefixAvCol = "av-col-"