From 217640624a15343eb9db1bb7bc8fb367037389fa Mon Sep 17 00:00:00 2001 From: David Lynch Date: Wed, 1 Feb 2017 11:00:07 -0600 Subject: [PATCH] DesktopArticleTarget: Make the waiting module list extensible So that GlobalCssJs and other extensions can hook in. Bug: T156899 Change-Id: I045c7b045ce28047298b28a05e77ef27749c1ee1 --- VisualEditor.hooks.php | 1 + extension.json | 4 ++++ .../init/targets/ve.init.mw.DesktopArticleTarget.init.js | 5 ++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index a535d34c6b..653064e622 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -699,6 +699,7 @@ class VisualEditorHooks { $vars['wgVisualEditorConfig'] = [ 'disableForAnons' => $veConfig->get( 'VisualEditorDisableForAnons' ), + 'preloadModules' => $veConfig->get( 'VisualEditorPreloadModules' ), 'preferenceModules' => $veConfig->get( 'VisualEditorPreferenceModules' ), 'namespaces' => $availableNamespaces, 'contentModels' => $availableContentModels, diff --git a/extension.json b/extension.json index d00767f448..654b7a94a7 100644 --- a/extension.json +++ b/extension.json @@ -27,6 +27,10 @@ "VisualEditorPreferenceModules": { "visualeditor-enable-experimental": "ext.visualEditor.experimental" }, + "VisualEditorPreloadModules": [ + "site", + "user" + ], "VisualEditorRestbaseURL": false, "VisualEditorFullRestbaseURL": false, "VisualEditorFeedbackAPIURL": false, diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index 95fcf7496c..6effe581f9 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -127,10 +127,9 @@ targetPromise = mw.loader.using( 'ext.visualEditor.targetLoader' ) .then( function () { mw.libs.ve.targetLoader.addPlugin( function () { - // If the user and site modules fail, we still want to continue + // Run VisualEditorPreloadModules, but if they fail, we still want to continue // loading, so convert failure to success - - return mw.loader.using( [ 'user', 'site' ] ).then( + return mw.loader.using( conf.preloadModules ).then( null, function () { return $.Deferred().resolve();