Also update 'jsconfigvars' when previewing

This fixes a warning in the API: 'Property "modules" was set but not
"jsconfigvars" or "encodedjsconfigvars". Configuration variables are
necessary for proper module usage.'

We were already updating them when saving.

Change-Id: I3e16e3fd4b43a438c27645cca90517b6b4be7db7
This commit is contained in:
Bartosz Dziewoński 2020-03-09 14:04:43 +01:00
parent 15e511f820
commit 9d2cb7bdd0

View file

@ -205,7 +205,7 @@ ReplyWidget.prototype.onInputChange = function () {
action: 'parse',
text: wikitext,
pst: true,
prop: [ 'text', 'modules' ],
prop: [ 'text', 'modules', 'jsconfigvars' ],
title: mw.config.get( 'wgPageName' )
} );
}
@ -215,6 +215,7 @@ ReplyWidget.prototype.onInputChange = function () {
widget.$preview.html( response ? response.parse.text : '' );
if ( response ) {
mw.config.set( response.parse.jsconfigvars );
mw.loader.load( response.parse.modulestyles );
mw.loader.load( response.parse.modules );
}