Set the new global JavaScript variable 'wgEditMessage' with the name of the message.
Document this global JavaScript variable in
https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#mw.config
after merge.
Bug: T88117
Change-Id: Ida5c1d470908cefd16925bd5455758d25db02113
$displayTitle = $contextTitle->getPrefixedText();
}
$wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) );
+ # Transmit the name of the message to JavaScript for live preview
+ # Keep Resources.php/mediawiki.action.edit.preview in sync with the possible keys
+ $wgOut->addJsConfigVars( 'wgEditMessage', $msg );
}
/**
'mediawiki.jqueryMsg',
),
'messages' => array(
+ // Keep the uses message keys in sync with EditPage#setHeaders
+ 'creating',
+ 'editconflict',
+ 'editing',
+ 'editingcomment',
+ 'editingsection',
+ 'pagetitle',
'otherlanguages',
'tooltip-p-lang',
'summary-preview',
}
if ( response.parse.displaytitle ) {
$( '#firstHeading' ).html( response.parse.displaytitle );
+ document.title = mw.msg(
+ 'pagetitle',
+ mw.msg(
+ mw.config.get( 'wgEditMessage', 'editing' ),
+ $( '#firstHeading' ).text()
+ )
+ );
}
if ( response.parse.categorieshtml ) {
$( '#catlinks' ).replaceWith( response.parse.categorieshtml['*'] );