Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/126905
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(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/05/126905/1
diff --git a/modules/ve/ui/ve.ui.DesktopContext.js
b/modules/ve/ui/ve.ui.DesktopContext.js
index 19b7522..59f8e14 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/126905
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1250402f266772c3db1317d880a603068e70ba4
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: wmf/1.23wmf22
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits