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

Change subject: Very small cleanup of onCut method in ve.ce.Surface.
......................................................................


Very small cleanup of onCut method in ve.ce.Surface.

Use ve.bind in order to change context within which
callback is called - reduces a need of introducing
new local variable.

Change-Id: I75ece695548c87073dd22e5e7ec80057d7132d22
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 8 insertions(+), 14 deletions(-)

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



diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 776b38e..7812ab6 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -371,28 +371,22 @@
  * @param {jQuery.Event} e
  */
 ve.ce.Surface.prototype.onCut = function ( e ) {
-       var surface = this;
-
        this.surfaceObserver.stop();
-
        this.onCopy( e );
-
-       setTimeout( function () {
-               var selection,
-                       tx;
+       setTimeout( ve.bind( function () {
+               var selection, tx;
 
                // We don't like how browsers cut, so let's undo it and do it 
ourselves.
                document.execCommand( 'undo', false, false );
-
-               selection = surface.model.getSelection();
+               selection = this.model.getSelection();
 
                // Transact
-               tx = ve.dm.Transaction.newFromRemoval( 
surface.documentView.model, selection );
-               surface.model.change( tx, new ve.Range( selection.start ) );
+               tx = ve.dm.Transaction.newFromRemoval( this.documentView.model, 
selection );
 
-               surface.surfaceObserver.clear();
-               surface.surfaceObserver.start();
-       }, 1 );
+               this.model.change( tx, new ve.Range( selection.start ) );
+               this.surfaceObserver.clear();
+               this.surfaceObserver.start();
+       }, this ), 1 );
 };
 
 /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I75ece695548c87073dd22e5e7ec80057d7132d22
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Inez <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to