mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
getIndexOfAnnotation is method of DocumentModel. not DocumentView
This commit is contained in:
parent
0f123a6d2f
commit
7bc84d8cf4
|
@ -7,7 +7,7 @@ es.AnnotationButtonTool.prototype.onClick = function() {
|
||||||
var method;
|
var method;
|
||||||
if ( this.$.hasClass( 'es-toolbarButtonTool-down' ) ) {
|
if ( this.$.hasClass( 'es-toolbarButtonTool-down' ) ) {
|
||||||
method = 'clear';
|
method = 'clear';
|
||||||
this.toolbar.surfaceView.clearInsertionAnnotations( this.data );
|
this.toolbar.surfaceView.removeInsertionAnnotation( this.data );
|
||||||
} else {
|
} else {
|
||||||
method = 'set';
|
method = 'set';
|
||||||
this.toolbar.surfaceView.addInsertionAnnotation( this.data );
|
this.toolbar.surfaceView.addInsertionAnnotation( this.data );
|
||||||
|
|
|
@ -163,7 +163,7 @@ es.SurfaceView.prototype.loadInsertionAnnotations = function( annotation ) {
|
||||||
};
|
};
|
||||||
|
|
||||||
es.SurfaceView.prototype.removeInsertionAnnotation = function( annotation ) {
|
es.SurfaceView.prototype.removeInsertionAnnotation = function( annotation ) {
|
||||||
var index = es.DocumentView.getIndexOfAnnotation( this.insertionAnnotations, annotation );
|
var index = es.DocumentModel.getIndexOfAnnotation( this.insertionAnnotations, annotation );
|
||||||
if ( index !== -1 ) {
|
if ( index !== -1 ) {
|
||||||
this.insertionAnnotations.splice( index, 1 );
|
this.insertionAnnotations.splice( index, 1 );
|
||||||
}
|
}
|
||||||
|
@ -619,8 +619,12 @@ es.SurfaceView.prototype.insertFromInput = function() {
|
||||||
selection.from = selection.to =
|
selection.from = selection.to =
|
||||||
Math.min( selection.from, selection.to );
|
Math.min( selection.from, selection.to );
|
||||||
}
|
}
|
||||||
tx = this.model.getDocument().prepareInsertion( selection.from, val.split('') );
|
var data = val.split('');
|
||||||
|
es.DocumentModel.addAnnotationsToData( data, this.getInsertionAnnotations() );
|
||||||
|
|
||||||
|
tx = this.model.getDocument().prepareInsertion( selection.from, data );
|
||||||
this.model.transact( tx, true );
|
this.model.transact( tx, true );
|
||||||
|
|
||||||
selection.from += val.length;
|
selection.from += val.length;
|
||||||
selection.to += val.length;
|
selection.to += val.length;
|
||||||
this.model.select( selection, true );
|
this.model.select( selection, true );
|
||||||
|
|
Loading…
Reference in a new issue