Skip to content

RTE Containers/Code style doesn't work #17225

@wwrobel

Description

@wwrobel

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.5.1

Bug summary

When you select the Code "Container" from the dropdown in the RTE (see screenshot), the styling is initially applied but removed again when saving.

image

Specifics

The code should be surrounded by the <code></code> block, but it isn't.
The cause is that <code> element isn't added as valid HTML element in RTE configuration

Steps to reproduce

  1. Go to RTE property and type some text.
  2. Select the text and set the styling to Containers/Code as shown on the above screenshot.
  3. (Optional) Take a look on RTE html generated, there will be only the text surrounded by <p></p> instead of <p><code></code></p>.
  4. Save changes.
  5. Code text in RTE will be surrounded only by <p></p>, so code style won't be applied.

Expected result / actual result

Code text should be surrounded by <p><code></code></p>. To make it works we should add the code into valid elements here.

There is a simple workaround for that issue. You can add the <code> html element as valid through the RTE custom configuration by extending appsettings.json:

"Umbraco": {
  "CMS": {
    "RichTextEditor": {
      "CustomConfig": {
        "extended_valid_elements": "code"
      }
    }
  }
}

This item has been added to our backlog AB#47421

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions