r104903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104902‎ | r104903 | r104904 >
Date:21:44, 1 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Using unique event for cursor state changes - this also fixes the infinite loop that occurred when selections were made
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js
@@ -43,7 +43,7 @@
4444 this.surfaceView.model.on( 'select', function() {
4545 _this.updateState();
4646 } );
47 - this.surfaceView.on( 'update', function() {
 47+ this.surfaceView.on( 'cursor', function() {
4848 _this.updateState();
4949 } );
5050
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -147,7 +147,7 @@
148148
149149 es.SurfaceView.prototype.addInsertionAnnotation = function( annotation ) {
150150 this.insertionAnnotations.push( annotation );
151 - this.emitUpdate();
 151+ this.emit( 'cursor' );
152152 };
153153
154154 es.SurfaceView.prototype.loadInsertionAnnotations = function( annotation ) {
@@ -160,6 +160,7 @@
161161 i--;
162162 }
163163 }
 164+ this.emit( 'cursor' );
164165 };
165166
166167 es.SurfaceView.prototype.removeInsertionAnnotation = function( annotation ) {
@@ -167,12 +168,12 @@
168169 if ( index !== -1 ) {
169170 this.insertionAnnotations.splice( index, 1 );
170171 }
171 - this.emitUpdate();
 172+ this.emit( 'cursor' );
172173 };
173174
174175 es.SurfaceView.prototype.clearInsertionAnnotations = function() {
175176 this.insertionAnnotations = [];
176 - this.emitUpdate();
 177+ this.emit( 'cursor' );
177178 };
178179
179180 es.SurfaceView.prototype.getModel = function() {

Status & tagging log