Merge "Update displaytitle on save"

This commit is contained in:
jenkins-bot 2014-06-18 02:23:28 +00:00 committed by Gerrit Code Review
commit dc81adeb36
3 changed files with 13 additions and 5 deletions

View file

@ -115,6 +115,9 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
$this->dieUsage( 'Error contacting the Parsoid server', 'parsoidserver' );
}
$result['isRedirect'] = $page->isRedirect();
$result['displayTitleHtml'] = $this->getOutput()->getWikiPage()->getParserOutput(
$this->getOutput()->parserOptions()
)->getDisplayTitle();
if ( isset( $saveresult['edit']['newrevid'] ) ) {
$result['newrevid'] = intval( $saveresult['edit']['newrevid'] );

View file

@ -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 );
@ -1549,8 +1551,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 ) {
@ -1570,6 +1574,7 @@ ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, catego
}
mw.hook( 'wikipage.content' ).fire( $editableContent.empty().append( $content ) );
$( '#content > #firstHeading > span ' ).html( displayTitle );
$( '#catlinks' ).replaceWith( categoriesHtml );
if ( isRedirect ) {
$( '#contentSub' ).text( ve.msg( 'redirectpagesub' ) );

View file

@ -543,7 +543,7 @@ 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 );
}
};