Block indent and colour not rendering with CKeditor 5

Created on 14 August 2024, 3 months ago
Updated 2 September 2024, 2 months ago

Problem/Motivation

When using the colour plugin in ckeditor 5 it adds a style attribute that gets removed when the page is rendered.
I am using version 1.2.1 which included a change to use classes instead of a style attribute for the block indent plugin.
The class attribute is consistent on the CKeditor edit form, but the class is being removed when the page is rendered.

Steps to reproduce

1. Create a node that uses the ckeditor text format.
2. Ensure the "Limit allowed HTML tags and correct faulty HTML" option is selected
3. Click the color icon on the toolbar to apply a color.
4. Click the block indent to apply an indentation.
5. View the node and note if the color text and indentation have the class and style attribute still on the markup.

🐛 Bug report
Status

Postponed: needs info

Version

1.2

Component

Code

Created by

🇨🇦Canada sstapleton

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sstapleton
  • Status changed to Postponed: needs info 3 months ago
  • 🇵🇱Poland dolszewski

    Hi @sstapleton
    I have a few questions. Did you try unselecting and selecting "Limit allowed HTML tags and correct faulty HTML"? I noticed that if you have selected that filter in text format and a new plugin is added, the new allowed tags are not added.
    Also, can you confirm that in the editor in the source code classes are added to the block indention? If not, please reinstall CKEditor 5 Block Indentation plugin.

    Unfortunately, we can't do anything with font color at this moment. You can use the Highlight plugin to achieve the same result as in the color font plugin.

  • 🇨🇦Canada jayzee

    With regards to the indent issue, I tried the recommendations from @dolszewski and it worked.

    For the font colour, I enabled the highlight plugin but that did not work either. When I selected some text and changed the colour from black to red for example, the text displays as red in edit mode but as soon as you save the page, the text is highlighted...the text colour does not change.

    I even tried to create my own colours as opposed to using the out of the box options without success.

  • 🇵🇱Poland dolszewski

    @jayzee

    Highlight plugin uses classes to apply styles. You must add these styles to your theme to be displayed on the node page. They are listed in the config form.

    See docs:
    https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib...

Production build 0.71.5 2024