🎨 Add template type column to Attribute View https://github.com/siyuan-note/siyuan/issues/8766

This commit is contained in:
Daniel 2023-10-01 18:14:31 +08:00
parent 7d1e1bf2e5
commit 0aa61fe5b7
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 18 additions and 17 deletions

View file

@ -232,7 +232,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
}
// 渲染模板列
if av.KeyTypeTemplate == tableCell.ValueType && nil != tableCell.Value && nil != tableCell.Value.Template {
if av.KeyTypeTemplate == tableCell.ValueType {
render := func(blockID string) string {
funcMap := sprig.TxtFuncMap()
goTpl := template.New("").Delims(".action{", "}")
@ -250,6 +250,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
return buf.String()
}
tableCell.Value = &av.Value{ID: tableCell.ID, KeyID: col.ID, BlockID: rowID, Type: av.KeyTypeTemplate, Template: &av.ValueTemplate{}}
tableCell.Value.Template.Render(tableCell.Value.BlockID, render)
}