🎨 Supports replacing tags with other inline elements https://github.com/siyuan-note/siyuan/issues/11238

This commit is contained in:
Daniel 2025-04-13 21:22:31 +08:00
parent f25dcffa98
commit 7003ef15cb
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -965,14 +965,27 @@ func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey
parse.NestedInlines2FlattedSpans(tree, false)
var replaceNodes []*ast.Node
var defIDs []string
for rNode := tree.Root.FirstChild.FirstChild; nil != rNode; rNode = rNode.Next {
replaceNodes = append(replaceNodes, rNode)
if blockRefID, _, _ := treenode.GetBlockRef(rNode); "" != blockRefID {
defIDs = append(defIDs, blockRefID)
}
}
for _, rNode := range replaceNodes {
n.InsertBefore(rNode)
}
n.TextMarkTextContent = ""
for _, defID := range defIDs {
bt := treenode.GetBlockTree(defID)
if nil == bt {
continue
}
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, bt.RootID, defID)
}
return
}