hygraph / rich-text

A set of companion packages for Hygraph's Rich Text Field
MIT License
93 stars 18 forks source link

fix: don't include width and height if set to 0 #87

Closed jpedroschmitz closed 2 years ago

jpedroschmitz commented 2 years ago

This fix is related to an issue that usually happens with SVG. When an SVG is saved, GraphCMS can't set its dimensions, so the width and height of the SVG file are set to 0. So when rendering it, the image will be hidden because the width/height is set to 0. This PR makes sure we only add the width and height attributes if they are bigger than 0. Since the SVG usually has a width and height defined in its document, it will be rendered using its size.

changeset-bot[bot] commented 2 years ago

🦋 Changeset detected

Latest commit: e0d3b2f39024fb13c6ee0fbb0425515779c74e6a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------------------- | ----- | | @graphcms/rich-text-react-renderer | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
packages/react-renderer/dist/rich-text-react-renderer.cjs.production.min.js 5.27 KB (+0.4% 🔺)
packages/react-renderer/dist/rich-text-react-renderer.esm.js 5.21 KB (+0.55% 🔺)
packages/html-renderer/dist/rich-text-html-renderer.cjs.production.min.js 2.71 KB (0%)
packages/html-renderer/dist/rich-text-html-renderer.esm.js 2.66 KB (0%)