We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@strapi/blocks-react-renderer
lst
When the field content is empty, Strapi returns an empty string; however, blocks-react-renderer converts it into a <br>, which breaks the layout.
<br>
I see that this was done intentionally, but I don't understand why.
blocks-react-renderer/src/Block.tsx
Line 68 in 032e256
[ { "type": "paragraph", "children": [ { "text": "", "bold": false } ] } ]
No br added
br
There's a similar discussion https://forum.strapi.io/t/richtext-field-returns-br-tag-when-cleared/39507
The text was updated successfully, but these errors were encountered:
Any updates?
Sorry, something went wrong.
Here's a workaround:
const trimBlocksRendererChild = (input: BlocksContent): BlocksContent => { return input.filter(({children}) => { return children.some((child) => { const {text} = child as TextInlineNode; return text?.trim() !== ''; }); }); };
+ const content = trimBlocksRendererChild(children); + <BlocksRenderer content={content} ...
No branches or pull requests
What version of
@strapi/blocks-react-renderer
are you using?lst
What's Wrong?
When the field content is empty, Strapi returns an empty string; however, blocks-react-renderer converts it into a
<br>
, which breaks the layout.To Reproduce
I see that this was done intentionally, but I don't understand why.
blocks-react-renderer/src/Block.tsx
Line 68 in 032e256
Expected Behaviour
No
br
addedThere's a similar discussion https://forum.strapi.io/t/richtext-field-returns-br-tag-when-cleared/39507
The text was updated successfully, but these errors were encountered: