http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73262

Revision: 73262
Author:   tparscal
Date:     2010-09-17 23:58:41 +0000 (Fri, 17 Sep 2010)

Log Message:
-----------
Fixed bug that made preview not work with textarea. Also discontinued use of 
some globals.

Modified Paths:
--------------
    trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js

Modified: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js
===================================================================
--- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js    
2010-09-17 23:48:29 UTC (rev 73261)
+++ trunk/extensions/WikiEditor/modules/jquery.wikiEditor.preview.js    
2010-09-17 23:58:41 UTC (rev 73262)
@@ -43,7 +43,7 @@
                        'titleMsg': 'wikieditor-preview-tab',
                        'init': function( context ) {
                                // Gets the latest copy of the wikitext
-                               var wikitext = context.fn.getContents();
+                               var wikitext = context.$textarea.textSelection( 
'getContents' );
                                // Aborts when nothing has changed since the 
last preview
                                if ( context.modules.preview.previewText == 
wikitext ) {
                                        return;
@@ -51,10 +51,10 @@
                                context.modules.preview.$preview.find( 
'.wikiEditor-preview-contents' ).empty();
                                context.modules.preview.$preview.find( 
'.wikiEditor-preview-loading' ).show();
                                $.post(
-                                       wgScriptPath + '/api.php',
+                                       mediaWiki.config.get( 'wgScriptPath' ) 
+ '/api.php',
                                        {
                                                'action': 'parse',
-                                               'title': wgPageName,
+                                               'title': mediaWiki.config.get( 
'wgPageName' ),
                                                'text': wikitext,
                                                'prop': 'text',
                                                'pst': '',
@@ -84,7 +84,7 @@
                        'titleMsg': 'wikieditor-preview-changes-tab',
                        'init': function( context ) {
                                // Gets the latest copy of the wikitext
-                               var wikitext = context.fn.getContents();
+                               var wikitext = context.$textarea.textSelection( 
'getContents' );
                                // Aborts when nothing has changed since the 
last time
                                if ( context.modules.preview.changesText == 
wikitext ) {
                                        return;
@@ -100,13 +100,13 @@
                                        'format': 'json'
                                };
                                
-                               $.post( wgScriptPath + '/api.php', postdata, 
function( data ) {
+                               $.post( mediaWiki.config.get( 'wgScriptPath' ) 
+ '/api.php', postdata, function( data ) {
                                        try {
                                                var postdata2 = {
                                                        'action': 'query',
                                                        'indexpageids': '',
                                                        'prop': 'revisions',
-                                                       'titles': wgPageName,
+                                                       'titles': 
mediaWiki.config.get( 'wgPageName' ),
                                                        'rvdifftotext': 
data.parse.text['*'],
                                                        'rvprop': '',
                                                        'format': 'json'
@@ -115,7 +115,7 @@
                                                if ( section != '' )
                                                        postdata['rvsection'] = 
section;
                                                
-                                               $.post( wgScriptPath + 
'/api.php', postdata2, function( data ) {
+                                               $.post( mediaWiki.config.get( 
'wgScriptPath' ) + '/api.php', postdata2, function( data ) {
                                                                // Add diff CSS
                                                                if ( $( 
'link[href=' + stylepath + '/common/diff.css]' ).size() == 0 ) {
                                                                        $( 
'head' ).append( $( '<link />' ).attr( {



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to