-
-
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
Consider implementing a v4-like remove format feature #908
Comments
Just to make it clear – links are not a formatting to be removed by such a feature. |
+1 for this feature. |
In my opinion it's an very important feature. |
Currently it's the last feature missing to make CKE5 integration into Neos CMS complete. Would try to hack some temporary solution myself, but a proper official solution is really welcome! Surprisingly editors really depend on this feature, perhaps they are not aware of CTRL+SHIFT+V... |
CTRL+SHIFT+V removes also elements such as links or lists so it's far from being ideal when pasting large portions of content. |
CTRL+SHIFT+V works only in Chrome right ? No even in Firefox |
Hey, no need to side-track this discussion, it's clear that this feature is demanded by editors in any case. |
We'd LOVE this feature as well! |
A note to future self: implementation PoC on Gitter. Issues so far:
|
I think we'll be using a whitelists (a list of attribute names which will not be removed by it). This way it doesn't have to learn anything – it will remove everything unless you configure not to. |
☝️ Kind of a dangerous approach TBH. Although the list would be probably shorter, the negative impact of a developer not remembering to whitelist their attribute is worse than the other way around. |
Sorry for not being clear – I meant text attributes could be removed this way. Most of them would be about formatting anyway. The only non-formatting one are links now (and maybe highlight, but I guess it's used for formatting most of the time ). This is trickier with block attributes. I haven't thought about this initially. So, perhaps we need a way to define "semantical" vs "formatting" attributes in the schema? |
Yes, of course, I assumed that you are talking about I was thinking about some parameter in |
I think we're on the same page here. I'm worried users will install 3rd–party addons introducing text attributes for something else and they will report us lots of bugs about "remove format feature destroying my content" if we go with the whitelist approach.
Yeah, but it's on the plugin authors' side (also: us), not developers who use them and the remove formatting feature. A better DX IMO. |
I wonder if an option to describe whether an attribute conveys formatting or styling would not also be helpful in cases like https://github.com/ckeditor/ckeditor5-enter/issues/40#issuecomment-313150077:
And later:
So, is it |
Meh - I get it: schema.registerAttribute( 'foo' , definition );
schema.register( 'baz', { allowAttributes: [ 'foo' ] } ); right? If so: 👍 |
Yes. I also find it a bit confusing, TBH. Especially that you won't need to register all attributes. You'd use |
I'd be more precise in this case and go with |
What if we'll have more types of attributes? Or simply – more properties of an attribute than whether it's styling/formatting. Then we'll have different API for elements and different for attributes but those APIs will be doing a pretty similar thing. Anyway, that's one thing. The other thing is that it still does not solve the problem that today attributes don't have to be registered. So it's more like ... "set attribute properties". |
👍 sounds good and look future-proof |
So schema.setAttributeProperties( 'linkHref', {
isFormatting: true
} ) ? |
Hey, I'd hate to sidetrack this discussion, but since this thread circles around whitelisting content, would the implementation allow for calling a sanitization of content before loading? |
Let's discuss XSS filtering in #1624 :) |
Schema API has been extracted to #1659. |
Feature: Introduced the Remove Format feature. Closes ckeditor/ckeditor5#908.
Is this a bug report or feature request? (choose one)
🆕 Feature request
📃 Other details that might be useful
This feature, similar to https://ckeditor.com/cke4/addon/removeformat could be useful when working with huge chunks of text containing unwanted formatting (mostly basic styles, links, etc.). A simple use case could be pasting a section of a Wikipedia article.
Some members of the community asked us about this feature a couple of times already.
(somehow) related issues:
cc @Reinmar @wwalc
The text was updated successfully, but these errors were encountered: