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

Only standard tag element serializers supported #48

Closed
dcecile opened this issue Feb 6, 2020 · 6 comments
Closed

Only standard tag element serializers supported #48

dcecile opened this issue Feb 6, 2020 · 6 comments

Comments

@dcecile
Copy link

dcecile commented Feb 6, 2020

I tried to override elements={{[Elements.image]: CustomImage}}, but got a confusing error:

Error: img is a void element tag and must neither have children nor use dangerouslySetInnerHTML.

This is because for any custom elements, the library only provides children, which is invalid in the case of img.

Maybe in the places where createElement('...', ...) is used in richtext.js, try checking elements first?

@hypervillain
Copy link
Contributor

Hey @dcecile ,

it makes a lot of sense. The elements property is really new, I'm already happy you tried it out! Expect a fix in the coming days 👍In the meantime, you can use the htmlSerializer of course

@dcecile
Copy link
Author

dcecile commented Feb 25, 2020

Thanks, looking forward to it!

I was able to work around this initially using a CSS rule for img, but we'd also like to use Next.js Link components for hyperlinks within our site.

@dcecile
Copy link
Author

dcecile commented Feb 25, 2020

@hypervillain We'd also like to substitute button elements for links to a special content type (deep linking into a chat flow).

I don't see the new code yet, so can you update this issue once the feature is released? We'd start using it right away instead of doing a workaround that would involve HTML building or element replacing.

@hypervillain
Copy link
Contributor

hypervillain commented Mar 12, 2020

Hey, thanks for your patience, I just merged a PR that should better handle different element types. Thank you for reporting this @dcecile

@dcecile
Copy link
Author

dcecile commented Mar 12, 2020

@hypervillain OK thanks, we'll take a look! 👀

@hypervillain
Copy link
Contributor

hypervillain commented Mar 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants