@@ -48,17 +48,17 @@ export type MapPageUrl = (pageId: string) => string;
4848
4949interface Block {
5050 block : BlockType ;
51- parentBlock : BlockType ;
5251 level : number ;
52+ listNumber ?: number ;
5353 mapPageUrl ?: MapPageUrl ;
5454}
5555
5656export const Block : React . FC < Block > = props => {
57- const { block, parentBlock , children } = props ;
57+ const { block, children , listNumber , level } = props ;
5858 const blockValue = block ?. value ;
5959 switch ( blockValue ?. type ) {
6060 case "page" :
61- if ( props . level === 0 ) return < div className = "notion" > { children } </ div > ;
61+ if ( level === 0 ) return < div className = "notion" > { children } </ div > ;
6262 else {
6363 if ( ! blockValue . properties ) return null ;
6464 return (
@@ -111,14 +111,11 @@ export const Block: React.FC<Block> = props => {
111111 ) ;
112112 case "bulleted_list" :
113113 case "numbered_list" :
114- const isTopLevel = block . value . type !== parentBlock ?. value ?. type ;
115- const itemPosition =
116- 1 + ( parentBlock . value . content ?. indexOf ( block . value . id ) || 0 ) ;
117- const wrapList = ( content : React . ReactNode ) =>
114+ const wrapList = ( content : React . ReactNode , start ?: number ) =>
118115 blockValue . type === "bulleted_list" ? (
119116 < ul className = "notion-list notion-list-disc" > { content } </ ul >
120117 ) : (
121- < ol start = { itemPosition } className = "notion-list notion-list-numbered" >
118+ < ol start = { start } className = "notion-list notion-list-numbered" >
122119 { content }
123120 </ ol >
124121 ) ;
@@ -140,7 +137,7 @@ export const Block: React.FC<Block> = props => {
140137 ) : null ;
141138 }
142139
143- return isTopLevel ? wrapList ( output ) : output ;
140+ return listNumber !== undefined ? wrapList ( output , listNumber ) : output ;
144141
145142 case "image" :
146143 case "embed" :
0 commit comments