contentful / field-editors

React components and extensions for building Contentful entry editor
https://contentful-field-editors.netlify.app/
MIT License
150 stars 118 forks source link

`@contentful/field-editor-rich-text` adds newlines after ordered / unordered lists #1561

Closed erictraaaan closed 9 months ago

erictraaaan commented 9 months ago

Hello, We are noticing an issue with the Rich Text editor when using ordered / unordered lists.

If there is no text after the last element of a list, the editor will append a new line after the list (see screenshots).

This can also be seen in the API response when querying for this Contentful entry, as a new paragraph node is added, with no content.

Because of this, the consumers of this content end up displaying the empty paragraph tag as a new line, resulting in undesirable output of the rich text.

Screenshot 2023-12-12 at 3 32 48 PM

image

z0al commented 9 months ago

Hey, thanks for reporting.

This is an intentional design decision to workaround a limitation in the internal framework. The team is aware of the issue and would like to explore possible solutions in the future, but I can't give an ETA as we have higher priority items. Btw, this also affect other block elements e.g. tables

In the meantime, you could remove the additional empty paragraph in your frontend when using one of the available transformers e.g. @contentful/rich-text-react-renderer

I hope that helps.