mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 11:58:49 +01:00
🎨 Improve remote assets convert to local assets https://github.com/siyuan-note/siyuan/issues/13715
This commit is contained in:
parent
5ae2db8bb9
commit
13faf167d6
2 changed files with 4 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -176,10 +176,6 @@ func GetNodeSrcTokens(n *ast.Node) (ret string) {
|
|||
src := n.Tokens[index+len("src=\""):]
|
||||
if index = bytes.Index(src, []byte("\"")); 0 < index {
|
||||
src = src[:bytes.Index(src, []byte("\""))]
|
||||
if !util.IsAssetLinkDest(src) {
|
||||
return
|
||||
}
|
||||
|
||||
ret = strings.TrimSpace(string(src))
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue