Styles plugin not allowing any other plugin to alter the class attribute on the table element.

Created on 13 September 2024, 8 months ago
Updated 16 September 2024, 8 months ago

Problem/Motivation

The Styles plugin for ckeditor 5 is breaking any other plugin which is wanting to alter the class attribute on the table element when html filtering is enabled. (this may also be happening on other elements as well but my client ran into this problem on the table element first. I suspect it is any element which is in the $any-html5-element list of elements but have not tested)

Also if you have other plugins which add to the elements in the *.ckeditor5.yml <table class> this will get overridden by the styles plugin.

If the styles plugin has no table references (e.g table.custom-class|Custom class on table) then the filtered html will not get the table element added.

Also in our case if we have a plugin which adds &lt;table class&gt; so this gets added to the filter html. Then the problem occurs which you can add the classes to a table element, but when you come to edit the content after saving the classes (and the class attribute) is removed from the content.

Steps to reproduce

Add the Styles pulldown and then source button to the ckeditor toolbar.
Add to the styles config h1.fancy.title|Fancy title
In the "Source editing" tab try to add <table class>

clicking off the "Manually editable HTML tags" field when then result in the following error.

"The following attribute(s) can optionally be supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: Style (<table class>)."

Also if I add <table class> to a plugin such as the ckeditor5_paragraph so that when you edit and save the text filter it will add this to the filter html list. If you then create content with a different text format and add a class to a table element, and then change to the text format with the html filter, ckeditor will remove the classes even though they are valid.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
CKEditor 5 

Last updated about 23 hours ago

Created by

🇦🇺Australia gordon Melbourne

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024