r104821 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104820‎ | r104821 | r104822 >
Date:01:10, 1 December 2011
Author:inez
Status:deferred
Tags:
Comment:
getIndexOfAnnotation is method of DocumentModel. not DocumentView
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
@@ -7,7 +7,7 @@
88 var method;
99 if ( this.$.hasClass( 'es-toolbarButtonTool-down' ) ) {
1010 method = 'clear';
11 - this.toolbar.surfaceView.clearInsertionAnnotations( this.data );
 11+ this.toolbar.surfaceView.removeInsertionAnnotation( this.data );
1212 } else {
1313 method = 'set';
1414 this.toolbar.surfaceView.addInsertionAnnotation( this.data );
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -163,7 +163,7 @@
164164 };
165165
166166 es.SurfaceView.prototype.removeInsertionAnnotation = function( annotation ) {
167 - var index = es.DocumentView.getIndexOfAnnotation( this.insertionAnnotations, annotation );
 167+ var index = es.DocumentModel.getIndexOfAnnotation( this.insertionAnnotations, annotation );
168168 if ( index !== -1 ) {
169169 this.insertionAnnotations.splice( index, 1 );
170170 }
@@ -619,8 +619,12 @@
620620 selection.from = selection.to =
621621 Math.min( selection.from, selection.to );
622622 }
623 - tx = this.model.getDocument().prepareInsertion( selection.from, val.split('') );
 623+ var data = val.split('');
 624+ es.DocumentModel.addAnnotationsToData( data, this.getInsertionAnnotations() );
 625+
 626+ tx = this.model.getDocument().prepareInsertion( selection.from, data );
624627 this.model.transact( tx, true );
 628+
625629 selection.from += val.length;
626630 selection.to += val.length;
627631 this.model.select( selection, true );

Status & tagging log