@@ -4,18 +4,14 @@ import {
4
4
BlockType ,
5
5
ContentValueType ,
6
6
BlockMapType ,
7
- MapPageUrl
7
+ MapPageUrl ,
8
+ MapImageUrl
8
9
} from "./types" ;
9
10
import Asset from "./components/asset" ;
10
11
import Code from "./components/code" ;
11
12
import PageIcon from "./components/page-icon" ;
12
13
import PageHeader from "./components/page-header" ;
13
- import {
14
- classNames ,
15
- getTextContent ,
16
- getListNumber ,
17
- toNotionImageUrl
18
- } from "./utils" ;
14
+ import { classNames , getTextContent , getListNumber } from "./utils" ;
19
15
20
16
export const renderChildText = ( properties : DecorationType [ ] ) => {
21
17
return properties ?. map ( ( [ text , decorations ] , i ) => {
@@ -62,6 +58,7 @@ interface Block {
62
58
level : number ;
63
59
blockMap : BlockMapType ;
64
60
mapPageUrl : MapPageUrl ;
61
+ mapImageUrl : MapImageUrl ;
65
62
66
63
fullPage ?: boolean ;
67
64
zoom ?: any ;
@@ -75,7 +72,8 @@ export const Block: React.FC<Block> = props => {
75
72
fullPage,
76
73
blockMap,
77
74
zoom,
78
- mapPageUrl
75
+ mapPageUrl,
76
+ mapImageUrl
79
77
} = props ;
80
78
const blockValue = block ?. value ;
81
79
@@ -101,12 +99,16 @@ export const Block: React.FC<Block> = props => {
101
99
< div className = "notion notion-app" >
102
100
< div className = "notion-cursor-listener" >
103
101
< div className = "notion-frame" >
104
- < PageHeader blockMap = { blockMap } mapPageUrl = { mapPageUrl } />
102
+ < PageHeader
103
+ blockMap = { blockMap }
104
+ mapPageUrl = { mapPageUrl }
105
+ mapImageUrl = { mapImageUrl }
106
+ />
105
107
106
108
< div className = "notion-scroller" >
107
109
{ page_cover && (
108
110
< img
109
- src = { toNotionImageUrl ( page_cover ) }
111
+ src = { mapImageUrl ( page_cover ) }
110
112
alt = { getTextContent ( blockValue . properties . title ) }
111
113
className = "notion-page-cover"
112
114
style = { {
@@ -129,6 +131,7 @@ export const Block: React.FC<Block> = props => {
129
131
}
130
132
block = { block }
131
133
big
134
+ mapImageUrl = { mapImageUrl }
132
135
/>
133
136
) }
134
137
@@ -152,7 +155,7 @@ export const Block: React.FC<Block> = props => {
152
155
< a className = "notion-page-link" href = { mapPageUrl ( blockValue . id ) } >
153
156
{ blockValue . format && (
154
157
< div className = "notion-page-icon" >
155
- < PageIcon block = { block } />
158
+ < PageIcon block = { block } mapImageUrl = { mapImageUrl } />
156
159
</ div >
157
160
) }
158
161
< div className = "notion-page-text" >
@@ -243,7 +246,7 @@ export const Block: React.FC<Block> = props => {
243
246
className = "notion-asset-wrapper"
244
247
style = { { width : value . format . block_width } }
245
248
>
246
- < Asset block = { block } zoom = { zoom } />
249
+ < Asset block = { block } zoom = { zoom } mapImageUrl = { mapImageUrl } />
247
250
248
251
{ value . properties . caption && (
249
252
< figcaption className = "notion-image-caption" >
@@ -373,7 +376,7 @@ export const Block: React.FC<Block> = props => {
373
376
) }
374
377
>
375
378
< div >
376
- < PageIcon block = { block } />
379
+ < PageIcon block = { block } mapImageUrl = { mapImageUrl } />
377
380
</ div >
378
381
< div className = "notion-callout-text" >
379
382
{ renderChildText ( blockValue . properties . title ) }
0 commit comments