Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Daniel0e319abea26b
diff --git a/kernel/model/search.go b/kernel/model/search.go
index f92cf1fede..4875d7cfdc 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -965,11 +965,15 @@ 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)
+ 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.TextMarkTextContent = ""
-
- for _, defID := range defIDs {
- bt := treenode.GetBlockTree(defID)
- if nil == bt {
- continue
- }
-
- task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, bt.RootID, defID)
- }
return
}