Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2025-08-21 10:50:56 +08:00
commit 6803c6483e
4 changed files with 31 additions and 6 deletions

View file

@ -1374,6 +1374,23 @@ func htmlBlock2Inline(tree *parse.Tree) {
img.AppendChild(&ast.Node{Type: ast.NodeLinkTitle})
}
img.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
if width := domAttrValue(htmlImg, "width"); "" != width {
if util2.IsDigit(width) {
width += "px"
}
style := "width: " + width + ";"
ial := &ast.Node{Type: ast.NodeKramdownSpanIAL, Tokens: parse.IAL2Tokens([][]string{{"style", style}})}
img.SetIALAttr("style", style)
img.InsertAfter(ial)
} else if height := domAttrValue(htmlImg, "height"); "" != height {
if util2.IsDigit(height) {
height += "px"
}
style := "height: " + height + ";"
ial := &ast.Node{Type: ast.NodeKramdownSpanIAL, Tokens: parse.IAL2Tokens([][]string{{"style", style}})}
img.SetIALAttr("style", style)
img.InsertAfter(ial)
}
if nil != n.Parent && ast.NodeText == n.Type {
// 行级 HTML 会被解析为文本,所以这里要在父级段落前面插入,避免形成段落嵌套 https://github.com/siyuan-note/siyuan/issues/13080

View file

@ -533,17 +533,25 @@ func fillAttributeViewTemplateValues(attrView *av.AttributeView, view *av.View,
func fillAttributeViewKeyValues(attrView *av.AttributeView, collection av.Collection) {
fieldValues := map[string][]*av.Value{}
for _, card := range collection.GetItems() {
for _, val := range card.GetValues() {
for _, item := range collection.GetItems() {
for _, val := range item.GetValues() {
keyID := val.KeyID
fieldValues[keyID] = append(fieldValues[keyID], val)
}
}
for keyID, values := range fieldValues {
keyValues, _ := attrView.GetKeyValues(keyID)
keyValues.Values = nil
for _, val := range values {
keyValues.Values = append(keyValues.Values, val)
exist := false
for _, kv := range keyValues.Values {
if kv.ID == val.ID {
exist = true
break
}
}
if !exist {
keyValues.Values = append(keyValues.Values, val)
}
}
}
}

View file

@ -120,7 +120,7 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
// 渲染自动生成的字段值,比如关联、汇总、创建时间和更新时间
fillAttributeViewAutoGeneratedValues(attrView, ret, ials, depth, renderedAttrViews)
// 最后单独渲染模板字段,这样模板就可以使用汇总、关联、创建时间和更新时间的值了
// 最后渲染模板字段,这样模板就可以使用汇总、关联、创建时间和更新时间的值了
renderTemplateErr := fillAttributeViewTemplateValues(attrView, view, ret, ials)
if nil != renderTemplateErr {
util.PushErrMsg(fmt.Sprintf(util.Langs[util.Lang][44], util.EscapeHTML(renderTemplateErr.Error())), 30000)

View file

@ -113,7 +113,7 @@ func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s
// 渲染自动生成的字段值,比如关联、汇总、创建时间和更新时间
fillAttributeViewAutoGeneratedValues(attrView, ret, ials, depth, renderedAttrViews)
// 最后单独渲染模板字段,这样模板就可以使用汇总、关联、创建时间和更新时间的值了
// 最后渲染模板字段,这样模板就可以使用汇总、关联、创建时间和更新时间的值了
renderTemplateErr := fillAttributeViewTemplateValues(attrView, view, ret, ials)
if nil != renderTemplateErr {
util.PushErrMsg(fmt.Sprintf(util.Langs[util.Lang][44], util.EscapeHTML(renderTemplateErr.Error())), 30000)