mediawiki-extensions-Linter/modules/ext.linter.edit.js
Ed Sanders 6e379107c3 Fix NWE integration to use new tempWikitextEditor
Bug: T185279
Depends-On: I3678996bcf644cc889dd168ac3ce48b5c3633ec1
Change-Id: I31a21e10b3fcd88fbce6881475f02a9d37df39c2
2018-01-22 10:28:36 -08:00

17 lines
530 B
JavaScript

( function ( mw, $ ) {
$( function () {
var location = mw.config.get( 'wgLinterErrorLocation' ),
$textbox = $( '#wpTextbox1' );
if ( location ) {
if ( $textbox.length ) {
$textbox.focus().textSelection( 'setSelection', { start: location[ 0 ], end: location[ 1 ] } );
}
mw.hook( 've.tempWikitextReady' ).add( function () {
mw.libs.ve.tempWikitextEditor.$element[ 0 ].setSelectionRange( location[ 0 ], location[ 1 ] );
mw.libs.ve.tempWikitextEditor.focus();
} );
}
} );
}( mediaWiki, jQuery ) );