Merge "DesktopArticleTarget.init: Get $targetContainer after jQuery ready"

This commit is contained in:
jenkins-bot 2022-09-06 22:17:23 +00:00 committed by Gerrit Code Review
commit b00c52556b

View file

@ -39,10 +39,8 @@
plugins = [], plugins = [],
welcomeDialogDisabled = false, welcomeDialogDisabled = false,
educationPopupsDisabled = false, educationPopupsDisabled = false,
$targetContainer = $( // Defined after document-ready below
document.querySelector( '[data-mw-ve-target-container]' ) || $targetContainer = null;
document.getElementById( 'content' )
);
function showLoading( /* mode */ ) { function showLoading( /* mode */ ) {
if ( isLoading ) { if ( isLoading ) {
@ -778,9 +776,6 @@
var pageCanLoadEditor = isViewPage || isEditPage; var pageCanLoadEditor = isViewPage || isEditPage;
var pageIsProbablyEditable = mw.config.get( 'wgIsProbablyEditable' ) || var pageIsProbablyEditable = mw.config.get( 'wgIsProbablyEditable' ) ||
mw.config.get( 'wgRelevantPageIsProbablyEditable' ); mw.config.get( 'wgRelevantPageIsProbablyEditable' );
if ( pageCanLoadEditor ) {
$targetContainer.addClass( 've-init-mw-desktopArticleTarget-targetContainer' );
}
// Cast "0" (T89513) // Cast "0" (T89513)
var enable = !!+mw.user.options.get( 'visualeditor-enable' ); var enable = !!+mw.user.options.get( 'visualeditor-enable' );
@ -1508,6 +1503,14 @@
} }
$( function () { $( function () {
$targetContainer = $(
document.querySelector( '[data-mw-ve-target-container]' ) ||
document.getElementById( 'content' )
);
if ( pageCanLoadEditor ) {
$targetContainer.addClass( 've-init-mw-desktopArticleTarget-targetContainer' );
}
var showWikitextWelcome = true, var showWikitextWelcome = true,
section = parseSection( uri.query.section ); section = parseSection( uri.query.section );