mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-20 19:10:49 +08:00
🎨 Search preview area supports memo positioning https://github.com/siyuan-note/siyuan/issues/13465
This commit is contained in:
parent
c5a1a3630f
commit
0a87b9aed8
@ -648,6 +648,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
existKeywords := 0 < len(keywords)
|
||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
var unlinks []*ast.Node
|
var unlinks []*ast.Node
|
||||||
ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus {
|
ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||||
@ -679,7 +680,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if highlight && 0 < len(keywords) {
|
if highlight && existKeywords {
|
||||||
hitBlock := false
|
hitBlock := false
|
||||||
for p := n.Parent; nil != p; p = p.Parent {
|
for p := n.Parent; nil != p; p = p.Parent {
|
||||||
if p.ID == id {
|
if p.ID == id {
|
||||||
@ -702,6 +703,16 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if existKeywords && id == n.ID {
|
||||||
|
inlines := n.ChildrenByType(ast.NodeTextMark)
|
||||||
|
for _, inline := range inlines {
|
||||||
|
if inline.IsTextMarkType("inline-memo") && util.ContainsSubStr(inline.TextMarkInlineMemoContent, keywords) {
|
||||||
|
// 支持行级备注搜索定位 https://github.com/siyuan-note/siyuan/issues/13465
|
||||||
|
keywords = append(keywords, inline.TextMarkTextContent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if processVirtualRef(n, &unlinks, virtualBlockRefKeywords, refCount, luteEngine) {
|
if processVirtualRef(n, &unlinks, virtualBlockRefKeywords, refCount, luteEngine) {
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
}
|
}
|
||||||
@ -726,6 +737,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||||||
keyword = strings.TrimSuffix(keyword, "#")
|
keyword = strings.TrimSuffix(keyword, "#")
|
||||||
keywords[i] = keyword
|
keywords[i] = keyword
|
||||||
}
|
}
|
||||||
|
keywords = gulu.Str.RemoveDuplicatedElem(keywords)
|
||||||
|
|
||||||
go setRecentDocByTree(tree)
|
go setRecentDocByTree(tree)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user