mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
ParameterWidget: Connect to Search results widget 'choose' events
Instead of using the removed 'select' event submission on SearchWidget. Rename event fired by MWParameterSearchWidget to reflect the new re- emissioned choose event. Follow up: I7fa97f208da0b3b185f1b09b87fef9c9afaee2f1 Bug: T106696 Change-Id: I1d954a7243649d7834373537d70bfadf68f52c9d
This commit is contained in:
parent
cb1cb6bdb5
commit
b390a32fda
|
@ -33,7 +33,7 @@ ve.ui.MWParameterPlaceholderPage = function VeUiMWParameterPlaceholderPage( para
|
|||
showAll: !!config.expandedParamList
|
||||
} )
|
||||
.connect( this, {
|
||||
select: 'onParameterSelect',
|
||||
choose: 'onParameterChoose',
|
||||
showAll: 'onParameterShowAll'
|
||||
} );
|
||||
|
||||
|
@ -91,7 +91,7 @@ ve.ui.MWParameterPlaceholderPage.prototype.setOutlineItem = function ( outlineIt
|
|||
}
|
||||
};
|
||||
|
||||
ve.ui.MWParameterPlaceholderPage.prototype.onParameterSelect = function ( name ) {
|
||||
ve.ui.MWParameterPlaceholderPage.prototype.onParameterChoose = function ( name ) {
|
||||
var param;
|
||||
|
||||
if ( name ) {
|
||||
|
|
|
@ -34,6 +34,7 @@ ve.ui.MWParameterSearchWidget = function VeUiMWParameterSearchWidget( template,
|
|||
|
||||
// Events
|
||||
this.template.connect( this, { add: 'buildIndex', remove: 'buildIndex' } );
|
||||
this.getResults().connect( this, { choose: 'onSearchResultsChoose' } );
|
||||
|
||||
// Initialization
|
||||
this.$element.addClass( 've-ui-mwParameterSearchWidget' );
|
||||
|
@ -47,7 +48,7 @@ OO.inheritClass( ve.ui.MWParameterSearchWidget, OO.ui.SearchWidget );
|
|||
/* Events */
|
||||
|
||||
/**
|
||||
* @event select
|
||||
* @event choose
|
||||
* @param {string|null} name Parameter name or null if no item is selected
|
||||
*/
|
||||
|
||||
|
@ -68,16 +69,16 @@ ve.ui.MWParameterSearchWidget.prototype.onQueryChange = function () {
|
|||
};
|
||||
|
||||
/**
|
||||
* Handle select widget select events.
|
||||
* Handle SelectWidget choose events.
|
||||
*
|
||||
* @method
|
||||
* @param {OO.ui.OptionWidget} item Selected item
|
||||
* @fires select
|
||||
* @fires choose
|
||||
* @fires showAll
|
||||
*/
|
||||
ve.ui.MWParameterSearchWidget.prototype.onResultsSelect = function ( item ) {
|
||||
ve.ui.MWParameterSearchWidget.prototype.onSearchResultsChoose = function ( item ) {
|
||||
if ( item instanceof ve.ui.MWParameterResultWidget ) {
|
||||
this.emit( 'select', item.getData().name );
|
||||
this.emit( 'choose', item.getData().name );
|
||||
} else if ( item instanceof ve.ui.MWMoreParametersResultWidget ) {
|
||||
this.showAll = true;
|
||||
this.addResults();
|
||||
|
|
Loading…
Reference in a new issue