Explorar el Código

:art: 块滚动条跟随滚动 https://github.com/siyuan-note/siyuan/issues/4612

Liang Ding hace 2 años
padre
commit
cff3266ce2
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      kernel/model/blockinfo.go

+ 5 - 1
kernel/model/blockinfo.go

@@ -163,6 +163,10 @@ func GetBlockIndex(id string) (ret int) {
 		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 {
 		if !entering {
 			return ast.WalkContinue
@@ -173,7 +177,7 @@ func GetBlockIndex(id string) (ret int) {
 		}
 
 		ret++
-		if node == n {
+		if n.ID == rootChild.ID {
 			return ast.WalkStop
 		}
 		return ast.WalkContinue