mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 07:18:49 +01:00
🎨 Improve database exporting for asset field https://github.com/siyuan-note/siyuan/issues/12484
This commit is contained in:
parent
6d8319b13f
commit
7e19a77ccb
1 changed files with 9 additions and 2 deletions
|
|
@ -2341,7 +2341,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
}
|
||||
} else if av.KeyTypeMAsset == cell.Value.Type {
|
||||
if nil != cell.Value.MAsset {
|
||||
for _, a := range cell.Value.MAsset {
|
||||
for i, a := range cell.Value.MAsset {
|
||||
if av.AssetTypeImage == a.Type {
|
||||
img := &ast.Node{Type: ast.NodeImage}
|
||||
img.AppendChild(&ast.Node{Type: ast.NodeBang})
|
||||
|
|
@ -2355,13 +2355,20 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
} else if av.AssetTypeFile == a.Type {
|
||||
file := &ast.Node{Type: ast.NodeLink}
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(a.Name)})
|
||||
linkText := strings.TrimSpace(a.Name)
|
||||
if "" == linkText {
|
||||
linkText = a.Content
|
||||
}
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(linkText)})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte(a.Content)})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
mdTableCell.AppendChild(file)
|
||||
}
|
||||
if i < len(cell.Value.MAsset)-1 {
|
||||
mdTableCell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(" ")})
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue