asHTML renders hyperlinks with undefined target
seanlail opened this issue · comments
Versions
- @prismicio/helpers: 2.3.3
- node: v16.13.1
Reproduction
Using asHTML
with the default serializer renders hyperlinks with undefined targets.
Steps to reproduce
- have a RichTextfield with a hyperlink somewhere. e.g.
- do not set the target
- in your code use the asHTML helper:
asHTML(myRTF)
What is expected?
Hyperlinks should render correctly:
<a href="mailto:test@test.com">test@test.com</a>
What is actually happening?
The string is undefined: https://github.com/prismicio/prismic-helpers/blob/master/src/lib/serializerHelpers.ts#L75
<a href="mailto:test@test.com" target="undefined" rel="noopener noreferrer">test@test.com</a>
The actual code here is different to the suggested example:
https://prismic.io/docs/technologies/html-serializer#see-all-html-serializer-elements
This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.
Hi there, thank you so much for the report!
Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:
- Information about your environment and packages you use (Node.js version, package names and their versions, etc.)
Feel free to attach a copy of yourpackage.json
file. - Any troubleshooting steps you already went through
- A minimal reproduction of the issue, and/or instructions on how to reproduce it
If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request addressing it. Check out our quick start guide for a simple contribution process.
If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io
- The Prismic Open-Source Team