diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js index 1407befe25..866ffcbf6a 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js @@ -38,11 +38,6 @@ ve.ui.MWCategoryItemWidget = function VeUiMWCategoryItemWidget( config ) { this.isHidden = config.hidden; this.isMissing = config.missing; - // Events - this.$button.on( { - mousedown: this.onMouseDown.bind( this ) - } ); - // Initialization this.setLabel( config.redirectTo || this.value ); if ( config.redirectTo ) { @@ -65,10 +60,6 @@ OO.mixinClass( ve.ui.MWCategoryItemWidget, OO.ui.mixin.DraggableElement ); /* Events */ -/** - * @event savePopupState - */ - /** * @event togglePopupMenu * @param {ve.ui.MWCategoryItemWidget} item Item to load into popup @@ -76,26 +67,12 @@ OO.mixinClass( ve.ui.MWCategoryItemWidget, OO.ui.mixin.DraggableElement ); /* Methods */ -/** - * Handle mouse down events. - * - * @method - * @param {jQuery.Event} e Mouse down event - * @fires savePopupState on mousedown. - */ -ve.ui.MWCategoryItemWidget.prototype.onMouseDown = function () { - this.emit( 'savePopupState' ); - - // Parent method - return ve.ui.MWCategoryItemWidget.super.prototype.onMouseDown.apply( this, arguments ); -}; - /** * Handle mouse click events. * * @method * @param {jQuery.Event} e Mouse click event - * @fires togglePopupMenu on mousedown. + * @fires togglePopupMenu on click. */ ve.ui.MWCategoryItemWidget.prototype.onClick = function () { this.emit( 'togglePopupMenu', this ); diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js index 1293ec586c..2cde3cebdf 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js @@ -164,6 +164,7 @@ ve.ui.MWCategoryPopupWidget.prototype.loadCategoryIntoPopup = function ( item ) ve.ui.MWCategoryPopupWidget.prototype.closePopup = function () { this.toggle( false ); this.popupOpen = false; + this.category = null; }; /** diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js index c6671d5cb5..05cb30c73f 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js @@ -37,8 +37,6 @@ ve.ui.MWCategoryWidget = function VeUiMWCategoryWidget( config ) { this.categoryRedirects = {}; // Title cache - will contain entries even if title is already normalized this.normalizedTitles = {}; - this.popupState = false; - this.savedPopupState = false; this.popup = new ve.ui.MWCategoryPopupWidget(); this.input = new ve.ui.MWCategoryInputWidget( this, { $overlay: config.$overlay } ); this.forceCapitalization = mw.config.get( 'wgCaseSensitiveNamespaces' ).indexOf( categoryNamespace ) === -1; @@ -48,8 +46,7 @@ ve.ui.MWCategoryWidget = function VeUiMWCategoryWidget( config ) { this.input.connect( this, { choose: 'onInputChoose' } ); this.popup.connect( this, { removeCategory: 'onRemoveCategory', - updateSortkey: 'onUpdateSortkey', - hide: 'onPopupHide' + updateSortkey: 'onUpdateSortkey' } ); this.connect( this, { drag: 'onDrag' @@ -209,20 +206,6 @@ ve.ui.MWCategoryWidget.prototype.clearItems = function () { this.categories = {}; }; -/** - * Sets popup state when popup is hidden - */ -ve.ui.MWCategoryWidget.prototype.onPopupHide = function () { - this.popupState = false; -}; - -/** - * Saves current popup state - */ -ve.ui.MWCategoryWidget.prototype.onSavePopupState = function () { - this.savedPopupState = this.popupState; -}; - /** * Toggles popup menu per category item * @@ -230,7 +213,7 @@ ve.ui.MWCategoryWidget.prototype.onSavePopupState = function () { */ ve.ui.MWCategoryWidget.prototype.onTogglePopupMenu = function ( item ) { // Close open popup. - if ( this.savedPopupState === false || item.value !== this.popup.category ) { + if ( item.value !== this.popup.category ) { this.popup.openPopup( item ); } else { // Handle toggle @@ -367,7 +350,6 @@ ve.ui.MWCategoryWidget.prototype.addItems = function ( items, index ) { categoryItem = new ve.ui.MWCategoryItemWidget( config ); categoryItem.connect( widget, { - savePopupState: 'onSavePopupState', togglePopupMenu: 'onTogglePopupMenu' } );