mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "Move config vars that are global in nature to the startup module"
This commit is contained in:
commit
dc57d8a3d2
|
@ -59,10 +59,20 @@ class VisualEditorHooks {
|
||||||
* Adds extra variables to the page config.
|
* Adds extra variables to the page config.
|
||||||
*/
|
*/
|
||||||
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
||||||
global $wgVisualEditorEnableSectionEditLinks, $wgVisualEditorParsoidProblemReportURL,
|
|
||||||
$wgVisualEditorParsoidURL, $wgVisualEditorEnableExperimentalCode;
|
|
||||||
$vars['wgVisualEditor'] = array(
|
$vars['wgVisualEditor'] = array(
|
||||||
'isPageWatched' => $out->getUser()->isWatched( $out->getTitle() ),
|
'isPageWatched' => $out->getUser()->isWatched( $out->getTitle() ),
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds extra variables to the global config
|
||||||
|
*/
|
||||||
|
public static function onResourceLoaderGetConfigVars( array &$vars ) {
|
||||||
|
global $wgVisualEditorEnableSectionEditLinks, $wgVisualEditorParsoidProblemReportURL,
|
||||||
|
$wgVisualEditorParsoidURL, $wgVisualEditorEnableExperimentalCode;
|
||||||
|
$vars['wgVisualEditorConfig'] = array(
|
||||||
'enableSectionEditLinks' => $wgVisualEditorEnableSectionEditLinks,
|
'enableSectionEditLinks' => $wgVisualEditorEnableSectionEditLinks,
|
||||||
'reportProblemURL' => $wgVisualEditorParsoidProblemReportURL !== null ?
|
'reportProblemURL' => $wgVisualEditorParsoidProblemReportURL !== null ?
|
||||||
$wgVisualEditorParsoidProblemReportURL :
|
$wgVisualEditorParsoidProblemReportURL :
|
||||||
|
|
|
@ -515,6 +515,7 @@ $wgHooks['BeforePageDisplay'][] = 'VisualEditorHooks::onBeforePageDisplay';
|
||||||
$wgHooks['GetPreferences'][] = 'VisualEditorHooks::onGetPreferences';
|
$wgHooks['GetPreferences'][] = 'VisualEditorHooks::onGetPreferences';
|
||||||
$wgHooks['ListDefinedTags'][] = 'VisualEditorHooks::onListDefinedTags';
|
$wgHooks['ListDefinedTags'][] = 'VisualEditorHooks::onListDefinedTags';
|
||||||
$wgHooks['MakeGlobalVariablesScript'][] = 'VisualEditorHooks::onMakeGlobalVariablesScript';
|
$wgHooks['MakeGlobalVariablesScript'][] = 'VisualEditorHooks::onMakeGlobalVariablesScript';
|
||||||
|
$wgHooks['ResourceLoaderGetConfigVars'][] = 'VisualEditorHooks::onResourceLoaderGetConfigVars';
|
||||||
$wgHooks['ResourceLoaderTestModules'][] = 'VisualEditorHooks::onResourceLoaderTestModules';
|
$wgHooks['ResourceLoaderTestModules'][] = 'VisualEditorHooks::onResourceLoaderTestModules';
|
||||||
|
|
||||||
$wgAutoloadClasses['VisualEditorMessagesModule'] = $dir . 'VisualEditorMessagesModule.php';
|
$wgAutoloadClasses['VisualEditorMessagesModule'] = $dir . 'VisualEditorMessagesModule.php';
|
||||||
|
|
|
@ -123,7 +123,7 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setupSkinTabs();
|
this.setupSkinTabs();
|
||||||
if ( mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks ) {
|
if ( mw.config.get( 'wgVisualEditorConfig' ).enableSectionEditLinks ) {
|
||||||
this.setupSectionEditLinks();
|
this.setupSectionEditLinks();
|
||||||
}
|
}
|
||||||
if ( this.isViewPage ) {
|
if ( this.isViewPage ) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revision ) {
|
||||||
this.submitUrl = ( new mw.Uri( mw.util.wikiGetlink( this.pageName ) ) )
|
this.submitUrl = ( new mw.Uri( mw.util.wikiGetlink( this.pageName ) ) )
|
||||||
.extend( { 'action': 'submit' } );
|
.extend( { 'action': 'submit' } );
|
||||||
this.modules = [
|
this.modules = [
|
||||||
mw.config.get( 'wgVisualEditor' ).enableExperimentalCode ?
|
mw.config.get( 'wgVisualEditorConfig' ).enableExperimentalCode ?
|
||||||
'ext.visualEditor.experimental' : 'ext.visualEditor.core',
|
'ext.visualEditor.experimental' : 'ext.visualEditor.core',
|
||||||
'ext.visualEditor.specialMessages'
|
'ext.visualEditor.specialMessages'
|
||||||
]
|
]
|
||||||
|
@ -602,7 +602,7 @@ ve.init.mw.Target.prototype.reportProblem = function ( message ) {
|
||||||
'wiki': mw.config.get( 'wgDBname' )
|
'wiki': mw.config.get( 'wgDBname' )
|
||||||
};
|
};
|
||||||
$.post(
|
$.post(
|
||||||
mw.config.get( 'wgVisualEditor' ).reportProblemURL,
|
mw.config.get( 'wgVisualEditorConfig' ).reportProblemURL,
|
||||||
{ 'data': JSON.stringify( report ) },
|
{ 'data': JSON.stringify( report ) },
|
||||||
function () {
|
function () {
|
||||||
// This space intentionally left blank
|
// This space intentionally left blank
|
||||||
|
|
Loading…
Reference in a new issue