Index: trunk/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | var method;
|
9 | 9 | if ( this.$.hasClass( 'es-toolbarButtonTool-down' ) ) {
|
10 | 10 | method = 'clear';
|
11 | | - this.toolbar.surfaceView.clearInsertionAnnotations( this.data );
|
| 11 | + this.toolbar.surfaceView.removeInsertionAnnotation( this.data );
|
12 | 12 | } else {
|
13 | 13 | method = 'set';
|
14 | 14 | this.toolbar.surfaceView.addInsertionAnnotation( this.data );
|
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | }; |
165 | 165 | |
166 | 166 | es.SurfaceView.prototype.removeInsertionAnnotation = function( annotation ) { |
167 | | - var index = es.DocumentView.getIndexOfAnnotation( this.insertionAnnotations, annotation ); |
| 167 | + var index = es.DocumentModel.getIndexOfAnnotation( this.insertionAnnotations, annotation ); |
168 | 168 | if ( index !== -1 ) { |
169 | 169 | this.insertionAnnotations.splice( index, 1 ); |
170 | 170 | } |
— | — | @@ -619,8 +619,12 @@ |
620 | 620 | selection.from = selection.to = |
621 | 621 | Math.min( selection.from, selection.to ); |
622 | 622 | } |
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 ); |
624 | 627 | this.model.transact( tx, true ); |
| 628 | + |
625 | 629 | selection.from += val.length; |
626 | 630 | selection.to += val.length; |
627 | 631 | this.model.select( selection, true ); |