Inez has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60769


Change subject: Create and process transaction only if the value of given 
attribute (width or height) really changed
......................................................................

Create and process transaction only if the value of given attribute (width or 
height) really changed

Change-Id: I4177478171e1d417634adb06f3bf74af0c77c15e
---
M modules/ve/ce/ve.ce.ResizableNode.js
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/69/60769/1

diff --git a/modules/ve/ce/ve.ce.ResizableNode.js 
b/modules/ve/ce/ve.ce.ResizableNode.js
index b502ad8..e1a3391 100644
--- a/modules/ve/ce/ve.ce.ResizableNode.js
+++ b/modules/ve/ce/ve.ce.ResizableNode.js
@@ -215,9 +215,15 @@
        $( document ).off( '.ve-ce-resizableNode' );
        this.resizing = false;
 
-       txs.push( ve.dm.Transaction.newFromAttributeChange( documentModel, 
offset, 'width', width ) );
-       txs.push( ve.dm.Transaction.newFromAttributeChange( documentModel, 
offset, 'height', height ) );
-       surfaceModel.change( txs, selection );
+       if ( this.model.getAttribute( 'width' ) !== width ) {
+               txs.push( ve.dm.Transaction.newFromAttributeChange( 
documentModel, offset, 'width', width ) );
+       }
+       if ( this.model.getAttribute( 'height' ) !== height ) {
+               txs.push( ve.dm.Transaction.newFromAttributeChange( 
documentModel, offset, 'height', height ) );
+       }
+       if ( txs.length > 0 ) {
+               surfaceModel.change( txs, selection );
+       }
 
        // HACK: Update bounding box
        this.onResizableFocus();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4177478171e1d417634adb06f3bf74af0c77c15e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Inez <i...@wikia-inc.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to