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

This commit is contained in:
Vanessa 2024-09-09 23:02:57 +08:00
commit 24a0a94251
3 changed files with 16 additions and 3 deletions

View file

@ -1866,6 +1866,11 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
if util.IsAssetLinkDest([]byte(href)) {
n.TextMarkAHref = strings.ReplaceAll(href, " ", "_")
}
} else if ast.NodeIFrame == n.Type || ast.NodeAudio == n.Type || ast.NodeVideo == n.Type {
dest := treenode.GetNodeSrcTokens(n)
if util.IsAssetLinkDest([]byte(dest)) {
setAssetsLinkDest(n, dest, strings.ReplaceAll(dest, " ", "_"))
}
}
return ast.WalkContinue
})

View file

@ -54,6 +54,7 @@ func (tx *Transaction) doFoldHeading(operation *Operation) (ret *TxErr) {
return ast.WalkContinue
}
n.SetIALAttr("fold", "1")
n.SetIALAttr("heading-fold", "1")
return ast.WalkContinue
})

View file

@ -519,6 +519,8 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
}
indexHistoryDir(filepath.Base(historyDir), util.NewLute())
luteEngine := util.NewLute()
var reloadTreeIDs []string
for i, id := range ids {
bt := treenode.GetBlockTree(id)
if nil == bt {
@ -535,6 +537,8 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
continue
}
reloadTreeIDs = append(reloadTreeIDs, tree.ID)
if ast.NodeDocument == node.Type {
if !replaceTypes["docTitle"] {
continue
@ -555,7 +559,6 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
}
}
} else {
luteEngine := util.NewLute()
var unlinks []*ast.Node
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
@ -789,9 +792,13 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
}
WaitForWritingFiles()
if 0 < len(ids) {
task.AppendAsyncTaskWithDelay(task.ReloadUI, 500*time.Millisecond, util.ReloadUI)
reloadTreeIDs = gulu.Str.RemoveDuplicatedElem(reloadTreeIDs)
for _, id := range reloadTreeIDs {
util.PushProtyleReload(id)
}
util.PushClearProgress()
return
}