mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-24 16:04:00 +00:00
f5df08a745
Change-Id: I64767fccae26522fdce5287c5486c322108c168a Depends-On: Idc960a37433c5b8d952a677d1529a25b94fac7f7 Depends-On: I1071faeec586fa2b44be810a35f8044800c8f800
27 lines
874 B
JavaScript
27 lines
874 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 ] } );
|
|
}
|
|
// Register NWE code should it be loaded
|
|
// TODO: We should somehow force source mode if VE is opened
|
|
mw.hook( 've.activationComplete' ).add( function () {
|
|
// Selection is reset on a setTimeout after activation, so wait for that.
|
|
setTimeout( function () {
|
|
var range,
|
|
surface = ve.init.target.getSurface();
|
|
|
|
if ( surface.getMode() === 'source' ) {
|
|
range = surface.getModel().getRangeFromSourceOffsets( location[ 0 ], location[ 1 ] );
|
|
surface.getModel().setLinearSelection( range );
|
|
}
|
|
} );
|
|
} );
|
|
}
|
|
} );
|
|
}( mediaWiki, jQuery ) );
|