Skip to content

EditPlugin breaks <pre> tags #3146

@Durss

Description

@Durss

Describe the bug
When EditPlugin is enabled, <pre> tags get broken after pressing Enter key within them

To Reproduce
Steps to reproduce the behavior:

  1. Go to this sandbox
  2. Set carret in the text starting with But pressing Enter anywhere....
  3. Press enter
  4. All line breaks are removed

Problem is that rooster encapsulates <pre> content in a <div style="white-space: normal;"> which, AFAIK, is not valid HTML, and overrides the white-space CSS prop of the <pre> tag.
If it was generating a white-space: pre-line; instead, HTML would still not be valid but rendering would work.

If you disable the EditPlugin() the issue stops because it does not reformats anything.
Also, if you replace \r with <br> in the original content there's no issue but that's not valid HTML if I'm not mistaken.

Expected behavior
Rendering of <pre> content should not be broken when editing its content.

Additional context
Tested with rooster 9.29.3, 9.30.0, 9.34.0 and 9.35.0, the issue exists on all of these version so it might have existed for a long time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions