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

Change subject: Emit change event when dimensions change in MediaSizeWidget
......................................................................


Emit change event when dimensions change in MediaSizeWidget

Whether the dimensions are valid or not, the 'change' event should
be emitted when the dimension inputs are changed. This will cause
the dialog to revalidate the size widget in general and hide or
show the 'apply' button accordingly.

All changes for the widget value change the inputs themselves,
either by clearing them out or setting a different value. The
'hidden' changes (like those that set the max dimensions,
default dimensions, etc) are changes to the Scalable object
that emits its own changes.

Bug: 70861
Change-Id: Idb82d597d5b2b6664401208a54d33d26edbf6d31
---
M src/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 13 insertions(+), 3 deletions(-)

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



diff --git a/src/ui/widgets/ve.ui.MediaSizeWidget.js 
b/src/ui/widgets/ve.ui.MediaSizeWidget.js
index db1123e..92f2871 100644
--- a/src/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/src/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -191,8 +191,18 @@
 /**
  * Respond to width/height input value change. Only update dimensions if
  * the value is numeric. Invoke validation for every change.
+ *
+ * This is triggered every time the dimension widget has its values changed
+ * either by the user or externally. The external call to 
'setCurrentDimensions'
+ * will result in this event being evoked if the dimension inputs have changed,
+ * and same with clicking the 'full size' button and changing dimensions type.
+ * The 'change' event for the entire widget is emitted through this method, as
+ * it means that the actual values have changed, regardless of whether they
+ * are valid or not.
+ *
  * @param {string} type The input that was updated, 'width' or 'height'
  * @param {string} value The new value of the input
+ * @fires change
  */
 ve.ui.MediaSizeWidget.prototype.onDimensionsChange = function ( type, value ) {
        var dimensions = {};
@@ -208,6 +218,9 @@
                        this.validateDimensions();
                }
        }
+
+       // Emit change event
+       this.emit( 'change', this.currentDimensions );
 };
 
 /**
@@ -477,9 +490,6 @@
                this.scalable.setCurrentDimensions( this.currentDimensions );
 
                this.validateDimensions();
-
-               // Emit change event
-               this.emit( 'change', this.currentDimensions );
        }
        this.preventChangeRecursion = false;
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idb82d597d5b2b6664401208a54d33d26edbf6d31
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
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