2018-11-12 15:00:16 +00:00
|
|
|
$( function () {
|
2019-06-11 15:21:16 +00:00
|
|
|
var location = mw.config.get( 'wgLinterErrorLocation' );
|
|
|
|
|
|
|
|
function highlightPosition( $textbox ) {
|
|
|
|
$textbox.trigger( 'focus' ).textSelection( 'setSelection', { start: location[ 0 ], end: location[ 1 ] } );
|
|
|
|
$textbox.textSelection( 'scrollToCaretPosition' );
|
|
|
|
}
|
2017-03-10 22:09:17 +00:00
|
|
|
|
2018-11-12 15:00:16 +00:00
|
|
|
if ( location ) {
|
2019-06-11 15:21:16 +00:00
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
|
|
highlightPosition( $( '#wpTextbox1' ) );
|
|
|
|
|
2019-06-11 15:09:43 +00:00
|
|
|
mw.hook( 've.wikitextInteractive' ).add( function () {
|
2019-06-11 15:21:16 +00:00
|
|
|
if ( mw.libs.ve.tempWikitextEditor ) {
|
|
|
|
highlightPosition( mw.libs.ve.tempWikitextEditor.$element );
|
|
|
|
} else {
|
|
|
|
// VE dummy textbox
|
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
|
|
highlightPosition( $( '#wpTextbox1' ) );
|
|
|
|
}
|
2018-11-12 15:00:16 +00:00
|
|
|
} );
|
|
|
|
}
|
|
|
|
} );
|