🎨 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:23:24 +08:00
parent b1f7dc7ed6
commit 0e319abea2
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -965,11 +965,15 @@ func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey
parse.NestedInlines2FlattedSpans(tree, false) parse.NestedInlines2FlattedSpans(tree, false)
var replaceNodes []*ast.Node var replaceNodes []*ast.Node
var defIDs []string
for rNode := tree.Root.FirstChild.FirstChild; nil != rNode; rNode = rNode.Next { for rNode := tree.Root.FirstChild.FirstChild; nil != rNode; rNode = rNode.Next {
replaceNodes = append(replaceNodes, rNode) replaceNodes = append(replaceNodes, rNode)
if blockRefID, _, _ := treenode.GetBlockRef(rNode); "" != blockRefID { if blockRefID, _, _ := treenode.GetBlockRef(rNode); "" != blockRefID {
defIDs = append(defIDs, blockRefID) bt := treenode.GetBlockTree(blockRefID)
if nil == bt {
continue
}
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, bt.RootID, blockRefID)
} }
} }
@ -977,15 +981,6 @@ func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey
n.InsertBefore(rNode) n.InsertBefore(rNode)
} }
n.TextMarkTextContent = "" 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 return
} }