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

Change subject: Fix resizable nodes
......................................................................


Fix resizable nodes

Making sure resize handle events are bound and unbound on focus, and that 
elements are created in the right window.

Change-Id: Ie90bb82aa6c81c372d76278dab3665bd49bf573c
---
M modules/ve/ce/ve.ce.ResizableNode.js
1 file changed, 25 insertions(+), 20 deletions(-)

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



diff --git a/modules/ve/ce/ve.ce.ResizableNode.js 
b/modules/ve/ce/ve.ce.ResizableNode.js
index 86d9575..d950249 100644
--- a/modules/ve/ce/ve.ce.ResizableNode.js
+++ b/modules/ve/ce/ve.ce.ResizableNode.js
@@ -19,7 +19,9 @@
        this.$resizable = $resizable || this.$;
        this.ratio = this.model.getAttribute( 'width' ) / 
this.model.getAttribute( 'height' );
        this.resizing = false;
-       this.$resizeHandles = $( '<div>' );
+       this.$resizeHandles = this.$$( '<div>' );
+       this.onResizeHandlesCornerMouseDownHandler =
+               ve.bind( this.onResizeHandlesCornerMouseDown, this );
 
        // Events
        this.connect( this, {
@@ -31,14 +33,10 @@
        // Initialization
        this.$resizeHandles
                .addClass( 've-ce-resizableNode-handles' )
-               .append( $( '<div>' ).addClass( 've-ce-resizableNode-nwHandle' 
) )
-               .append( $( '<div>' ).addClass( 've-ce-resizableNode-neHandle' 
) )
-               .append( $( '<div>' ).addClass( 've-ce-resizableNode-seHandle' 
) )
-               .append( $( '<div>' ).addClass( 've-ce-resizableNode-swHandle' 
) )
-               .children()
-                       .on( {
-                               'mousedown': ve.bind( 
this.onResizeHandlesCornerMouseDown, this )
-                       } );
+               .append( this.$$( '<div>' ).addClass( 
've-ce-resizableNode-nwHandle' ) )
+               .append( this.$$( '<div>' ).addClass( 
've-ce-resizableNode-neHandle' ) )
+               .append( this.$$( '<div>' ).addClass( 
've-ce-resizableNode-seHandle' ) )
+               .append( this.$$( '<div>' ).addClass( 
've-ce-resizableNode-swHandle' ) );
 };
 
 /* Methods */
@@ -61,16 +59,20 @@
                .appendTo( this.root.getSurface().getSurface().$localOverlay );
 
        this.$resizeHandles
-               .find('.ve-ce-resizableNode-neHandle').css( {
-                       'margin-right': -this.$resizable.width()
-               } ).end()
-               .find('.ve-ce-resizableNode-swHandle').css( {
-                       'margin-bottom': -this.$resizable.height()
-               } ).end()
-               .find('.ve-ce-resizableNode-seHandle').css( {
-                       'margin-right': -this.$resizable.width(),
-                       'margin-bottom': -this.$resizable.height()
-               } );
+               .find('.ve-ce-resizableNode-neHandle')
+                       .css( { 'margin-right': -this.$resizable.width() } )
+                       .end()
+               .find('.ve-ce-resizableNode-swHandle')
+                       .css( { 'margin-bottom': -this.$resizable.height() } )
+                       .end()
+               .find('.ve-ce-resizableNode-seHandle')
+                       .css( {
+                               'margin-right': -this.$resizable.width(),
+                               'margin-bottom': -this.$resizable.height()
+                       } )
+                       .end()
+               .children()
+                       .on( 'mousedown', 
this.onResizeHandlesCornerMouseDownHandler );
 };
 
 /**
@@ -79,7 +81,10 @@
  * @method
  */
 ve.ce.ResizableNode.prototype.onResizableBlur = function () {
-       this.$resizeHandles.detach();
+       this.$resizeHandles
+               .detach()
+               .children()
+                       .off( 'mousedown', 
this.onResizeHandlesCornerMouseDownHandler );
 };
 
 /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie90bb82aa6c81c372d76278dab3665bd49bf573c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[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