mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Update displaytitle on save (try #2)
This reverts commit 5565ccca54
.
I have no idea what is going wrong on deployment-prep to cause
the error in bug 66792. Let's try to find out.
Bug: 50341
Change-Id: I5041de838128bb55c57baddae01cdcb263626537
This commit is contained in:
parent
5565ccca54
commit
b7401f838b
|
@ -116,6 +116,15 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
}
|
||||
$result['isRedirect'] = $page->isRedirect();
|
||||
|
||||
$parserOutput = $this->getOutput()->getWikiPage()->getParserOutput(
|
||||
$this->getOutput()->parserOptions()
|
||||
);
|
||||
if ( $parserOutput ) {
|
||||
$result['displayTitleHtml'] = $parserOutput->getDisplayTitle();
|
||||
} else {
|
||||
wfDebug( '[VE] ApiVisualEditorEdit - parserOutput was false' );
|
||||
}
|
||||
|
||||
if ( isset( $saveresult['edit']['newrevid'] ) ) {
|
||||
$result['newrevid'] = intval( $saveresult['edit']['newrevid'] );
|
||||
}
|
||||
|
|
|
@ -421,9 +421,11 @@ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () {
|
|||
* @method
|
||||
* @param {string} html Rendered page HTML from server
|
||||
* @param {string} categoriesHtml Rendered categories HTML from server
|
||||
* @param {number} [newid] New revision id, undefined if unchanged
|
||||
* @param {number} newid New revision id, undefined if unchanged
|
||||
* @param {boolean} isRedirect Whether this page is a redirect or not
|
||||
* @param {string} displayTitle What HTML to show as the page title
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.onSave = function ( html, categoriesHtml, newid, isRedirect ) {
|
||||
ve.init.mw.ViewPageTarget.prototype.onSave = function ( html, categoriesHtml, newid, isRedirect, displayTitle ) {
|
||||
var newUrlParams, watchChecked;
|
||||
if ( !this.pageExists || this.restoring ) {
|
||||
// This is a page creation or restoration, refresh the page
|
||||
|
@ -466,7 +468,7 @@ ve.init.mw.ViewPageTarget.prototype.onSave = function ( html, categoriesHtml, ne
|
|||
}
|
||||
this.saveDialog.close();
|
||||
this.saveDialog.reset();
|
||||
this.replacePageContent( html, categoriesHtml, isRedirect );
|
||||
this.replacePageContent( html, categoriesHtml, isRedirect, displayTitle );
|
||||
this.setupSectionEditLinks();
|
||||
this.tearDownBeforeUnloadHandler();
|
||||
this.deactivate( true );
|
||||
|
@ -1534,8 +1536,10 @@ ve.init.mw.ViewPageTarget.prototype.onWindowPopState = function ( e ) {
|
|||
* @method
|
||||
* @param {string} html Rendered HTML from server
|
||||
* @param {string} categoriesHtml Rendered categories HTML from server
|
||||
* @param {boolean} isRedirect Whether this page is a redirect or not
|
||||
* @param {string} displayTitle What HTML to show as the page title
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, categoriesHtml, isRedirect ) {
|
||||
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, categoriesHtml, isRedirect, displayTitle ) {
|
||||
var $content = $( $.parseHTML( html ) ), $editableContent;
|
||||
|
||||
if ( $( '#mw-imagepage-content' ).length ) {
|
||||
|
@ -1555,6 +1559,9 @@ ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, catego
|
|||
}
|
||||
|
||||
mw.hook( 'wikipage.content' ).fire( $editableContent.empty().append( $content ) );
|
||||
if ( displayTitle ) {
|
||||
$( '#content > #firstHeading > span' ).html( displayTitle );
|
||||
}
|
||||
$( '#catlinks' ).replaceWith( categoriesHtml );
|
||||
if ( isRedirect ) {
|
||||
$( '#contentSub' ).text( ve.msg( 'redirectpagesub' ) );
|
||||
|
|
|
@ -543,7 +543,14 @@ ve.init.mw.Target.onSave = function ( doc, saveData, response ) {
|
|||
} else if ( typeof data.content !== 'string' ) {
|
||||
this.onSaveError( doc, saveData, null, 'Invalid HTML content in response from server', response );
|
||||
} else {
|
||||
this.emit( 'save', data.content, data.categorieshtml, data.newrevid, data.isRedirect );
|
||||
this.emit(
|
||||
'save',
|
||||
data.content,
|
||||
data.categorieshtml,
|
||||
data.newrevid,
|
||||
data.isRedirect,
|
||||
data.displayTitleHtml || null
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue