Remove Format for block elements
In the https://github.com/ckeditor/ckeditor5/issues/11580 issue, we added the Remove Format feature for inline styles.
We need to implement the same for block styles as well.
See the scope of the previous ticket and implementation PR for more information.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
FYI: this is a hard blocker for some Drupal users: https://www.drupal.org/project/drupal/issues/3321254.
To make it possible we need to augment the RemoveFormatCommand in 2 places:
Styles feature stores classes in GHS attributes so we can't use Schema attribute property to check it. Probably some extension point would be needed here:
https://github.com/ckeditor/ckeditor5/blob/67e060929bae2bacbc02bc8b82ceadaf1f96253f/packages/ckeditor5-remove-format/src/removeformatcommand.ts#L103-L111
While applying change it should be integrated with GHS to remove only classes registered in the Styles feature:
https://github.com/ckeditor/ckeditor5/blob/67e060929bae2bacbc02bc8b82ceadaf1f96253f/packages/ckeditor5-remove-format/src/removeformatcommand.ts#L54-L56
When we look into this, following the discussion of https://github.com/ckeditor/ckeditor5/issues/11580#issuecomment-1495012553.
The solution could be:
- Remove classes and styles added via GHS (including Styles plugin)
Potential problems:
- if someone enables all classes in GHS, but some of them don't relate to styling, they will be deleted anyway. We don't have the possibility to guess which is which. This could be later on followed up by some configuration option?
Strict format needs to be implemented ASAP
Leaving the comment from posterity from the PR, emphasis mine:
(...), the columnWidth model attribute of the table column resize feature is removed on the remove-format command execution. This triggers a post-fixer that adds it back with evenly spread column widths. The result is sometimes unexpected, as visually that table has 100% width (but without an explicitly set width attribute on the table) as a result of column widths and table-layout: fixed CSS. Currently, the remove-format feature does not support removing model elements, and the table column resize feature does not provide a means to switch from fixed table columns to default.