🎨 Improve remote assets convert to local assets https://github.com/siyuan-note/siyuan/issues/13715

This commit is contained in:
Daniel 2025-01-05 09:34:57 +08:00
parent 5ae2db8bb9
commit 13faf167d6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 4 additions and 10 deletions

View file

@ -1095,7 +1095,6 @@ func assetsLinkDestsInNode(node *ast.Node) (ret []string) {
if !util.IsAssetLinkDest([]byte(dest)) {
continue
}
ret = append(ret, strings.TrimSpace(dest))
}
}
@ -1106,12 +1105,10 @@ func assetsLinkDestsInNode(node *ast.Node) (ret []string) {
if !util.IsAssetLinkDest([]byte(dest)) {
continue
}
ret = append(ret, strings.TrimSpace(dest))
}
}
}
}
} else {
if ast.NodeWidget == n.Type {
@ -1120,15 +1117,16 @@ func assetsLinkDestsInNode(node *ast.Node) (ret []string) {
// 兼容两种属性名 custom-data-assets 和 data-assets https://github.com/siyuan-note/siyuan/issues/4122#issuecomment-1154796568
dataAssets = n.IALAttr("data-assets")
}
if "" == dataAssets || !util.IsAssetLinkDest([]byte(dataAssets)) {
if !util.IsAssetLinkDest([]byte(dataAssets)) {
return ast.WalkContinue
}
ret = append(ret, dataAssets)
} else { // HTMLBlock/InlineHTML/IFrame/Audio/Video
dest := treenode.GetNodeSrcTokens(n)
if "" != dest {
ret = append(ret, dest)
if !util.IsAssetLinkDest([]byte(dest)) {
return ast.WalkContinue
}
ret = append(ret, dest)
}
}
return ast.WalkContinue