-
-
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
Should first call of view.element render view.template? #5384
Comments
The very first idea was that When we first designed such approach, it looked right. TBH, today, I'm no so sure and it looks to me more like a premature optimization instead. It's confusing in cases like this one. Developers will struggle to understand the magic of What if we moved WDYT? (cc @Reinmar) |
There reason why we don't render the I completely agree that this is not the cleanest solution. Perhaps we could replace |
I know, but instead of saying: – Don't use we can simply say – We don't need to rename |
Depends on the semantics we want to have. What we do in |
ATM Particular classes inheriting from |
I don't think that we need anything besides |
I just fell for that one today. When adding view elements to I think we should consider dropping this auto-rendering in the |
I marked this as 1.0.0 candidate. |
Can lead to the removal of the class MyView extends View {
render() {
const el = super.render();
// Custom stuff.
return el;
// But what about `this.element`? Maybe returning makes no sense.
}
} |
Other: Implemented `View#render` method which replaces the `#element` rendering upon the first reference and incorporates the `#init` method functionality. Closes #262. Closes #302. From now on `View#setTemplate` and `View#extendTemplate` methods are recommended as a shorthand for `view.template = new Template( { ... } )` and `Template.extend( view.template )`. BREAKING CHANGE: The `init()` method in various UI components has been renamed to `render()`. Please refer to the documentation to learn more. BREAKING CHANGE: The `View#element` is no longer a getter which renders an element when first referenced. Use the `View#render()` method instead. BREAKING CHANGE: `Template#children` property became an `Array` (previously `ViewCollection`). BREAKING CHANGE: `View#addChildren` and `View#removeChildren` methods became `#registerChildren` and `#deregisterChildren`. BREAKING CHANGE: The DOM structure of the `StickyPanelView` has changed along with the class names. Please refer to the component documentation to learn more.
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
This might cause confusing situations.
Using
this.element
inside view constructor (eg to initializeFocusTracker
orKeystrokeHandler
) renders the template and makes it not possible to be extended.And I see a warning:
but my view is not even initialized.
To workaround this problem I can move
FT
init to the viewinit()
but it took me a while to figure out why I can't extend this template.The text was updated successfully, but these errors were encountered: