🎨 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378

This commit is contained in:
Daniel 2023-10-09 17:30:19 +08:00
parent 4965b7b845
commit 288eb24474
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -161,6 +161,9 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets
if 1 > len(ret) {
ret = []*Block{}
}
// 在 hPath 中加入笔记本名 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378
prependNotebookNameInHPath(ret)
return
}
@ -205,9 +208,25 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets
newDoc = nil == treenode.GetBlockTreeRootByHPath(block.BoxID, p)
}
}
// 在 hPath 中加入笔记本名 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378
prependNotebookNameInHPath(ret)
return
}
func prependNotebookNameInHPath(blocks []*Block) {
var boxIDs []string
for _, b := range blocks {
boxIDs = append(boxIDs, b.Box)
}
boxIDs = gulu.Str.RemoveDuplicatedElem(boxIDs)
boxNames := Conf.BoxNames(boxIDs)
for _, b := range blocks {
name := boxNames[b.Box]
b.HPath = name + b.HPath
}
}
func FindReplace(keyword, replacement string, ids []string, paths, boxes []string, types map[string]bool, method, orderBy, groupBy int) (err error) {
// method0文本1查询语法2SQL3正则表达式
if 1 == method || 2 == method {