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

This commit is contained in:
Liang Ding 2023-01-03 22:57:43 +08:00
parent 997efb7778
commit 5e1d539719
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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)