Creates an instance of the views and initializes the focus management.
The editor's locale.
ReadonlychildrenA collection of child views in the form.
ReadonlykeystrokesAn instance of the KeystrokeHandler.
The Save button view.
The URL input view.
Returns the input element.
Recursively renders the view.
Once the view is rendered:
true.Note: The children of the view:
In general, render() method is the right place to keep the code which refers to the
#element and should be executed at the very beginning of the view's life cycle.
It is possible to module:ui/template~Template.extend the #template before
the view is rendered. To allow an early customization of the view (e.g. by its parent),
such references should be done in render().
class SampleView extends View {
constructor() {
this.setTemplate( {
// ...
} );
},
render() {
// View#element becomes available.
super.render();
// The "scroll" listener depends on #element.
this.listenTo( window, 'scroll', () => {
// A reference to #element would render the #template and make it non-extendable.
if ( window.scrollY > 0 ) {
this.element.scrollLeft = 100;
} else {
this.element.scrollLeft = 0;
}
} );
}
}
const view = new SampleView();
// Let's customize the view before it gets rendered.
view.extendTemplate( {
attributes: {
class: [
'additional-class'
]
}
} );
// Late rendering allows customization of the view.
view.render();
Sets the value of the input element.
the new value
A view, displaying an input field and a save button next to it. This view is used to provide an input for words that should be saved as "blocked words".
This view is controlled via the blocklistCommand and addToBlocklistCommand.