LivePreview: Process jsconfigvars
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Sun, 10 May 2015 14:30:14 +0000 (16:30 +0200)
committerYurik <yurik@wikimedia.org>
Sun, 10 May 2015 20:11:26 +0000 (20:11 +0000)
Any jsconfigvars added by the new previewed content needs to added to
the context, so that it can be used by the modules.

Bug: T92944
Change-Id: Ib990f00ebe974008cea4dccbaa212ec20c846674

resources/src/mediawiki.action/mediawiki.action.edit.preview.js

index f24703a..5074d94 100644 (file)
                        $.extend( postData, {
                                pst: '',
                                preview: '',
-                               prop: 'text|displaytitle|modules|categorieshtml|templates|langlinks|limitreporthtml',
+                               prop: 'text|displaytitle|modules|jsconfigvars|categorieshtml|templates|langlinks|limitreporthtml',
                                disableeditsection: true
                        } );
                        request = api.post( postData );
                        request.done( function ( response ) {
                                var li, newList, $displaytitle, $content, $parent, $list;
+                               if ( response.parse.jsconfigvars ) {
+                                       mw.config.set( response.parse.jsconfigvars );
+                               }
                                if ( response.parse.modules ) {
                                        mw.loader.load( response.parse.modules.concat(
                                                response.parse.modulescripts,