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";
5
5
6
6
export const renderChildText = ( properties : DecorationType [ ] ) => {
7
7
if ( ! properties ) return null ;
8
- return properties . map ( ( [ text , decorations ] , index ) => {
8
+ return properties . map ( ( [ text , decorations ] , i ) => {
9
9
if ( ! decorations ) {
10
10
return text ;
11
11
}
12
12
13
- return decorations . map ( decorator => {
13
+ return decorations . reduce ( ( element , decorator ) => {
14
14
switch ( decorator [ 0 ] ) {
15
15
case "h" :
16
16
return (
17
- < span key = { index } className = { `notion-${ decorator [ 1 ] } ` } >
18
- { text }
17
+ < span key = { i } className = { `notion-${ decorator [ 1 ] } ` } >
18
+ { element }
19
19
</ span >
20
20
) ;
21
21
case "c" :
22
22
return (
23
- < code key = { index } className = "notion-inline-code" >
24
- { text }
23
+ < code key = { i } className = "notion-inline-code" >
24
+ { element }
25
25
</ code >
26
26
) ;
27
27
case "b" :
28
- return < b key = { index } > { text } </ b > ;
28
+ return < b key = { i } > { element } </ b > ;
29
29
case "i" :
30
- return < em key = { index } > { text } </ em > ;
30
+ return < em key = { i } > { element } </ em > ;
31
31
case "s" :
32
- return < s key = { index } > { text } </ s > ;
32
+ return < s key = { i } > { element } </ s > ;
33
33
case "a" :
34
34
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 }
37
37
</ a >
38
38
) ;
39
39
40
40
default :
41
- return < React . Fragment key = { index } > text </ React . Fragment > ;
41
+ return < React . Fragment key = { i } > { element } </ React . Fragment > ;
42
42
}
43
- } ) ;
43
+ } , < > { text } </ > ) ;
44
44
} ) ;
45
45
} ;
46
46
You can’t perform that action at this time.
0 commit comments