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 {
|
for prev := parent.Previous; nil != prev; prev = prev.Previous {
|
||||||
if ast.NodeHeading == prev.Type && headingLevel > prev.HeadingLevel {
|
b := prev
|
||||||
name = gulu.Str.SubStr(renderBlockText(prev), maxNameLen)
|
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{{
|
ret = append([]*BlockPath{{
|
||||||
ID: prev.ID,
|
ID: b.ID,
|
||||||
Name: name,
|
Name: name,
|
||||||
Type: prev.Type.String(),
|
Type: b.Type.String(),
|
||||||
SubType: treenode.SubTypeAbbr(prev),
|
SubType: treenode.SubTypeAbbr(b),
|
||||||
}}, ret...)
|
}}, ret...)
|
||||||
headingLevel = prev.HeadingLevel
|
headingLevel = b.HeadingLevel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,14 @@ func SuperBlockHeading(sb *ast.Node) *ast.Node {
|
||||||
return nil
|
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 {
|
func HeadingParent(node *ast.Node) *ast.Node {
|
||||||
if nil == node {
|
if nil == node {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue