Add remove formatting support for block elements styled using the GHS or style plugin
Suggested merge commit message (convention)
Feature (remove-format): It should now be possible to remove formatting from block elements styled using the GHS or Style plugin. Closes #13983
Fix (remove-format): It should now be possible to remove styles applied to links. Closes #15318
Additional information
Based on comment, https://github.com/ckeditor/ckeditor5/issues/13983#issuecomment-1808577846
Page Breakelements used together with GHS seems to be affected
What do you mean by affected? That with the remove format it's possible to remove their style/classes but they are inline elements?
@Witoso
It looks like it's block element and:
become:
Because page-break class and page-break-after:always; style that are stored in GHS attribute are removed
I wonder if #15318 as well with this solution?
@Witoso I'm not sure, it looks like different issue. @niegowski what do you think?
Yep, sorry, I didn't notice schema.isBlock( item ). It won't work on links, but I'm thinking if we should cover it. That way, the remove format would be fully complete.
CKEditor 4 is a good reference to check. It leaves the page break intact and doesn't remove its styles.
This PR/prototype that was created shows that ideally we have some logic that allows us to mark some elements as formatting.
Problems that we may want to solve with this mini-project
- allow users to remove styling attributes on blocks
- allow users to remove styling attributes on links (inline blocks)?
- give API for defining which attributes are styling.
Reference to CKEditor 4: https://github.com/ckeditor/ckeditor4/blob/3fd8eafd8d805024ca3280fd95899833bb16b163/plugins/removeformat/plugin.js#L143-L182
It turns out that there are many leftovers after consumption of model elements, and it needs to be fixed. It was causing the issue with page-break.
For example:
@niegowski Can you take a look? At this moment we remove every class and style assigned via GHS. Should we focus on making it configurable? /cc @Witoso
At this moment we remove every class and style assigned via GHS. Should we focus on making it configurable? /cc @Witoso
I think this would be an incremental value. We could create a follow-up ticket for this API.
@niegowski I fixed these issues, can you take a look?
This PR is replaced with #18603.