Separate experimental features out into a new module

Currently some issues, probably with loading nodes
after factories.

Toggled by global $wgVisualEditorEnableExperimentalCode.

Change-Id: Idab3dd68572c037289c6742d03fd327285110f67
This commit is contained in:
Ed Sanders 2013-04-16 18:31:17 +01:00 committed by Catrope
parent ab06788309
commit fd23c9522f
3 changed files with 22 additions and 6 deletions

View file

@ -60,13 +60,14 @@ class VisualEditorHooks {
*/
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
global $wgVisualEditorEnableSectionEditLinks, $wgVisualEditorParsoidProblemReportURL,
$wgVisualEditorParsoidURL;
$wgVisualEditorParsoidURL, $wgVisualEditorEnableExperimentalCode;
$vars['wgVisualEditor'] = array(
'isPageWatched' => $out->getUser()->isWatched( $out->getTitle() ),
'enableSectionEditLinks' => $wgVisualEditorEnableSectionEditLinks,
'reportProblemURL' => $wgVisualEditorParsoidProblemReportURL !== null ?
$wgVisualEditorParsoidProblemReportURL :
"$wgVisualEditorParsoidURL/_bugs/",
'enableExperimentalCode' => $wgVisualEditorEnableExperimentalCode,
);
return true;
@ -122,6 +123,7 @@ class VisualEditorHooks {
),
'dependencies' => array(
'ext.visualEditor.core',
'ext.visualEditor.experimental',
'ext.visualEditor.viewPageTarget',
),
'localBasePath' => dirname( __FILE__ ) . '/modules/ve/test',

View file

@ -25,6 +25,8 @@ $wgVisualEditorParsoidProblemReportURL = null;
$wgVisualEditorNamespaces = array( NS_MAIN );
// Whether to use change tagging for VisualEditor edits
$wgVisualEditorUseChangeTagging = true;
// Whether to enable incomplete experimental code
$wgVisualEditorEnableExperimentalCode = false;
/* Setup */
@ -276,9 +278,7 @@ $wgResourceModules += array(
've/dm/nodes/ve.dm.MWEntityNode.js',
've/dm/nodes/ve.dm.MWHeadingNode.js',
've/dm/nodes/ve.dm.MWImageNode.js',
've/dm/nodes/ve.dm.MWPreformattedNode.js',
've/dm/nodes/ve.dm.MWTemplateNode.js',
've/dm/annotations/ve.dm.LinkAnnotation.js',
've/dm/annotations/ve.dm.MWExternalLinkAnnotation.js',
@ -327,9 +327,7 @@ $wgResourceModules += array(
've/ce/nodes/ve.ce.MWEntityNode.js',
've/ce/nodes/ve.ce.MWHeadingNode.js',
've/ce/nodes/ve.ce.MWImageNode.js',
've/ce/nodes/ve.ce.MWPreformattedNode.js',
've/ce/nodes/ve.ce.MWTemplateNode.js',
've/ce/annotations/ve.ce.LinkAnnotation.js',
've/ce/annotations/ve.ce.MWExternalLinkAnnotation.js',
@ -481,6 +479,18 @@ $wgResourceModules += array(
'visualeditor-dialog-action-close',
),
),
'ext.visualEditor.experimental' => $wgVisualEditorResourceTemplate + array(
'scripts' => array(
've/dm/nodes/ve.dm.MWImageNode.js',
've/dm/nodes/ve.dm.MWTemplateNode.js',
've/ce/nodes/ve.ce.MWImageNode.js',
've/ce/nodes/ve.ce.MWTemplateNode.js',
),
'dependencies' => array(
'ext.visualEditor.core',
)
),
'ext.visualEditor.icons-raster' => $wgVisualEditorResourceTemplate + array(
'styles' => array(
've/ui/styles/ve.ui.Icons-raster.css',

View file

@ -30,7 +30,11 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revision ) {
this.apiUrl = mw.util.wikiScript( 'api' );
this.submitUrl = ( new mw.Uri( mw.util.wikiGetlink( this.pageName ) ) )
.extend( { 'action': 'submit' } );
this.modules = ['ext.visualEditor.core', 'ext.visualEditor.specialMessages']
this.modules = [
mw.config.get( 'wgVisualEditor' ).enableExperimentalCode ?
'ext.visualEditor.experimental' : 'ext.visualEditor.core',
'ext.visualEditor.specialMessages'
]
.concat(
window.devicePixelRatio > 1 ?
['ext.visualEditor.viewPageTarget.icons-vector', 'ext.visualEditor.icons-vector'] :