Merge "Remove listeners from deprecated search widget 'select' events"

This commit is contained in:
jenkins-bot 2015-07-13 15:17:22 +00:00 committed by Gerrit Code Review
commit c451470224
2 changed files with 12 additions and 42 deletions

View file

@ -175,19 +175,19 @@ ve.ui.MWReferenceDialog.prototype.onReferenceGroupInputChange = function () {
};
/**
* Handle search select events.
* Handle search results choose events.
*
* @param {ve.dm.MWReferenceModel|null} ref Reference model or null if no item is selected
* @param {ve.ui.MWReferenceResultWidget} item Chosen item
*/
ve.ui.MWReferenceDialog.prototype.onSearchSelect = function ( ref ) {
if ( ref instanceof ve.dm.MWReferenceModel ) {
if ( this.selectedNode instanceof ve.dm.MWReferenceNode ) {
this.getFragment().removeContent();
this.selectedNode = null;
}
this.useReference( ref );
this.executeAction( 'insert' );
ve.ui.MWReferenceDialog.prototype.onSearchResultsChoose = function ( item ) {
var ref = item.getData();
if ( this.selectedNode instanceof ve.dm.MWReferenceNode ) {
this.getFragment().removeContent();
this.selectedNode = null;
}
this.useReference( ref );
this.executeAction( 'insert' );
};
/**
@ -314,7 +314,7 @@ ve.ui.MWReferenceDialog.prototype.initialize = function () {
this.search = new ve.ui.MWReferenceSearchWidget();
// Events
this.search.connect( this, { select: 'onSearchSelect' } );
this.search.getResults().connect( this, { choose: 'onSearchResultsChoose' } );
// Initialization
this.panels.addItems( [ this.editPanel, this.searchPanel ] );

View file

@ -36,13 +36,6 @@ ve.ui.MWReferenceSearchWidget = function VeUiMWReferenceSearchWidget( config ) {
OO.inheritClass( ve.ui.MWReferenceSearchWidget, OO.ui.SearchWidget );
/* Events */
/**
* @event select
* @param {ve.dm.MWReferenceModel|null} data Reference model, null if no item is selected
*/
/* Methods */
/**
@ -59,29 +52,6 @@ ve.ui.MWReferenceSearchWidget.prototype.onQueryChange = function () {
this.addResults();
};
/**
* Handle select widget select events.
*
* @method
* @param {OO.ui.OptionWidget} item Selected item
* @fires select
*/
ve.ui.MWReferenceSearchWidget.prototype.onResultsSelect = function ( item ) {
var data;
if ( item ) {
data = item.getData();
// Resolve indexed values
if ( this.index[data] ) {
data = this.index[data].reference;
}
} else {
data = null;
}
this.emit( 'select', data );
};
/**
* Set the internal list and check if it contains any references
* @param {ve.dm.InternalList} internalList Internal list
@ -251,7 +221,7 @@ ve.ui.MWReferenceSearchWidget.prototype.addResults = function () {
.text( item.name );
items.push(
new ve.ui.MWReferenceResultWidget( {
data: i,
data: item.reference,
label: $citation.add( $name ).add( item.$element )
} )
);