hygraph / rich-text

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

feat(html-to-slate-ast): add htmlToSlateASTSync function #115

Closed jpedroschmitz closed 11 months ago

jpedroschmitz commented 11 months ago

It adds htmlToSlateASTSync, which doesn't depend on jsdom and will work exclusively on the browser environment.

changeset-bot[bot] commented 11 months ago

⚠️ No Changeset found

Latest commit: ad143ae81bb1d35346f5cf4667bf6c2726f77e66

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

mahaveer0496 commented 11 months ago

How about adding a browser file that exports this instead – like react-dom/server is only for server – to make it more explicit? cuz reading htmlToSlateASTSync doesn't convey that it's browser exclusive.

jpedroschmitz commented 11 months ago

How about adding a browser file that exports this instead – like react-dom/server is only for server – to make it more explicit? cuz reading htmlToSlateASTSync doesn't convey that it's browser exclusive.

I tried to make it work like this, but no luck. When using exports it works, but then breaks TypeScript in the application unless I change the tsconfig moduleResolution to nodenext, which then breaks a bunch of other things 🫠

jpedroschmitz commented 11 months ago

I'll export everything from the root as there are no errors on the server for polyfilling jsdom functions now.

jpedroschmitz commented 11 months ago

Sounds great. I'll document this internally and create a ticket so we can move away from tsdx completely. @anmolarora1