Skip to content

Commit e524e40

Browse files
committed
feat: add alt text support for images
1 parent 3991343 commit e524e40

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: packages/notion-types/src/block.ts

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export interface BaseContentBlock extends BaseBlock {
131131
properties: {
132132
source: string[][]
133133
caption?: Decoration[]
134+
alt_text?: Decoration[]
134135
}
135136
format?: {
136137
block_alignment: 'center' | 'left' | 'right'

Diff for: packages/react-notion-x/src/components/asset.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@ export function Asset({
280280
source = block.properties?.source?.[0]?.[0]
281281
}
282282
const src = mapImageUrl(source, block as Block)
283+
const altText = getTextContent(block.properties?.alt_text)
283284
const caption = getTextContent(block.properties?.caption)
284-
const alt = caption || 'notion image'
285+
const alt = altText || caption || 'notion image'
285286

286287
content = (
287288
<LazyImage

0 commit comments

Comments
 (0)