mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 01:16:30 +00:00
Generalise the way extra modules are loaded
Change-Id: Icd453421b022a6450d1358edbe2132e49ca0b3bf
This commit is contained in:
parent
75bee13db5
commit
0901c0328a
|
@ -288,7 +288,7 @@ class VisualEditorHooks {
|
|||
'defaultUserOptions' => array(
|
||||
'betatempdisable' => $wgDefaultUserOptions['visualeditor-betatempdisable'],
|
||||
'enable' => $wgDefaultUserOptions['visualeditor-enable'],
|
||||
'experimental' => $wgDefaultUserOptions['visualeditor-enable-experimental'],
|
||||
'enable-experimental' => $wgDefaultUserOptions['visualeditor-enable-experimental'],
|
||||
),
|
||||
'skins' => $wgVisualEditorSupportedSkins,
|
||||
'tabPosition' => $wgVisualEditorTabPosition,
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
* revision id here. Defaults to loading the latest version (see #load).
|
||||
*/
|
||||
ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId ) {
|
||||
var conf = mw.config.get( 'wgVisualEditorConfig' );
|
||||
var i, len, prefName, prefValue, conf = mw.config.get( 'wgVisualEditorConfig' ),
|
||||
extraModules = [ 'experimental' ];
|
||||
|
||||
// Parent constructor
|
||||
ve.init.Target.call( this, $container );
|
||||
|
@ -34,11 +35,9 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
|
|||
this.apiUrl = mw.util.wikiScript( 'api' );
|
||||
this.submitUrl = ( new mw.Uri( mw.util.wikiGetlink( this.pageName ) ) )
|
||||
.extend( { 'action': 'submit' } );
|
||||
|
||||
this.modules = [
|
||||
( mw.config.get( 'wgUserName' ) === null ?
|
||||
conf.defaultUserOptions.experimental :
|
||||
mw.user.options.get( 'visualeditor-enable-experimental', conf.defaultUserOptions.experimental ) ) ?
|
||||
'ext.visualEditor.experimental' : 'ext.visualEditor.core',
|
||||
'ext.visualEditor.core',
|
||||
'ext.visualEditor.data'
|
||||
]
|
||||
.concat(
|
||||
|
@ -47,6 +46,16 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
|
|||
['ext.visualEditor.viewPageTarget.icons-raster', 'ext.visualEditor.icons-raster']
|
||||
)
|
||||
.concat( mw.config.get( 'wgVisualEditorConfig' ).pluginModules || [] );
|
||||
for ( i = 0, len = extraModules.length; i < len; i++ ) {
|
||||
prefName = 'visualeditor-enable-' + extraModules[i];
|
||||
prefValue = mw.config.get( 'wgUserName' ) === null ?
|
||||
conf.defaultUserOptions[prefName] :
|
||||
mw.user.options.get( prefName, conf.defaultUserOptions[prefName] );
|
||||
if ( prefValue && prefValue !== '0' ) {
|
||||
this.modules.push( 'ext.visualEditor.' + extraModules[i] );
|
||||
}
|
||||
}
|
||||
|
||||
this.pluginCallbacks = [];
|
||||
this.modulesReady = $.Deferred();
|
||||
this.loading = false;
|
||||
|
|
Loading…
Reference in a new issue