diff --git a/.changeset/lucky-bears-think.md b/.changeset/lucky-bears-think.md new file mode 100644 index 000000000..923ef5496 --- /dev/null +++ b/.changeset/lucky-bears-think.md @@ -0,0 +1,6 @@ +--- +"@headstartwp/core": patch +"@headstartwp/next": patch +--- + +Fix an issue for images without width or height diff --git a/packages/core/src/react/blocks/ImageBlock.tsx b/packages/core/src/react/blocks/ImageBlock.tsx index 1e5e15c44..b21397720 100644 --- a/packages/core/src/react/blocks/ImageBlock.tsx +++ b/packages/core/src/react/blocks/ImageBlock.tsx @@ -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 ( {children} diff --git a/packages/next/src/components/ImageComponent.tsx b/packages/next/src/components/ImageComponent.tsx index 254eb1b68..5b0daaa81 100644 --- a/packages/next/src/components/ImageComponent.tsx +++ b/packages/next/src/components/ImageComponent.tsx @@ -102,7 +102,7 @@ export function ImageComponent({ src, alt, width, height, children, style, loade } if (!width || !height) { - {alt; + return {alt; } return (