Move the cursor to the end of newly inserted links

Inserted links happen when the cursor is not near a word, so we insert the target as text

Change-Id: I06c2c425d28db7ca61f13c438e25cc9c75f391f4
This commit is contained in:
Trevor Parscal 2012-12-11 11:09:26 -08:00
parent 3a2453b1b2
commit abdcacd68a

View file

@ -154,7 +154,9 @@ ve.ui.LinkInspector.prototype.onClose = function ( remove ) {
} }
if ( insert ) { if ( insert ) {
// Insert default text and select it // Insert default text and select it
fragment = fragment.insertContent( target, false ).adjustRange( -target.length ); fragment = fragment.insertContent( target, false );
// Move cursor to the end of the inserted content
selection = new ve.Range( this.initialSelection.start + target.length );
} }
if ( undo ) { if ( undo ) {
// Go back to before we added an annotation in an onInitialize handler // Go back to before we added an annotation in an onInitialize handler