mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Display reference counts in the backlink panel https://github.com/siyuan-note/siyuan/issues/13618
This commit is contained in:
parent
e643d7106f
commit
ac0bb12dc8
3 changed files with 42 additions and 36 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue