mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-14 11:15:44 +00:00
d18262cfa1
Only doing 'setSelection' doesn't guarantee that the textbox will be scrolled (it works on Firefox and Edge, but not on Chrome and IE). Bug: T152760 Change-Id: I3fab6363cd432d137430884eaca3555a7bf5aafa
19 lines
599 B
JavaScript
19 lines
599 B
JavaScript
$( function () {
|
|
var location = mw.config.get( 'wgLinterErrorLocation' ),
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
$textbox = $( '#wpTextbox1' );
|
|
|
|
if ( location ) {
|
|
if ( $textbox.length ) {
|
|
$textbox.trigger( 'focus' ).textSelection( 'setSelection', { start: location[ 0 ], end: location[ 1 ] } );
|
|
$textbox.textSelection( 'scrollToCaretPosition' );
|
|
}
|
|
mw.hook( 've.tempWikitextReady' ).add( function () {
|
|
mw.libs.ve.tempWikitextEditor.$element[ 0 ].setSelectionRange(
|
|
location[ 0 ], location[ 1 ]
|
|
);
|
|
mw.libs.ve.tempWikitextEditor.focus();
|
|
} );
|
|
}
|
|
} );
|