Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.1 #590

Merged
merged 2 commits into from
Aug 29, 2023
Merged

1.1.1 #590

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/lucky-bears-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@headstartwp/core": patch
"@headstartwp/next": patch
---

Fix an issue for images without width or height
6 changes: 4 additions & 2 deletions packages/core/src/react/blocks/ImageBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export function ImageBlock({
}

const { src, alt, width: imgNodeWidth, height: imgNodeHeight } = imgNode.attribs;
const imageWidth = width ?? imgNodeWidth;
const imageHeight = height ?? imgNodeHeight;

return (
<Component
Expand All @@ -50,8 +52,8 @@ export function ImageBlock({
src={src}
alt={alt}
attributes={blockAttributes}
width={width || Number(imgNodeWidth)}
height={height || Number(imgNodeHeight)}
width={imageWidth ? Number(imageWidth) : undefined}
height={imageHeight ? Number(imageHeight) : undefined}
style={style}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/components/ImageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function ImageComponent({ src, alt, width, height, children, style, loade
}

if (!width || !height) {
<Image src={src} alt={alt || ''} fill style={style} loader={loader} />;
return <Image src={src} alt={alt || ''} fill style={style} loader={loader} />;
}

return (
Expand Down
Loading