Skip to content

Commit

Permalink
feat: add alt text support for images
Browse files Browse the repository at this point in the history
  • Loading branch information
yoo2001818 committed Nov 29, 2024
1 parent 3991343 commit 715c791
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/notion-types/src/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface BaseContentBlock extends BaseBlock {
properties: {
source: string[][]
caption?: Decoration[]
alt_text?: Decoration[]
}
format?: {
block_alignment: 'center' | 'left' | 'right'
Expand Down
3 changes: 2 additions & 1 deletion packages/react-notion-x/src/components/asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export function Asset({
}
const src = mapImageUrl(source, block as Block)
const caption = getTextContent(block.properties?.caption)
const alt = caption || 'notion image'
const altText = getTextContent(block.properties?.alt_text)
const alt = altText || caption || 'notion image'

content = (
<LazyImage
Expand Down

0 comments on commit 715c791

Please sign in to comment.