Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-10-21 11:07:22 +08:00
commit 8acc405e12
2 changed files with 10 additions and 5 deletions

View file

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

View file

@ -170,11 +170,13 @@ func buildBacklink(refID string, refTree *parse.Tree, keywords []string, luteEng
}
dom := renderBlockDOMByNodes(renderNodes, luteEngine)
ret = &Backlink{
DOM: dom,
BlockPaths: buildBlockBreadcrumb(n, nil),
Expand: expand,
blockPaths := []*BlockPath{}
if nil != n.Parent && nil != n.Parent.Parent {
// 仅在多余一层时才显示面包屑,这样界面展示更加简洁
// 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
}
@ -245,7 +247,6 @@ func GetBacklink2(id, keyword, mentionKeyword string, sortMode, mentionSortMode
linkRefs, linkRefsCount, excludeBacklinkIDs := buildLinkRefs(rootID, refs, keyword)
tmpBacklinks := toFlatTree(linkRefs, 0, "backlink", nil)
for _, l := range tmpBacklinks {
l.Blocks = nil
backlinks = append(backlinks, l)