Explorar o código

:art: Add internal kernel API `/api/block/getBlocksIndexes` https://github.com/siyuan-note/siyuan/issues/10608

Daniel hai 1 ano
pai
achega
1d3e28da6f
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      kernel/model/blockinfo.go

+ 4 - 1
kernel/model/blockinfo.go

@@ -293,11 +293,14 @@ func GetBlocksIndexes(ids []string) (ret map[string]int) {
 		}
 
 		if !n.IsChildBlockOf(tree.Root, 1) {
+			if n.IsBlock() {
+				nodesIndexes[n.ID] = idx
+			}
 			return ast.WalkContinue
 		}
 
-		nodesIndexes[n.ID] = idx
 		idx++
+		nodesIndexes[n.ID] = idx
 		return ast.WalkContinue
 	})