-
-
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
Impossible to manage the editable's classes #798
Comments
Unfortunately, I can't see a workaround for this. The engine overrides everything as soon as you did |
OK, one workaround would be to fork the editor package and add this class to the editor UI's template, so it's added together with the other classes (which are maintained). But that requires more work. |
You can always extend the existence template (even on the editor instance): editor.ui.view.editable.extendTemplate( {
attributes: {
class: 'foo'
}
} ); But it's a hack. The problem is that both engine and UI manage this element(actually no, see the last paragraph). And both change the whole attribute value when it changes. It means that when the To fix it, UI rendering should change only classes it knows about. Also, note that because of above there is no problem if you set a custom attribute on that element (even when you do so directly on DOM). But the way, I tested it, and it looks that root element is never changed by the model. A long time ago we introduced |
That's a good plan, actually. And quite easy to implement IMO. |
I stumbled on this issue when implementing #479. I experienced an engine vs. UI collision when implementing root–level placeholders; setting a |
#479 moves (dynamic) root attribute management from UI to the engine. It will make adding/removing classes much easier. All it requires is view.change( writer => writer.addClass( 'new-class', view.document.getRoot() ) ); |
Internal: Moved the `EditableUIView` and `InlineEditableUIView` attributes management to the engine (see ckeditor/ckeditor5#479). Closes ckeditor/ckeditor5#798. BREAKING CHANGE: The `EditableUIView#isReadOnly` property has been removed. Use the engine `EditableElement#isReadOnly` instead. BREAKING CHANGE: The second argument of `EditableUIView.constructor()` and `InlineEditableUIView.constructor()` became the instance of the editing view (previously an optional editable element reference).
Try this:
And this class will be immediately removed by the engine on next focus.
Try this:
And after you focus the editable, only this class will be left.
Which means that external app (or even a plugin) has no chance to manage the editable's classes. I even wonder how it worked so far with the initial classes and focus/blur management. I guess we already have some mechanism but it's inefficient.
cc @pjasiun @oleq @oskarwrobel
The text was updated successfully, but these errors were encountered: