@@ -26,71 +26,45 @@ export const TableBlockRenderer: React.FC<TableBlockRendererProps> = ({
2626 className = { `notion-selectable notion-table-block${ className ? ` ${ className } ` : "" } ` }
2727 data-block-id = { block . id }
2828 >
29- < div >
30- < div >
31- < div className = "notion-scroller horizontal" >
32- < div className = "notion-table-content" >
33- < table >
34- < tbody >
35- { block . children ?. map ( ( child : any , index : number ) => {
36- if ( child ?. type === "table_row" ) {
37- const rowData = child . table_row ;
38- const isHeader =
39- index === 0 && tableData ?. has_column_header ;
29+ < div className = "notion-scroller horizontal" >
30+ < div className = "notion-table-content" >
31+ < table >
32+ < tbody >
33+ { block . children ?. map ( ( child : any , index : number ) => {
34+ if ( child ?. type === "table_row" ) {
35+ const rowData = child . table_row ;
36+ const isHeader = index === 0 && tableData ?. has_column_header ;
4037
41- return (
42- < tr
43- key = { child . id || index }
44- className = "notion-table-row"
45- data-block-id = { child . id }
46- >
47- { rowData ?. cells ?. map (
48- ( cell : any , cellIndex : number ) => {
49- const CellTag = isHeader ? "th" : "td" ;
50- return (
51- < CellTag
52- key = { cellIndex }
53- scope = { isHeader ? "col" : undefined }
54- >
55- < div className = "notion-table-cell" >
56- < div className = "notion-table-cell-text notranslate" >
57- < RichTextRenderer richText = { cell || [ ] } />
58- </ div >
59- </ div >
60- </ CellTag >
61- ) ;
62- }
63- ) }
64- </ tr >
65- ) ;
66- }
67- return null ;
68- } ) }
69- </ tbody >
70- </ table >
71- </ div >
72- </ div >
38+ return (
39+ < tr
40+ key = { child . id || index }
41+ className = "notion-table-row"
42+ data-block-id = { child . id }
43+ >
44+ { rowData ?. cells ?. map ( ( cell : any , cellIndex : number ) => {
45+ const CellTag = isHeader ? "th" : "td" ;
46+ return (
47+ < CellTag
48+ key = { cellIndex }
49+ scope = { isHeader ? "col" : undefined }
50+ >
51+ < div className = "notion-table-cell" >
52+ < div className = "notion-table-cell-text notranslate" >
53+ < RichTextRenderer richText = { cell || [ ] } />
54+ </ div >
55+ </ div >
56+ </ CellTag >
57+ ) ;
58+ } ) }
59+ </ tr >
60+ ) ;
61+ }
62+ return null ;
63+ } ) }
64+ </ tbody >
65+ </ table >
7366 </ div >
7467 </ div >
75-
76- { /* Render other children blocks recursively (non-table-row blocks) */ }
77- { block . children && block . children . length > 0 && (
78- < div
79- className = "notion-block-children"
80- style = { { marginLeft : `${ depth * 24 } px` } }
81- >
82- { block . children
83- . filter ( ( child : any ) => child ?. type !== "table_row" )
84- . map ( ( child : any , index : number ) => (
85- < BlockRenderer
86- key = { child . id || index }
87- block = { child }
88- depth = { depth + 1 }
89- components = { components }
90- />
91- ) ) }
92- </ div >
93- ) }
9468 </ div >
9569 ) ;
9670} ;
0 commit comments