mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-27 17:34:06 +01:00
♻️ 搜索结果高亮支持大部分行级元素 https://github.com/siyuan-note/siyuan/issues/6745
This commit is contained in:
parent
32fb7e1882
commit
9a0f2e7bc3
5 changed files with 35 additions and 25 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue