mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🐛 超级块下方块面包屑计算不正确 Fix https://github.com/siyuan-note/siyuan/issues/6675
This commit is contained in:
parent
5afffdb0f7
commit
ba6f0e2067
2 changed files with 20 additions and 6 deletions
|
|
@ -276,15 +276,21 @@ func buildBlockBreadcrumb(node *ast.Node) (ret []*BlockPath) {
|
|||
}
|
||||
|
||||
for prev := parent.Previous; nil != prev; prev = prev.Previous {
|
||||
if ast.NodeHeading == prev.Type && headingLevel > prev.HeadingLevel {
|
||||
name = gulu.Str.SubStr(renderBlockText(prev), maxNameLen)
|
||||
b := prev
|
||||
if ast.NodeSuperBlock == prev.Type {
|
||||
// 超级块下方块面包屑计算不正确 https://github.com/siyuan-note/siyuan/issues/6675
|
||||
b = treenode.SuperBlockLastHeading(prev)
|
||||
}
|
||||
|
||||
if ast.NodeHeading == b.Type && headingLevel > b.HeadingLevel {
|
||||
name = gulu.Str.SubStr(renderBlockText(b), maxNameLen)
|
||||
ret = append([]*BlockPath{{
|
||||
ID: prev.ID,
|
||||
ID: b.ID,
|
||||
Name: name,
|
||||
Type: prev.Type.String(),
|
||||
SubType: treenode.SubTypeAbbr(prev),
|
||||
Type: b.Type.String(),
|
||||
SubType: treenode.SubTypeAbbr(b),
|
||||
}}, ret...)
|
||||
headingLevel = prev.HeadingLevel
|
||||
headingLevel = b.HeadingLevel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,14 @@ func SuperBlockHeading(sb *ast.Node) *ast.Node {
|
|||
return nil
|
||||
}
|
||||
|
||||
func SuperBlockLastHeading(sb *ast.Node) *ast.Node {
|
||||
headings := sb.ChildrenByType(ast.NodeHeading)
|
||||
if 0 < len(headings) {
|
||||
return headings[len(headings)-1]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func HeadingParent(node *ast.Node) *ast.Node {
|
||||
if nil == node {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue