mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
1a48947e39
commit
cff3266ce2
1 changed files with 5 additions and 1 deletions
|
|
@ -163,6 +163,10 @@ func GetBlockIndex(id string) (ret int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootChild := node
|
||||||
|
for ; nil == rootChild.Parent || ast.NodeDocument != rootChild.Parent.Type; rootChild = rootChild.Parent {
|
||||||
|
}
|
||||||
|
|
||||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||||
if !entering {
|
if !entering {
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
|
|
@ -173,7 +177,7 @@ func GetBlockIndex(id string) (ret int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret++
|
ret++
|
||||||
if node == n {
|
if n.ID == rootChild.ID {
|
||||||
return ast.WalkStop
|
return ast.WalkStop
|
||||||
}
|
}
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue