mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 14:28:49 +01:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/15524
This commit is contained in:
parent
c640bfd91b
commit
7b8d163723
3 changed files with 16 additions and 15 deletions
|
|
@ -333,7 +333,7 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
|
|||
switch value.Type {
|
||||
case av.KeyTypeBlock: // 对于主键可能需要填充静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
|
||||
if nil != value.Block {
|
||||
for k, v := range ials[itemID] {
|
||||
for k, v := range ials[value.Block.ID] {
|
||||
if k == av.NodeAttrViewStaticText+"-"+attrView.ID {
|
||||
value.Block.Content = v
|
||||
break
|
||||
|
|
@ -451,11 +451,11 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
|
|||
keyValues = append(keyValues, &av.KeyValues{Key: createdKey, Values: []*av.Value{{ID: value.ID, KeyID: createdKey.ID, BlockID: itemID, Type: av.KeyTypeCreated, Created: value.Created}}})
|
||||
items[itemID] = keyValues
|
||||
case av.KeyTypeUpdated: // 渲染更新时间
|
||||
ial := ials[itemID]
|
||||
if nil == ial {
|
||||
ial = map[string]string{}
|
||||
}
|
||||
ial := map[string]string{}
|
||||
block := item.GetBlockValue()
|
||||
if nil != block {
|
||||
ial = ials[block.Block.ID]
|
||||
}
|
||||
updatedStr := ial["updated"]
|
||||
if "" == updatedStr && nil != block {
|
||||
value.Updated = av.NewFormattedValueUpdated(block.Block.Updated, 0, av.UpdatedFormatNone)
|
||||
|
|
@ -488,9 +488,10 @@ func fillAttributeViewTemplateValues(attrView *av.AttributeView, collection av.C
|
|||
switch value.Type {
|
||||
case av.KeyTypeTemplate: // 渲染模板字段
|
||||
keyValues := items[itemID]
|
||||
ial := ials[itemID]
|
||||
if nil == ial {
|
||||
ial = map[string]string{}
|
||||
ial := map[string]string{}
|
||||
blockVal := item.GetBlockValue()
|
||||
if nil != blockVal {
|
||||
ial = ials[blockVal.Block.ID]
|
||||
}
|
||||
content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content)
|
||||
value.Template.Content = content
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue