diff --git a/extension.json b/extension.json index 8898b338..86ecdde1 100644 --- a/extension.json +++ b/extension.json @@ -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": { diff --git a/includes/Hooks.php b/includes/Hooks.php index dde0aaa6..ab748169 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -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 );