mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-27 13:33:00 +00:00
004d92d341
Before the `height: 2.5em` was applied to _both_ the visible <textarea> and the $clone. While this shouldn't make a difference – one of the first things .adjustSize() does is setting the $clones height to 0 – it somehow triggered that Firefox bug. With this patch we remove the `height: 2.5em` before handing over to OOUI's .adjustSize(). It looks like this fixes the issue. We might be able to revert I7560ceb then. Bug: T317369 Change-Id: I96c2d7d7bf359ff0373d478b2b7e97c8833ba5b6
46 lines
1.4 KiB
JavaScript
46 lines
1.4 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.$input.addClass( 've-ui-mwLazyMultilineTextInputWidget-collapsed' );
|
|
this.autosize = false;
|
|
this.$input.one( 'focus', function () {
|
|
widget.$input.removeClass( 've-ui-mwLazyMultilineTextInputWidget-collapsed' );
|
|
widget.autosize = true;
|
|
widget.adjustSize();
|
|
} );
|
|
}
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWLazyMultilineTextInputWidget, OO.ui.MultilineTextInputWidget );
|