mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve the backlink panel breadcrumb and block sorting https://github.com/siyuan-note/siyuan/issues/13008
This commit is contained in:
parent
29603922ca
commit
a5b53c0dde
1 changed files with 12 additions and 0 deletions
|
|
@ -109,6 +109,7 @@ func GetBackmentionDoc(defID, refTreeID, keyword string, containChildren bool) (
|
||||||
|
|
||||||
if 0 < len(trees) {
|
if 0 < len(trees) {
|
||||||
sortBacklinks(ret, refTree)
|
sortBacklinks(ret, refTree)
|
||||||
|
filterBlockPaths(ret)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -151,6 +152,7 @@ func GetBacklinkDoc(defID, refTreeID, keyword string, containChildren bool) (ret
|
||||||
}
|
}
|
||||||
|
|
||||||
sortBacklinks(ret, refTree)
|
sortBacklinks(ret, refTree)
|
||||||
|
filterBlockPaths(ret)
|
||||||
|
|
||||||
for i := len(ret) - 1; 0 < i; i-- {
|
for i := len(ret) - 1; 0 < i; i-- {
|
||||||
curPaths := ret[i].BlockPaths
|
curPaths := ret[i].BlockPaths
|
||||||
|
|
@ -163,6 +165,16 @@ func GetBacklinkDoc(defID, refTreeID, keyword string, containChildren bool) (ret
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func filterBlockPaths(blockLinks []*Backlink) {
|
||||||
|
for _, b := range blockLinks {
|
||||||
|
if 1 == len(b.BlockPaths) && "NodeDocument" == b.BlockPaths[0].Type {
|
||||||
|
// 如果只有根文档这一层则不显示
|
||||||
|
b.BlockPaths = []*BlockPath{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func blockPathsEqual(paths1, paths2 []*BlockPath) bool {
|
func blockPathsEqual(paths1, paths2 []*BlockPath) bool {
|
||||||
if len(paths1) != len(paths2) {
|
if len(paths1) != len(paths2) {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue