Merge "EditPage: Only update title part of firstHeading on live preview"
This commit is contained in:
commit
a8609a0a6c
3 changed files with 10 additions and 34 deletions
|
|
@ -2662,12 +2662,18 @@ class EditPage implements IEditObject {
|
||||||
} else {
|
} else {
|
||||||
$out->setDisplayTitle( $displayTitle );
|
$out->setDisplayTitle( $displayTitle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enclose the title with an element. This is used on live preview to update the
|
||||||
|
// preview of the display title.
|
||||||
|
$displayTitle = Html::rawElement( 'span', [ 'id' => 'firstHeadingTitle' ], $displayTitle );
|
||||||
|
|
||||||
$out->setPageTitle( $this->context->msg( $msg, $displayTitle ) );
|
$out->setPageTitle( $this->context->msg( $msg, $displayTitle ) );
|
||||||
|
|
||||||
$config = $this->context->getConfig();
|
$config = $this->context->getConfig();
|
||||||
|
|
||||||
# Transmit the name of the message to JavaScript for live preview
|
# Transmit the name of the message to JavaScript. This was added for live preview.
|
||||||
# Keep Resources.php/mediawiki.action.edit.preview in sync with the possible keys
|
# Live preview doesn't use this anymore. The variable is still transmitted because
|
||||||
|
# other scripts uses this variable.
|
||||||
$out->addJsConfigVars( [
|
$out->addJsConfigVars( [
|
||||||
'wgEditMessage' => $msg,
|
'wgEditMessage' => $msg,
|
||||||
] );
|
] );
|
||||||
|
|
|
||||||
|
|
@ -1290,16 +1290,9 @@ return [
|
||||||
'oojs-ui-core',
|
'oojs-ui-core',
|
||||||
],
|
],
|
||||||
'messages' => [
|
'messages' => [
|
||||||
// Keep these message keys in sync with EditPage#setHeaders
|
|
||||||
'continue-editing',
|
'continue-editing',
|
||||||
'creating',
|
|
||||||
'currentrev',
|
'currentrev',
|
||||||
'diff-empty',
|
'diff-empty',
|
||||||
'editconflict',
|
|
||||||
'editing',
|
|
||||||
'editingcomment',
|
|
||||||
'editingsection',
|
|
||||||
'pagetitle',
|
|
||||||
'otherlanguages',
|
'otherlanguages',
|
||||||
'summary-preview',
|
'summary-preview',
|
||||||
'subject-preview',
|
'subject-preview',
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
* @param {Object} response Response data
|
* @param {Object} response Response data
|
||||||
*/
|
*/
|
||||||
function parsePreviewRequest( response ) {
|
function parsePreviewRequest( response ) {
|
||||||
var indicators, newList, $displaytitle, $content, $parent, $list, arrow, $previewHeader, $wikiPreview, $editform;
|
var indicators, newList, $content, $parent, $list, arrow, $previewHeader, $wikiPreview, $editform;
|
||||||
|
|
||||||
$editform = $( '#editform' );
|
$editform = $( '#editform' );
|
||||||
$wikiPreview = $( '#wikiPreview' );
|
$wikiPreview = $( '#wikiPreview' );
|
||||||
|
|
@ -48,30 +48,7 @@
|
||||||
$( '.mw-indicators' ).empty().append( newList );
|
$( '.mw-indicators' ).empty().append( newList );
|
||||||
|
|
||||||
if ( response.parse.displaytitle ) {
|
if ( response.parse.displaytitle ) {
|
||||||
$displaytitle = $( $.parseHTML( response.parse.displaytitle ) );
|
$( '#firstHeadingTitle' ).html( response.parse.displaytitle );
|
||||||
// The following messages can be used here:
|
|
||||||
// * editconflict
|
|
||||||
// * editingcomment
|
|
||||||
// * editingsection
|
|
||||||
// * editing
|
|
||||||
// * creating
|
|
||||||
$( '#firstHeading' ).msg(
|
|
||||||
mw.config.get( 'wgEditMessage', 'editing' ),
|
|
||||||
$displaytitle
|
|
||||||
);
|
|
||||||
document.title = mw.msg(
|
|
||||||
'pagetitle',
|
|
||||||
// The following messages can be used here:
|
|
||||||
// * editconflict
|
|
||||||
// * editingcomment
|
|
||||||
// * editingsection
|
|
||||||
// * editing
|
|
||||||
// * creating
|
|
||||||
mw.msg(
|
|
||||||
mw.config.get( 'wgEditMessage', 'editing' ),
|
|
||||||
$displaytitle.text()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if ( response.parse.categorieshtml ) {
|
if ( response.parse.categorieshtml ) {
|
||||||
$content = $( $.parseHTML( response.parse.categorieshtml ) );
|
$content = $( $.parseHTML( response.parse.categorieshtml ) );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue