mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/15527
This commit is contained in:
parent
c3c467e3ee
commit
93fdc69bec
2 changed files with 8 additions and 3 deletions
|
@ -1493,12 +1493,14 @@ func GetBlockAttributeViewKeys(nodeID string) (ret []*BlockAttributeViewKeys) {
|
||||||
switch kv.Key.Type {
|
switch kv.Key.Type {
|
||||||
case av.KeyTypeTemplate:
|
case av.KeyTypeTemplate:
|
||||||
if 0 < len(kv.Values) {
|
if 0 < len(kv.Values) {
|
||||||
ial := map[string]string{}
|
var ial map[string]string
|
||||||
block := av.GetKeyBlockValue(keyValues)
|
block := av.GetKeyBlockValue(keyValues)
|
||||||
if nil != block && !block.IsDetached {
|
if nil != block && !block.IsDetached {
|
||||||
ial = sql.GetBlockAttrs(block.BlockID)
|
ial = sql.GetBlockAttrs(block.BlockID)
|
||||||
}
|
}
|
||||||
|
if nil == ial {
|
||||||
|
ial = map[string]string{}
|
||||||
|
}
|
||||||
if nil == kv.Values[0].Template {
|
if nil == kv.Values[0].Template {
|
||||||
kv.Values[0] = av.GetAttributeViewDefaultValue(kv.Values[0].ID, kv.Key.ID, nodeID, kv.Key.Type)
|
kv.Values[0] = av.GetAttributeViewDefaultValue(kv.Values[0].ID, kv.Key.ID, nodeID, kv.Key.Type)
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,11 +488,14 @@ func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.C
|
||||||
switch value.Type {
|
switch value.Type {
|
||||||
case av.KeyTypeTemplate: // 渲染模板字段
|
case av.KeyTypeTemplate: // 渲染模板字段
|
||||||
keyValues := items[itemID]
|
keyValues := items[itemID]
|
||||||
ial := map[string]string{}
|
var ial map[string]string
|
||||||
blockVal := item.GetBlockValue()
|
blockVal := item.GetBlockValue()
|
||||||
if nil != blockVal {
|
if nil != blockVal {
|
||||||
ial = ials[blockVal.Block.ID]
|
ial = ials[blockVal.Block.ID]
|
||||||
}
|
}
|
||||||
|
if nil == ial {
|
||||||
|
ial = map[string]string{}
|
||||||
|
}
|
||||||
content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content)
|
content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content)
|
||||||
value.Template.Content = content
|
value.Template.Content = content
|
||||||
if nil != renderErr {
|
if nil != renderErr {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue