🎨 Improve network image convert to local image https://github.com/siyuan-note/siyuan/issues/12561
This commit is contained in:
parent
e4e211a260
commit
ef575a1560
1 changed files with 9 additions and 0 deletions
|
@ -1057,10 +1057,19 @@ func assetsLinkDestsInNode(node *ast.Node) (ret []string) {
|
|||
|
||||
func setAssetsLinkDest(node *ast.Node, oldDest, dest string) {
|
||||
if ast.NodeLinkDest == node.Type {
|
||||
if bytes.HasPrefix(node.Tokens, []byte("//")) {
|
||||
node.Tokens = append([]byte("https:"), node.Tokens...)
|
||||
}
|
||||
node.Tokens = bytes.ReplaceAll(node.Tokens, []byte(oldDest), []byte(dest))
|
||||
} else if node.IsTextMarkType("a") {
|
||||
if strings.HasPrefix(node.TextMarkAHref, "//") {
|
||||
node.TextMarkAHref = "https:" + node.TextMarkAHref
|
||||
}
|
||||
node.TextMarkAHref = strings.ReplaceAll(node.TextMarkAHref, oldDest, dest)
|
||||
} else if ast.NodeAudio == node.Type || ast.NodeVideo == node.Type {
|
||||
if strings.HasPrefix(node.TextMarkAHref, "//") {
|
||||
node.TextMarkAHref = "https:" + node.TextMarkAHref
|
||||
}
|
||||
node.Tokens = bytes.ReplaceAll(node.Tokens, []byte(oldDest), []byte(dest))
|
||||
} else if ast.NodeAttributeView == node.Type {
|
||||
needWrite := false
|
||||
|
|
Loading…
Add table
Reference in a new issue