hygraph / rich-text

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

Fixes #91 Rendering images as "image" instead of "link" #92

Closed ai-slave closed 1 year ago

ai-slave commented 2 years ago

Fixes weird behaviour of importing images as text links instead of images.

changeset-bot[bot] commented 2 years ago

⚠️ No Changeset found

Latest commit: c50f1694ab2d35eb658fdb00ca0ca49ad985669a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

belazer commented 2 years ago

Hey @ndrozd! Thanks for opening the PR, I just wanted to add some context also for the reviewers from our side.

We convert images from any HTML source to a link because the html-to-ast plugin can't upload images from other sources, and our image object in the AST typically is meant to be used with images that are uploaded into Hygraph. So we wanted to avoid writing assets from other places into the AST.

In your case, you would first need to go through the source HTML, find all images, upload them to Hygraph and replace the source URLs with the ones from us. Then you can use your method 👍

We will need to check on our end how can make this clearer and how to better communicate it within the package.

ai-slave commented 2 years ago

Thank you! That's exactly what's happening on my side before converting stuff to AST. All the image srcs are pointing to Hygraph.