Skip to content

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

:bug: 搜索高亮超链接锚文本后预览窗口修改导致地址失效 Fix https://github.com/siyuan-note/siyuan/issues/6982

Liang Ding5e1d53971951
diff --git a/kernel/model/search.go b/kernel/model/search.go
index 0f11a4dc16..de95a17796 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -910,6 +910,23 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markS
c.Type = ast.NodeTextMark
c.TextMarkType = n.TextMarkType
c.TextMarkTextContent = string(c.Tokens)
+ if n.IsTextMarkType("a") {
+ c.TextMarkAHref, c.TextMarkATitle = n.TextMarkAHref, n.TextMarkATitle
+ } else if n.IsTextMarkType("block-ref") {
+ c.TextMarkBlockRefID = n.TextMarkBlockRefID
+ c.TextMarkBlockRefSubtype = n.TextMarkBlockRefSubtype
+ } else if n.IsTextMarkType("file-annotation-ref") {
+ c.TextMarkFileAnnotationRefID = n.TextMarkFileAnnotationRefID
+ }
+ } else if ast.NodeTextMark == c.Type {
+ if n.IsTextMarkType("a") {
+ c.TextMarkAHref, c.TextMarkATitle = n.TextMarkAHref, n.TextMarkATitle
+ } else if n.IsTextMarkType("block-ref") {
+ c.TextMarkBlockRefID = n.TextMarkBlockRefID
+ c.TextMarkBlockRefSubtype = n.TextMarkBlockRefSubtype
+ } else if n.IsTextMarkType("file-annotation-ref") {
+ c.TextMarkFileAnnotationRefID = n.TextMarkFileAnnotationRefID
+ }
}
children = append(children, c)