🎨 Display reference counts in the backlink panel https://github.com/siyuan-note/siyuan/issues/13618

This commit is contained in:
Daniel 2024-12-27 10:53:37 +08:00
parent e643d7106f
commit ac0bb12dc8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 42 additions and 36 deletions

View file

@ -199,12 +199,12 @@ func sortBacklinks(backlinks []*Backlink, tree *parse.Tree) {
}
func buildBacklink(refID string, refTree *parse.Tree, keywords []string, highlight bool, luteEngine *lute.Lute) (ret *Backlink) {
n := treenode.GetNodeInTree(refTree, refID)
if nil == n {
node := treenode.GetNodeInTree(refTree, refID)
if nil == node {
return
}
renderNodes, expand := getBacklinkRenderNodes(n)
renderNodes, expand := getBacklinkRenderNodes(node)
if highlight && 0 < len(keywords) {
for _, renderNode := range renderNodes {
@ -229,15 +229,18 @@ func buildBacklink(refID string, refTree *parse.Tree, keywords []string, highlig
}
}
// 反链面板中显示块引用计数 Display reference counts in the backlink panel https://github.com/siyuan-note/siyuan/issues/13618
fillBlockRefCount(renderNodes)
dom := renderBlockDOMByNodes(renderNodes, luteEngine)
var blockPaths []*BlockPath
if (nil != n.Parent && ast.NodeDocument != n.Parent.Type) || (ast.NodeHeading != n.Type && 0 < treenode.HeadingLevel(n)) {
blockPaths = buildBlockBreadcrumb(n, nil, false)
if (nil != node.Parent && ast.NodeDocument != node.Parent.Type) || (ast.NodeHeading != node.Type && 0 < treenode.HeadingLevel(node)) {
blockPaths = buildBlockBreadcrumb(node, nil, false)
}
if 1 > len(blockPaths) {
blockPaths = []*BlockPath{}
}
ret = &Backlink{DOM: dom, BlockPaths: blockPaths, Expand: expand, node: n}
ret = &Backlink{DOM: dom, BlockPaths: blockPaths, Expand: expand, node: node}
return
}