ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Add remove formatting support for block elements styled using the GHS or style plugin

Open Mati365 opened this issue 1 year ago • 9 comments

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

Mati365 avatar Aug 06 '24 06:08 Mati365

Page Break elements 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 avatar Aug 06 '24 07:08 Witoso

@Witoso

It looks like it's block element and:

obraz become: obraz

Because page-break class and page-break-after:always; style that are stored in GHS attribute are removed

Mati365 avatar Aug 06 '24 07:08 Mati365

I wonder if #15318 as well with this solution?

Witoso avatar Aug 06 '24 07:08 Witoso

@Witoso I'm not sure, it looks like different issue. @niegowski what do you think?

Mati365 avatar Aug 06 '24 08:08 Mati365

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.

Witoso avatar Aug 06 '24 08:08 Witoso

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

Witoso avatar Aug 06 '24 08:08 Witoso

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: obraz obraz

Mati365 avatar Aug 06 '24 09:08 Mati365

@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

Mati365 avatar Aug 06 '24 11:08 Mati365

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.

Witoso avatar Aug 06 '24 13:08 Witoso

@niegowski I fixed these issues, can you take a look?

Mati365 avatar Sep 11 '24 06:09 Mati365

This PR is replaced with #18603.

niegowski avatar Jun 05 '25 13:06 niegowski