Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/91380
Change subject: Use update rather than show in focusable node re-render
......................................................................
Use update rather than show in focusable node re-render
Update checks if there's actually a context menu to show. We also need
to pass through the parameters for show.
This was causing the last-shown context menu to appears after resizing
an inline image (which has no context menu).
Change-Id: I8f46f71e2fba6896fe10054f0d2a679c6f23eb9c
---
M modules/ve/ce/ve.ce.FocusableNode.js
M modules/ve/ui/ve.ui.Context.js
2 files changed, 6 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/80/91380/1
diff --git a/modules/ve/ce/ve.ce.FocusableNode.js
b/modules/ve/ce/ve.ce.FocusableNode.js
index 3f04165..32008b7 100644
--- a/modules/ve/ce/ve.ce.FocusableNode.js
+++ b/modules/ve/ce/ve.ce.FocusableNode.js
@@ -125,7 +125,7 @@
if ( this.focused ) {
this.redrawHighlight();
// reposition menu
- this.surface.getSurface().getContext().show( true, true );
+ this.surface.getSurface().getContext().update( true, true );
}
};
diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index bf675e0..2d6223d 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -188,9 +188,11 @@
* Updates the context menu.
*
* @method
+ * @param {boolean} [transition=false] Use a smooth transition
+ * @param {boolean} [repositionOnly=false] The context is only being moved so
don't fade in
* @chainable
*/
-ve.ui.Context.prototype.update = function () {
+ve.ui.Context.prototype.update = function ( transition, repositionOnly ) {
var i, nodes, tools, tool,
fragment = this.surface.getModel().getFragment( null, false ),
selection = fragment.getRange(),
@@ -198,7 +200,7 @@
if ( inspector && selection.equals( this.selection ) ) {
// There's an inspector, and the selection hasn't changed,
update the position
- this.show();
+ this.show( transition, repositionOnly );
} else {
// No inspector is open, or the selection has changed, show a
menu of available inspectors
tools = ve.ui.toolFactory.getToolsForAnnotations(
fragment.getAnnotations() );
@@ -224,7 +226,7 @@
this.toolbar = new ve.ui.SurfaceToolbar( this.surface );
this.toolbar.setup( [ { 'include' : tools } ] );
this.$menu.append( this.toolbar.$ );
- this.show();
+ this.show( transition, repositionOnly );
this.toolbar.initialize();
} else if ( this.visible ) {
// Nothing to inspect
--
To view, visit https://gerrit.wikimedia.org/r/91380
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f46f71e2fba6896fe10054f0d2a679c6f23eb9c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits