Skip to content

[bug]: Empty text field converts to <br /> #56

@monolithed

Description

@monolithed

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.

// Handle empty paragraphs separately as they should render a <br> tag

[
    {
        "type": "paragraph",
        "children": [
            {
                "text": "",
                "bold": false
            }
        ]
    }
]

Expected Behaviour

No br added

There's a similar discussion https://forum.strapi.io/t/richtext-field-returns-br-tag-when-cleared/39507

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions