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

Change subject: Only hide popups on selection change
......................................................................


Only hide popups on selection change

Hiding on attribute change would prevent us having inspectors
which live-update their nodes.

Change-Id: If1250402f266772c3db1317d880a603068e70ba4
---
M modules/ve/ui/ve.ui.DesktopContext.js
1 file changed, 14 insertions(+), 3 deletions(-)

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



diff --git a/modules/ve/ui/ve.ui.DesktopContext.js 
b/modules/ve/ui/ve.ui.DesktopContext.js
index 94d3bf2..249f737 100644
--- a/modules/ve/ui/ve.ui.DesktopContext.js
+++ b/modules/ve/ui/ve.ui.DesktopContext.js
@@ -32,6 +32,7 @@
        this.selection = null;
        this.toolbar = null;
        this.afterModelChangeTimeout = null;
+       this.afterModelChangeRange = null;
        this.$menu = this.$( '<div>' );
        this.popup = new OO.ui.PopupWidget( {
                '$': this.$,
@@ -99,14 +100,20 @@
  * so that if there are three selection changes in the same tick, 
afterModelChange() only runs once.
  *
  * @method
+ * @param {ve.Range} range Range if triggered by selection change, null 
otherwise
  * @see #afterModelChange
  */
-ve.ui.DesktopContext.prototype.onModelChange = function () {
+ve.ui.DesktopContext.prototype.onModelChange = function ( range ) {
        if ( this.showing || this.hiding || this.inspectorOpening || 
this.inspectorClosing ) {
                clearTimeout( this.afterModelChangeTimeout );
+               this.afterModelChangeTimeout = null;
+               this.afterModelChangeRange = null;
        } else {
                if ( this.afterModelChangeTimeout === null ) {
                        this.afterModelChangeTimeout = setTimeout( ve.bind( 
this.afterModelChange, this ) );
+               }
+               if ( range instanceof ve.Range ) {
+                       this.afterModelChangeRange = range;
                }
        }
 };
@@ -118,15 +125,19 @@
  * content. If the popup is open, close it, even while selecting or relocating.
  */
 ve.ui.DesktopContext.prototype.afterModelChange = function () {
+       var selectionChange = !!this.afterModelChangeRange;
        this.afterModelChangeTimeout = null;
-       if ( this.popup.isVisible() ) {
+       this.afterModelChangeRange = null;
+
+       if ( this.popup.isVisible() && selectionChange ) {
                this.hide();
        }
+
        // Bypass while dragging
        if ( this.selecting || this.relocating ) {
                return;
        }
-       this.update();
+       this.update( false, !selectionChange );
 };
 
 /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If1250402f266772c3db1317d880a603068e70ba4
Gerrit-PatchSet: 7
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to