@@ -4,18 +4,14 @@ import {
44 BlockType ,
55 ContentValueType ,
66 BlockMapType ,
7- MapPageUrl
7+ MapPageUrl ,
8+ MapImageUrl
89} from "./types" ;
910import Asset from "./components/asset" ;
1011import Code from "./components/code" ;
1112import PageIcon from "./components/page-icon" ;
1213import 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" ;
1915
2016export const renderChildText = ( properties : DecorationType [ ] ) => {
2117 return properties ?. map ( ( [ text , decorations ] , i ) => {
@@ -62,6 +58,7 @@ interface Block {
6258 level : number ;
6359 blockMap : BlockMapType ;
6460 mapPageUrl : MapPageUrl ;
61+ mapImageUrl : MapImageUrl ;
6562
6663 fullPage ?: boolean ;
6764 zoom ?: any ;
@@ -75,7 +72,8 @@ export const Block: React.FC<Block> = props => {
7572 fullPage,
7673 blockMap,
7774 zoom,
78- mapPageUrl
75+ mapPageUrl,
76+ mapImageUrl
7977 } = props ;
8078 const blockValue = block ?. value ;
8179
@@ -101,12 +99,16 @@ export const Block: React.FC<Block> = props => {
10199 < div className = "notion notion-app" >
102100 < div className = "notion-cursor-listener" >
103101 < div className = "notion-frame" >
104- < PageHeader blockMap = { blockMap } mapPageUrl = { mapPageUrl } />
102+ < PageHeader
103+ blockMap = { blockMap }
104+ mapPageUrl = { mapPageUrl }
105+ mapImageUrl = { mapImageUrl }
106+ />
105107
106108 < div className = "notion-scroller" >
107109 { page_cover && (
108110 < img
109- src = { toNotionImageUrl ( page_cover ) }
111+ src = { mapImageUrl ( page_cover ) }
110112 alt = { getTextContent ( blockValue . properties . title ) }
111113 className = "notion-page-cover"
112114 style = { {
@@ -129,6 +131,7 @@ export const Block: React.FC<Block> = props => {
129131 }
130132 block = { block }
131133 big
134+ mapImageUrl = { mapImageUrl }
132135 />
133136 ) }
134137
@@ -152,7 +155,7 @@ export const Block: React.FC<Block> = props => {
152155 < a className = "notion-page-link" href = { mapPageUrl ( blockValue . id ) } >
153156 { blockValue . format && (
154157 < div className = "notion-page-icon" >
155- < PageIcon block = { block } />
158+ < PageIcon block = { block } mapImageUrl = { mapImageUrl } />
156159 </ div >
157160 ) }
158161 < div className = "notion-page-text" >
@@ -243,7 +246,7 @@ export const Block: React.FC<Block> = props => {
243246 className = "notion-asset-wrapper"
244247 style = { { width : value . format . block_width } }
245248 >
246- < Asset block = { block } zoom = { zoom } />
249+ < Asset block = { block } zoom = { zoom } mapImageUrl = { mapImageUrl } />
247250
248251 { value . properties . caption && (
249252 < figcaption className = "notion-image-caption" >
@@ -373,7 +376,7 @@ export const Block: React.FC<Block> = props => {
373376 ) }
374377 >
375378 < div >
376- < PageIcon block = { block } />
379+ < PageIcon block = { block } mapImageUrl = { mapImageUrl } />
377380 </ div >
378381 < div className = "notion-callout-text" >
379382 { renderChildText ( blockValue . properties . title ) }
0 commit comments