jenkins-bot has submitted this change and it was merged.

Change subject: Simplify and fix category popup widget checks
......................................................................


Simplify and fix category popup widget checks

Bug: T86357
Change-Id: I9a85267f6da0077e2167a92f25a8dc41074e6548
---
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
3 files changed, 4 insertions(+), 44 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js
index 1407bef..866ffcb 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 @@
        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 ) {
@@ -66,10 +61,6 @@
 /* Events */
 
 /**
- * @event savePopupState
- */
-
-/**
  * @event togglePopupMenu
  * @param {ve.ui.MWCategoryItemWidget} item Item to load into popup
  */
@@ -77,25 +68,11 @@
 /* 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 1293ec5..2cde3ce 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.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 c6671d5..05cb30c 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 @@
        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 @@
        this.input.connect( this, { choose: 'onInputChoose' } );
        this.popup.connect( this, {
                removeCategory: 'onRemoveCategory',
-               updateSortkey: 'onUpdateSortkey',
-               hide: 'onPopupHide'
+               updateSortkey: 'onUpdateSortkey'
        } );
        this.connect( this, {
                drag: 'onDrag'
@@ -210,27 +207,13 @@
 };
 
 /**
- * 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
  *
  * @param {Object} item
  */
 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 @@
 
                        categoryItem = new ve.ui.MWCategoryItemWidget( config );
                        categoryItem.connect( widget, {
-                               savePopupState: 'onSavePopupState',
                                togglePopupMenu: 'onTogglePopupMenu'
                        } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/310191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a85267f6da0077e2167a92f25a8dc41074e6548
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <a...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to