Browse Source

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

Daniel 1 year ago
parent
commit
1d3e28da6f
1 changed files with 4 additions and 1 deletions
  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
 	})