mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 13:56:44 +00:00
Merge "Remove $wgCodeMirrorRTL as redundant config setting"
This commit is contained in:
commit
a32d8005ea
|
@ -37,10 +37,6 @@
|
||||||
"value": null,
|
"value": null,
|
||||||
"description": "List of namespace IDs where line numbering should be enabled, or `null` to enable for all namespaces. Set to [] to disable everywhere.",
|
"description": "List of namespace IDs where line numbering should be enabled, or `null` to enable for all namespaces. Set to [] to disable everywhere.",
|
||||||
"public": true
|
"public": true
|
||||||
},
|
|
||||||
"CodeMirrorRTL": {
|
|
||||||
"value": true,
|
|
||||||
"description": "Temporary feature flag to control rollout of CodeMirror on RTL wikis."
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MessagesDirs": {
|
"MessagesDirs": {
|
||||||
|
|
|
@ -61,7 +61,6 @@ class DataScript {
|
||||||
'useV6' => $mwConfig->get( 'CodeMirrorV6' ),
|
'useV6' => $mwConfig->get( 'CodeMirrorV6' ),
|
||||||
'lineNumberingNamespaces' => $mwConfig->get( 'CodeMirrorLineNumberingNamespaces' ),
|
'lineNumberingNamespaces' => $mwConfig->get( 'CodeMirrorLineNumberingNamespaces' ),
|
||||||
'templateFoldingNamespaces' => $mwConfig->get( 'CodeMirrorTemplateFoldingNamespaces' ),
|
'templateFoldingNamespaces' => $mwConfig->get( 'CodeMirrorTemplateFoldingNamespaces' ),
|
||||||
'isSupportedRtlWiki' => $mwConfig->get( 'CodeMirrorRTL' ),
|
|
||||||
'pluginModules' => $registry->getAttribute( 'CodeMirrorPluginModules' ),
|
'pluginModules' => $registry->getAttribute( 'CodeMirrorPluginModules' ),
|
||||||
'tagModes' => $tagModes,
|
'tagModes' => $tagModes,
|
||||||
'tags' => array_fill_keys( $tagNames, true ),
|
'tags' => array_fill_keys( $tagNames, true ),
|
||||||
|
|
|
@ -28,7 +28,6 @@ class Hooks implements
|
||||||
private UserOptionsLookup $userOptionsLookup;
|
private UserOptionsLookup $userOptionsLookup;
|
||||||
private array $conflictingGadgets;
|
private array $conflictingGadgets;
|
||||||
private bool $useV6;
|
private bool $useV6;
|
||||||
private bool $isSupportedRtlWiki;
|
|
||||||
private ?GadgetRepo $gadgetRepo;
|
private ?GadgetRepo $gadgetRepo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +43,6 @@ class Hooks implements
|
||||||
$this->userOptionsLookup = $userOptionsLookup;
|
$this->userOptionsLookup = $userOptionsLookup;
|
||||||
$this->useV6 = $config->get( 'CodeMirrorV6' );
|
$this->useV6 = $config->get( 'CodeMirrorV6' );
|
||||||
$this->conflictingGadgets = $config->get( 'CodeMirrorConflictingGadgets' );
|
$this->conflictingGadgets = $config->get( 'CodeMirrorConflictingGadgets' );
|
||||||
$this->isSupportedRtlWiki = $config->get( 'CodeMirrorRTL' );
|
|
||||||
$this->gadgetRepo = $gadgetRepo;
|
$this->gadgetRepo = $gadgetRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +78,7 @@ class Hooks implements
|
||||||
// Disable CodeMirror if we're on an edit page with a conflicting gadget. See T178348.
|
// Disable CodeMirror if we're on an edit page with a conflicting gadget. See T178348.
|
||||||
return !$this->conflictingGadgetsEnabled( $extensionRegistry, $out->getUser() ) &&
|
return !$this->conflictingGadgetsEnabled( $extensionRegistry, $out->getUser() ) &&
|
||||||
// CodeMirror 5 on textarea wikitext editors doesn't support RTL (T170001)
|
// CodeMirror 5 on textarea wikitext editors doesn't support RTL (T170001)
|
||||||
( !$isRTL || ( $this->shouldUseV6( $out ) && $this->isSupportedRtlWiki ) ) &&
|
( !$isRTL || $this->shouldUseV6( $out ) ) &&
|
||||||
// Limit to supported content models that use wikitext.
|
// Limit to supported content models that use wikitext.
|
||||||
// See https://www.mediawiki.org/wiki/Content_handlers#Extension_content_handlers
|
// See https://www.mediawiki.org/wiki/Content_handlers#Extension_content_handlers
|
||||||
in_array( $out->getTitle()->getContentModel(), $contentModels );
|
in_array( $out->getTitle()->getContentModel(), $contentModels );
|
||||||
|
|
|
@ -245,8 +245,4 @@ ve.ui.CodeMirrorAction.prototype.onDocumentPrecommit = function ( tx ) {
|
||||||
|
|
||||||
/* Registration */
|
/* Registration */
|
||||||
|
|
||||||
// eslint-disable-next-line no-jquery/no-global-selector
|
ve.ui.actionFactory.register( ve.ui.CodeMirrorAction );
|
||||||
const isRTL = $( '.mw-body-content .mw-parser-output' ).attr( 'dir' ) === 'rtl';
|
|
||||||
if ( !isRTL || ( isRTL && mw.config.get( 'extCodeMirrorConfig' ).isSupportedRtlWiki ) ) {
|
|
||||||
ve.ui.actionFactory.register( ve.ui.CodeMirrorAction );
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ class DataScriptTest extends \MediaWikiIntegrationTestCase {
|
||||||
$this->assertStringContainsString( '"extCodeMirrorConfig":', $script );
|
$this->assertStringContainsString( '"extCodeMirrorConfig":', $script );
|
||||||
$this->assertStringContainsString( '"lineNumberingNamespaces":', $script );
|
$this->assertStringContainsString( '"lineNumberingNamespaces":', $script );
|
||||||
$this->assertStringContainsString( '"templateFoldingNamespaces":', $script );
|
$this->assertStringContainsString( '"templateFoldingNamespaces":', $script );
|
||||||
$this->assertStringContainsString( '"isSupportedRtlWiki":', $script );
|
|
||||||
$this->assertStringContainsString( '"pluginModules":', $script );
|
$this->assertStringContainsString( '"pluginModules":', $script );
|
||||||
$this->assertStringContainsString( '"tagModes":', $script );
|
$this->assertStringContainsString( '"tagModes":', $script );
|
||||||
$this->assertStringContainsString( '"tags":', $script );
|
$this->assertStringContainsString( '"tags":', $script );
|
||||||
|
|
Loading…
Reference in a new issue