-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove format does not remove styles applied by style dropdown plugin #11580
Comments
According to https://ckeditor.com/docs/ckeditor5/latest/features/remove-format.html, "The remove format feature allows you to quickly remove any text formatting applied using inline HTML elements and CSS styles, like basic text styles (bold, italic, etc.), font family, size, and color and similar." That excludes block level elements (though I don't understand why we wouldn't want to also be able to remove styles from block level elements, but that's another issue). In my testing (which you can view in a screencast at https://loom.com/share/5a0add14f4bf443fae07dbbd15e7db34), styles do not get removed from |
I added a screencast showing this issue; https://loom.com/share/5a0add14f4bf443fae07dbbd15e7db34 |
Also reported by @caspervoogt on |
Short workaround might help if use GHS plugin
|
Chiming in to add that, after pasting formatted text, clicking "remove formatting" does nothing - doesn't remove styles, links, any text decorations, etc. This is a regression from CK4, where "remove formatting" didn't work great but removed at least some formatting. |
After some investigation, we noticed a simple solution that would allow us to fix it quickly but it comes with some quirks. When we implement the change, Remove Format will remove all attributes set on the elements it has selected. Classes, id's, data-*, styles. So it will result in data loss which may not be related to the format. But it will not differ from the behavior of CKEditor 4 which does exactly the same, as tested here. Potential Scope: Set @Reinmar, thoughts? |
Testing this on CKE4 is tricky because there are many aspects that distort the results. First of all, as you mentioned, this needs to be tested with ACF off. The "Disabling ACF" sample in https://ckeditor.com/docs/ckeditor4/latest/examples/acf.html is ok. Second, different types of elements may be treated differently. Finally, selection handling isn't always... intuitive. Handling blocksLet's start with:
Press Ctrl+A and Remove format. Result:
The first block wasn't discovered by CKE4 as "fully selected" and hence it was skipped. In other blocks, as you can see, the data attribute was retained. And this, to me, makes a lot of sense, because this isn't a formatting attribute. Handling inline contentInput:
Output:
Some more inspirationSee https://github.com/ckeditor/ckeditor4/blob/master/plugins/removeformat/plugin.js#L166-L182 I don't think that CKE4's remove format worked perfectly, but it definitely needs to be a bit smarter than it seems. Remove format vs GHSTheoretically, when in doubt, Remove format may treat HTML content enabled via GHS as unwanted. However, this might lead to removing too much and breaking some content. So this is a tricky decision. I'd avoid going "all in" too quickly. I'd try with this:
And then let's see how it works in real life. |
Valid points, my proposal would be to push it quickly for inline elements first as a step forward in compatibility with CKE4, and then push the removal of the block styles to the later iterations as a topic that requires much more analysis and refinement. |
Scope v1:
|
…remove-inline-styles Fix (style): Remove Format feature should also remove styles. Closes #11580.
The remove format action for blocks will be tracked in #13983. Vote if it's something you're looking forward to. |
📝 Provide detailed reproduction steps (if any)
Remove format
button on various styled content✔️ Expected result
Remove format
button works at least on inline styles.❌ Actual result
Remove format
does nothing or is inactive.If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: