mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 13:56:44 +00:00
Add $wgCodeMirrorRTL to control rollout to RTL wikis
We want to get moving on rolling out CodeMirror 6 to LTR wikis, but want to slow rollout to RTL wikis since we are still ironing out some issues there, specifically T358804. Bug: T170001 Bug: T358804 Change-Id: Iac30ffe2746139326159fd406fab3b097b3187f5
This commit is contained in:
parent
3339cbb3a5
commit
3dcbb6590d
|
@ -36,6 +36,10 @@
|
|||
"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.",
|
||||
"public": true
|
||||
},
|
||||
"CodeMirrorRTL": {
|
||||
"value": true,
|
||||
"description": "Temporary feature flag to control rollout of CodeMirror on RTL wikis."
|
||||
}
|
||||
},
|
||||
"MessagesDirs": {
|
||||
|
|
|
@ -28,6 +28,7 @@ class Hooks implements
|
|||
private UserOptionsLookup $userOptionsLookup;
|
||||
private array $conflictingGadgets;
|
||||
private bool $useV6;
|
||||
private bool $isSupportedRtlWiki;
|
||||
|
||||
/**
|
||||
* @param UserOptionsLookup $userOptionsLookup
|
||||
|
@ -40,6 +41,7 @@ class Hooks implements
|
|||
$this->userOptionsLookup = $userOptionsLookup;
|
||||
$this->useV6 = $config->get( 'CodeMirrorV6' );
|
||||
$this->conflictingGadgets = $config->get( 'CodeMirrorConflictingGadgets' );
|
||||
$this->isSupportedRtlWiki = $config->get( 'CodeMirrorRTL' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +76,7 @@ class Hooks implements
|
|||
// Disable CodeMirror if we're on an edit page with a conflicting gadget. See T178348.
|
||||
return !$this->conflictingGadgetsEnabled( $extensionRegistry, $out->getUser() ) &&
|
||||
// CodeMirror 5 on textarea wikitext editors doesn't support RTL (T170001)
|
||||
( !$isRTL || $this->shouldUseV6( $out ) ) &&
|
||||
( !$isRTL || ( $this->shouldUseV6( $out ) && $this->isSupportedRtlWiki ) ) &&
|
||||
// Limit to supported content models that use wikitext.
|
||||
// See https://www.mediawiki.org/wiki/Content_handlers#Extension_content_handlers
|
||||
in_array( $out->getTitle()->getContentModel(), $contentModels );
|
||||
|
|
Loading…
Reference in a new issue