Skip to content

Commit e3c8780

Browse files
authored
Merge pull request #344 from NotionX/zoom-option
added prop for isImageZoomable to renderer
2 parents 49d035a + fce60bf commit e3c8780

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/react-notion-x/src/components/asset-wrapper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const AssetWrapper: React.FC<{
1313
block: Block
1414
}> = ({ blockId, block }) => {
1515
const value = block as BaseContentBlock
16-
const { components, mapPageUrl, rootDomain } = useNotionContext()
16+
const { components, mapPageUrl, rootDomain, zoom } = useNotionContext()
1717

1818
let isURL = false
1919
if (block.type === 'image') {
@@ -37,7 +37,7 @@ export const AssetWrapper: React.FC<{
3737
blockId
3838
)}
3939
>
40-
<Asset block={value} zoomable={!isURL}>
40+
<Asset block={value} zoomable={zoom && !isURL}>
4141
{value?.properties?.caption && !isURL && (
4242
<figcaption className='notion-asset-caption'>
4343
<Text value={value.properties.caption} block={block} />

packages/react-notion-x/src/renderer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const NotionRenderer: React.FC<{
3131
forceCustomImages?: boolean
3232
showCollectionViewDropdown?: boolean
3333
linkTableTitleProperties?: boolean
34+
isImageZoomable?: boolean
3435

3536
showTableOfContents?: boolean
3637
minTableOfContentsItems?: number
@@ -67,6 +68,7 @@ export const NotionRenderer: React.FC<{
6768
forceCustomImages,
6869
showCollectionViewDropdown,
6970
linkTableTitleProperties,
71+
isImageZoomable = true,
7072
showTableOfContents,
7173
minTableOfContentsItems,
7274
defaultPageIcon,
@@ -105,7 +107,7 @@ export const NotionRenderer: React.FC<{
105107
defaultPageIcon={defaultPageIcon}
106108
defaultPageCover={defaultPageCover}
107109
defaultPageCoverPosition={defaultPageCoverPosition}
108-
zoom={zoom}
110+
zoom={isImageZoomable ? zoom : null}
109111
>
110112
<NotionBlockRenderer {...rest} />
111113
</NotionContextProvider>

0 commit comments

Comments
 (0)