🎨 The backlink panel no longer displays breadcrumbs of the first-level blocks https://github.com/siyuan-note/siyuan/issues/12862

This commit is contained in:
Daniel 2024-10-21 10:59:00 +08:00
parent 8b63066430
commit b1e7908b19
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 10 additions and 4 deletions

View file

@ -100,6 +100,10 @@ export const getBacklinkHeadingMore = (moreElement: HTMLElement) => {
}; };
export const genBreadcrumb = (blockPaths: IBreadcrumb[], renderFirst = false) => { export const genBreadcrumb = (blockPaths: IBreadcrumb[], renderFirst = false) => {
if (1 > blockPaths.length) {
return "";
}
let html = ""; let html = "";
blockPaths.forEach((item, index) => { blockPaths.forEach((item, index) => {
if (index === 0 && !renderFirst) { if (index === 0 && !renderFirst) {

View file

@ -170,11 +170,13 @@ func buildBacklink(refID string, refTree *parse.Tree, keywords []string, luteEng
} }
dom := renderBlockDOMByNodes(renderNodes, luteEngine) dom := renderBlockDOMByNodes(renderNodes, luteEngine)
ret = &Backlink{ blockPaths := []*BlockPath{}
DOM: dom, if nil != n.Parent && nil != n.Parent.Parent {
BlockPaths: buildBlockBreadcrumb(n, nil), // 仅在多余一层时才显示面包屑,这样界面展示更加简洁
Expand: expand, // The backlink panel no longer displays breadcrumbs of the first-level blocks https://github.com/siyuan-note/siyuan/issues/12862
blockPaths = buildBlockBreadcrumb(n, nil)
} }
ret = &Backlink{DOM: dom, BlockPaths: blockPaths, Expand: expand}
return return
} }