[upstream] [GHS] colgroup and col elements are removed from markup when included in "Manually editable HTML tags"

Created on 29 October 2023, over 1 year ago
Updated 17 November 2023, over 1 year ago

I am assuming this will need to be either a bug or feature request upstream in CKEditor - but reporting here first to get feedback / ideas.

Problem/Motivation

When using CKeditor4 we had a filter format using "Limit allowed HTML tags and correct faulty HTML" which allowed colgroup and col elements to be used with class attributes. This was primarily used for sizing but also for other formatting needs, such as alignment. We rely on either source editing or CKEditor templates to provide the initial markup contain the colgroup / col elements with classes already applied.

In CKEditor5 the colgroup and col elements are removed from the markup when editing - even when added to "Manually editable HTML tags" or when using Full HTML format.

Steps to reproduce

  1. Standard install
  2. Add <col class> <colgroup class> <th scope> to "Manually editable HTML tags"
  3. Create a node, switch to source editing and add the following content:
<table>
  <caption>
    Superheros and sidekicks
  </caption>
  <colgroup>
    <col />
    <col span="2" class="batman" />
    <col span="2" class="flash" />
  </colgroup>
  <thead>
  <tr>
    <td> </td>
    <th scope="col">Batman</th>
    <th scope="col">Robin</th>
    <th scope="col">The Flash</th>
    <th scope="col">Kid Flash</th>
  </tr>
  </thead>
  <tbody>
  <tr>
    <th scope="row">Skill</th>
    <td>Smarts</td>
    <td>Dex, acrobat</td>
    <td>Super speed</td>
    <td>Super speed</td>
  </tr>
  </tbody>
</table>
  1. Switch out of source editing and save the node.

Proposed resolution

I believe this is similar to 🐛 [upstream] [GHS] CKEditor 5 does not retain custom HTML tags that are not defined by CKEditor 5 plugins whenever /.*/ is not allowed (e.g. when filter_html is enabled) Postponed except I do not consider colgroup and col elements to be custom elements.

Add table.TableColumnResize for formats with arbitrary HTML supported RTBC will add support for the TableColumnResize plugin which does define the colgroup and col elements. This is in my view a different use case as to allow the colgroup and col elements you also need allow all HTML / attributes and the table resizing UI.

In short - I believe col and colgroup elements should be supported without requiring the TableColumnResize plugin / allowing full HTML. The practicalities of that approach I am unsure of.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Postponed

Version

11.0 🔥

Component
CKEditor 5 

Last updated 2 days ago

Created by

🇳🇿New Zealand ericgsmith

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

Comments & Activities

Production build 0.71.5 2024