Skip to content

Commit b457b11

Browse files
committed
fix: handle zero based index
1 parent 7f7175d commit b457b11

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/react-notion-x/src/utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ export const getListNumber = (blockId: string, blockMap: BlockMap) => {
4545
return
4646
}
4747

48-
return blockMap[blockId]?.value.type === 'numbered_list' &&
49-
blockMap[blockId]?.value.format?.list_start_index
50-
? blockMap[blockId]?.value.format?.list_start_index
51-
: group.indexOf(blockId) + 1
48+
const groupIndex = group.indexOf(blockId) + 1
49+
const startIndex = blockMap[blockId]?.value.format?.list_start_index
50+
return blockMap[blockId]?.value.type === 'numbered_list'
51+
? (startIndex ?? groupIndex)
52+
: groupIndex
5253
}
5354

5455
export const getListNestingLevel = (

0 commit comments

Comments
 (0)