Skip to content

Commit 7f7175d

Browse files
committed
fix: apply list_start_index for numbered_list
1 parent 359ffe5 commit 7f7175d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/notion-types/src/block.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ export interface BulletedListBlock extends BaseTextBlock {
193193

194194
export interface NumberedListBlock extends BaseTextBlock {
195195
type: 'numbered_list'
196+
format?: BaseTextBlock['format'] & {
197+
list_start_index?: number
198+
}
196199
}
197200

198201
export interface HeaderBlock extends BaseTextBlock {

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

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

48-
return group.indexOf(blockId) + 1
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
4952
}
5053

5154
export const getListNestingLevel = (

0 commit comments

Comments
 (0)