diff --git a/includes/EditPage.php b/includes/EditPage.php index fe95ca6792d..c0ebc2ac1d4 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2662,12 +2662,18 @@ class EditPage implements IEditObject { } else { $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 ) ); $config = $this->context->getConfig(); - # Transmit the name of the message to JavaScript for live preview - # Keep Resources.php/mediawiki.action.edit.preview in sync with the possible keys + # Transmit the name of the message to JavaScript. This was added for live preview. + # Live preview doesn't use this anymore. The variable is still transmitted because + # other scripts uses this variable. $out->addJsConfigVars( [ 'wgEditMessage' => $msg, ] ); diff --git a/resources/Resources.php b/resources/Resources.php index 5866a0c658d..05a16da7a18 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1290,16 +1290,9 @@ return [ 'oojs-ui-core', ], 'messages' => [ - // Keep these message keys in sync with EditPage#setHeaders 'continue-editing', - 'creating', 'currentrev', 'diff-empty', - 'editconflict', - 'editing', - 'editingcomment', - 'editingsection', - 'pagetitle', 'otherlanguages', 'summary-preview', 'subject-preview', diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js index 0f59775607f..d26621a0a46 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js @@ -12,7 +12,7 @@ * @param {Object} response Response data */ 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' ); $wikiPreview = $( '#wikiPreview' ); @@ -48,30 +48,7 @@ $( '.mw-indicators' ).empty().append( newList ); if ( response.parse.displaytitle ) { - $displaytitle = $( $.parseHTML( 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() - ) - ); + $( '#firstHeadingTitle' ).html( response.parse.displaytitle ); } if ( response.parse.categorieshtml ) { $content = $( $.parseHTML( response.parse.categorieshtml ) );