File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -5,42 +5,42 @@ import Code from "./components/code";
55
66export const renderChildText = ( properties : DecorationType [ ] ) => {
77 if ( ! properties ) return null ;
8- return properties . map ( ( [ text , decorations ] , index ) => {
8+ return properties . map ( ( [ text , decorations ] , i ) => {
99 if ( ! decorations ) {
1010 return text ;
1111 }
1212
13- return decorations . map ( decorator => {
13+ return decorations . reduce ( ( element , decorator ) => {
1414 switch ( decorator [ 0 ] ) {
1515 case "h" :
1616 return (
17- < span key = { index } className = { `notion-${ decorator [ 1 ] } ` } >
18- { text }
17+ < span key = { i } className = { `notion-${ decorator [ 1 ] } ` } >
18+ { element }
1919 </ span >
2020 ) ;
2121 case "c" :
2222 return (
23- < code key = { index } className = "notion-inline-code" >
24- { text }
23+ < code key = { i } className = "notion-inline-code" >
24+ { element }
2525 </ code >
2626 ) ;
2727 case "b" :
28- return < b key = { index } > { text } </ b > ;
28+ return < b key = { i } > { element } </ b > ;
2929 case "i" :
30- return < em key = { index } > { text } </ em > ;
30+ return < em key = { i } > { element } </ em > ;
3131 case "s" :
32- return < s key = { index } > { text } </ s > ;
32+ return < s key = { i } > { element } </ s > ;
3333 case "a" :
3434 return (
35- < a className = "notion-link" href = { decorator [ 1 ] } key = { index } >
36- { text }
35+ < a className = "notion-link" href = { decorator [ 1 ] } key = { i } >
36+ { element }
3737 </ a >
3838 ) ;
3939
4040 default :
41- return < React . Fragment key = { index } > text </ React . Fragment > ;
41+ return < React . Fragment key = { i } > { element } </ React . Fragment > ;
4242 }
43- } ) ;
43+ } , < > { text } </ > ) ;
4444 } ) ;
4545} ;
4646
You can’t perform that action at this time.
0 commit comments