Merge "(bug 39273) add diff support to LivePreview"
authorCatrope <roan.kattouw@gmail.com>
Thu, 30 Aug 2012 18:57:34 +0000 (18:57 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 30 Aug 2012 18:57:34 +0000 (18:57 +0000)
RELEASE-NOTES-1.20
skins/common/preview.js

index cdd2707..b192a11 100644 (file)
@@ -134,6 +134,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
 * SVG files will now show the actual width in the SVG's specified units
   in the metadata box.
 * Added ResourceLoader module "jquery.jStorage".
+* (bug 39273) Added AJAX support for "Show changes" (diff) in LivePreview.
 
 === Bug fixes in 1.20 ===
 * (bug 30245) Use the correct way to construct a log page title.
@@ -225,6 +226,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 27111) Cascading foreign file repos now fetch shared descriptions properly.
 * EXIF below sea level GPS altitude data is now shown correctly.
 * (bug 39284) jquery.tablesorter should not consider "."" or "?"" to be a currency.
+* (bug 39273) "Show changes" should not be incorrectly displayed in the Live Preview state.
 
 === API changes in 1.20 ===
 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
index a332a8e..823d467 100644 (file)
@@ -8,10 +8,10 @@
                $( mw ).trigger( 'LivePreviewPrepare' );
 
                var postData = $('#editform').formToArray();
-               postData.push( { 'name' : 'wpPreview', 'value' : '1' } );
+               postData.push( { 'name' : e.target.name, 'value' : '1' } );
 
                // Hide active diff, used templates, old preview if shown
-               var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats',
+               var copyElements = ['#wikiPreview', '#wikiDiff', '.templatesUsed', '.hiddencats',
                                                        '#catlinks', '#p-lang', '.mw-summary-preview'];
                var copySelector = copyElements.join(',');
 
                        $( '.editCheckboxes' ).before( $( '<div>' ).addClass( 'mw-summary-preview' ) );
                }
 
-               $( '#wpPreview' ).click( doLivePreview );
+               // construct space for diff if missing. also load diff styles.
+               if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
+                       $( '#wikiPreview' ).after( $( '<div>' ).attr( 'id', 'wikiDiff' ) );
+                       // diff styles are by default only loaded when needed
+                       // if there was no diff container, we can expect the styles not to be there either
+                       mw.loader.load( 'mediawiki.action.history.diff' );
+               }
+
+               $( '#wpPreview, #wpDiff' ).click( doLivePreview );
        } );
 }) ( jQuery );