Skip to content

Commit

Permalink
Merge pull request #122 from elia-orsini/master
Browse files Browse the repository at this point in the history
Feat: Use Alt Property for Image Blocks
  • Loading branch information
tobiaslins authored Oct 28, 2024
2 parents da9c9fc + 200df93 commit a937f47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const Asset: React.FC<{
if (block.value.type === "image") {
const src = mapImageUrl(value.properties.source[0][0], block);
const caption = value.properties.caption?.[0][0];
const altText = value.properties.alt_text?.[0][0];

if (block_aspect_ratio) {
return (
Expand All @@ -56,7 +57,7 @@ const Asset: React.FC<{
>
<img
className="notion-image-inset"
alt={caption || "notion image"}
alt={altText || caption || "notion image"}
src={src}
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export interface ContentValueType extends BaseValueType {
properties: {
source: string[][];
caption?: DecorationType[];
alt_text?: string[][];
};
format?: {
block_width: number;
Expand Down

0 comments on commit a937f47

Please sign in to comment.