mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Supports replacing tags with other inline elements https://github.com/siyuan-note/siyuan/issues/11238
This commit is contained in:
parent
b1f7dc7ed6
commit
0e319abea2
1 changed files with 6 additions and 11 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue