On file pages, only replace the (local) image description when saving

Instead of overwriting everything else on the page (including the thumbnail!)

Bug: 65349
Change-Id: Ib6c4928646d6d278e29fbe31ae1902b0dc3b146a
This commit is contained in:
Krenair 2014-05-17 17:48:21 +01:00
parent 191fb5e1f1
commit eb7b727a53

View file

@ -1514,8 +1514,16 @@ ve.init.mw.ViewPageTarget.prototype.onWindowPopState = function ( e ) {
* @param {string} categoriesHtml Rendered categories HTML from server * @param {string} categoriesHtml Rendered categories HTML from server
*/ */
ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, categoriesHtml ) { ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, categoriesHtml ) {
var $content = $( $.parseHTML( html ) ); var $content = $( $.parseHTML( html ) ), $editableContent;
mw.hook( 'wikipage.content' ).fire( $( '#mw-content-text' ).empty().append( $content ) );
if ( $( '#mw-imagepage-content' ).length ) {
// On file pages, we only want to replace the (local) description.
$editableContent = $( '#mw-imagepage-content' );
} else {
$editableContent = $( '#mw-content-text' );
}
mw.hook( 'wikipage.content' ).fire( $editableContent.empty().append( $content ) );
$( '#catlinks' ).replaceWith( categoriesHtml ); $( '#catlinks' ).replaceWith( categoriesHtml );
}; };