♻️ 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745

This commit is contained in:
Liang Ding 2022-11-29 22:42:15 +08:00
parent 32fb7e1882
commit 9a0f2e7bc3
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 35 additions and 25 deletions

View file

@ -204,7 +204,7 @@ func buildBacklink(refID string, refTree *parse.Tree, mentionKeywords []string,
}
if ast.NodeText == n.Type {
text := string(n.Tokens)
newText := markReplaceSpanWithSplit(text, mentionKeywords, searchMarkSpanStart, searchMarkSpanEnd)
newText := markReplaceSpanWithSplit(text, mentionKeywords, getMarkSpanStart(searchMarkDataType), getMarkSpanEnd())
if text == newText {
return ast.WalkContinue
}
@ -627,7 +627,6 @@ func buildTreeBackmention(defSQLBlock *sql.Block, refBlocks []*Block, keyword st
func searchBackmention(mentionKeywords []string, keyword string, excludeBacklinkIDs *hashset.Set, rootID string, beforeLen int) (ret []*Block) {
ret = []*Block{}
if 1 > len(mentionKeywords) {
return
}
@ -696,7 +695,7 @@ func searchBackmention(mentionKeywords []string, keyword string, excludeBacklink
continue
}
newText := markReplaceSpanWithSplit(text, mentionKeywords, searchMarkSpanStart, searchMarkSpanEnd)
newText := markReplaceSpanWithSplit(text, mentionKeywords, getMarkSpanStart(searchMarkDataType), getMarkSpanEnd())
if text != newText {
tmp = append(tmp, b)
}