mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-19 01:31:06 +00:00
aa556e3ef8
I tried to review all of them. Some of the changes I did: * Make sure the `config` parameter is not marked as optional when it is not. * Make sure default values are mentioned. * List individual `@cfg` options when it makes sense. Note I don't list all options a class could accept (e.g. via all its parent classes and mixins). That's too much. Instead I checked how a class is actually used and list only these options. Even then I don't list everything, e.g. unspecific options like "classes" that can be used pretty much everywhere. Change-Id: Idf4fbe1dc3608ace277df9e385f2f140df3a2f50
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWLazyMultilineTextInputWidget class.
|
|
*
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates a ve.ui.MWLazyMultilineTextInputWidget object.
|
|
*
|
|
* This widget is a hack to be used when you are building a UI
|
|
* that potentially contains lots of multi-line text input widgets,
|
|
* such as the template param editor.
|
|
*
|
|
* It defers the calculation of the auto height until the first focus,
|
|
* as doing this hundreds of times is slow.
|
|
*
|
|
* @class
|
|
* @extends OO.ui.MultilineTextInputWidget
|
|
*
|
|
* @constructor
|
|
* @param {Object} [config] Configuration options
|
|
* @cfg {boolean} [autosize=false]
|
|
*/
|
|
ve.ui.MWLazyMultilineTextInputWidget = function VeUiMWLazyMultilineTextInputWidget() {
|
|
var widget = this;
|
|
|
|
// Parent constructor
|
|
ve.ui.MWLazyMultilineTextInputWidget.super.apply( this, arguments );
|
|
|
|
// Check autosize is set, but if it isn't you probably shouldn't be using this widget!
|
|
if ( this.autosize ) {
|
|
this.autosize = false;
|
|
this.$input.one( 'focus', function () {
|
|
widget.autosize = true;
|
|
widget.adjustSize();
|
|
} );
|
|
}
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWLazyMultilineTextInputWidget, OO.ui.MultilineTextInputWidget );
|