mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Simplify partly redundant findFirstSelectedItem implementation
Introduced via Ibc56abf. But the OOUI SelectWidget does have some methods for this already. This patch also updates some @mixins documentation. Bug: T302965 Change-Id: Iffbb44d41586786a2165f8d7916f94a52ad19122
This commit is contained in:
parent
799c0b86ea
commit
d01d1e78c2
|
@ -4,6 +4,10 @@
|
||||||
*
|
*
|
||||||
* @class
|
* @class
|
||||||
* @extends OO.ui.OptionWidget
|
* @extends OO.ui.OptionWidget
|
||||||
|
* @mixins OO.ui.mixin.ButtonElement
|
||||||
|
* @mixins OO.ui.mixin.IconElement
|
||||||
|
* @mixins OO.ui.mixin.TabIndexedElement
|
||||||
|
* @mixins ve.ui.MWAriaDescribe
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
*
|
*
|
||||||
* @class
|
* @class
|
||||||
* @extends OO.ui.SelectWidget
|
* @extends OO.ui.SelectWidget
|
||||||
|
* @mixins OO.ui.mixin.TabIndexedElement
|
||||||
|
* @mixins ve.ui.MWAriaDescribe
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config
|
* @param {Object} config
|
||||||
|
@ -92,17 +94,8 @@ ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.addItems = function (
|
||||||
* @return {ve.ui.MWTransclusionOutlineParameterWidget|null}
|
* @return {ve.ui.MWTransclusionOutlineParameterWidget|null}
|
||||||
*/
|
*/
|
||||||
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.findFirstSelectedItem = function () {
|
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.findFirstSelectedItem = function () {
|
||||||
var firstSelected;
|
var selected = this.findSelectedItems();
|
||||||
|
return Array.isArray( selected ) ? selected[ 0 ] || null : selected;
|
||||||
this.items.some( function ( item ) {
|
|
||||||
if ( !firstSelected && item.isSelected() ) {
|
|
||||||
firstSelected = item;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} );
|
|
||||||
|
|
||||||
return firstSelected;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue