mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 00:55:00 +00:00
0f81aae133
Bug: T134814 Bug: T200834 Change-Id: I3ec84ad01db1ed896c41ac8ef38cce8eddb0b8c2
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWLazyMultilineTextInputWidget class.
|
|
*
|
|
* @copyright 2011-2018 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
|
|
*/
|
|
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 );
|