From eb7b727a531522203f42d1f754fca9d6416989ae Mon Sep 17 00:00:00 2001 From: Krenair Date: Sat, 17 May 2014 17:48:21 +0100 Subject: [PATCH] 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 --- .../ve-mw/init/targets/ve.init.mw.ViewPageTarget.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index 9b2f02e950..24955d4775 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -1514,8 +1514,16 @@ ve.init.mw.ViewPageTarget.prototype.onWindowPopState = function ( e ) { * @param {string} categoriesHtml Rendered categories HTML from server */ ve.init.mw.ViewPageTarget.prototype.replacePageContent = function ( html, categoriesHtml ) { - var $content = $( $.parseHTML( html ) ); - mw.hook( 'wikipage.content' ).fire( $( '#mw-content-text' ).empty().append( $content ) ); + var $content = $( $.parseHTML( html ) ), $editableContent; + + 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 ); };