From e1909224032a65dc4c27d46eb8c9d592750adb74 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 22 Feb 2018 17:20:20 -0800 Subject: [PATCH] Make it possible for wikis to have the 2017 wikitext editor by default Bug: T150578 Change-Id: I1cb47a044c9c8ee58229d83ee98dbdd1f07af9de --- i18n/ve-mw/en.json | 1 + i18n/ve-mw/qqq.json | 1 + includes/VisualEditorHooks.php | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/i18n/ve-mw/en.json b/i18n/ve-mw/en.json index 969f11582b..c1e871279b 100644 --- a/i18n/ve-mw/en.json +++ b/i18n/ve-mw/en.json @@ -377,6 +377,7 @@ "visualeditor-preference-core-info-link": "\/\/mediawiki.org\/wiki\/Special:MyLanguage\/VisualEditor\/Beta_Features\/General", "visualeditor-preference-core-label": "Visual editing", "visualeditor-preference-enable": "Enable the visual editor. It will be available in the following {{PLURAL:$2|namespace|namespaces}}: $1", + "visualeditor-preference-newwikitexteditor-enable": "Use the wikitext mode inside the visual editor, instead of a different wikitext editor.", "visualeditor-preference-newwikitexteditor-description": "Enable the new wikitext mode inside the visual editor. It has many of the tools present in the visual editor, uses a similar design, and allows better switching between the two.", "visualeditor-preference-newwikitexteditor-discussion-link": "\/\/mediawiki.org\/wiki\/2017_wikitext_editor\/Feedback", "visualeditor-preference-newwikitexteditor-info-link": "\/\/mediawiki.org\/wiki\/Special:MyLanguage\/2017 wikitext editor", diff --git a/i18n/ve-mw/qqq.json b/i18n/ve-mw/qqq.json index bf16bafc57..436a7bfdea 100644 --- a/i18n/ve-mw/qqq.json +++ b/i18n/ve-mw/qqq.json @@ -390,6 +390,7 @@ "visualeditor-preference-core-info-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can learn about this Beta Feature. Defaults to a page on MediaWiki.org.}}", "visualeditor-preference-core-label": "Used in [[Special:Preferences]].\n\nUsed as label for checkbox to enable the visual editor.\n\nThe description for this checkbox is: {{msg-mw|Visualeditor-preference-core-description}}", "visualeditor-preference-enable": "Label for the user preference to enable VisualEditor while it is in alpha (opt-in) mode.\nLinks are in {{msg-mw|Visualeditor-mainnamespacepagelink}} and {{msg-mw|visualeditor-usernamespacepagelink}}.\n\nParameters:\n* $1 - Comma separated list of namespace names.\n* $2 - Number of namespaces in which it will be used.\n\nSee also:\n* {{msg-mw|Visualeditor-preference-core-description}}", + "visualeditor-preference-newwikitexteditor-enable": "Label for the user preference to use the wikitext mode inside the visual editor. It replaces the wikitext editor software.", "visualeditor-preference-newwikitexteditor-description": "Used in [[Special:Preferences]].\n\nUsed as description for the checkbox to enable the new wikitext editor.\n\nThe label for this checkbox is {{msg-mw|Visualeditor-preference-newwikitexteditor-label}}.", "visualeditor-preference-newwikitexteditor-discussion-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can discuss this Beta Feature. Defaults to a page on MediaWiki.org.}}", "visualeditor-preference-newwikitexteditor-info-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can learn about this Beta Feature. Defaults to a page on MediaWiki.org.}}", diff --git a/includes/VisualEditorHooks.php b/includes/VisualEditorHooks.php index f44408c775..84e9da6184 100644 --- a/includes/VisualEditorHooks.php +++ b/includes/VisualEditorHooks.php @@ -657,6 +657,15 @@ class VisualEditorHooks { $user->getOption( 'visualeditor-autodisable' ) ]; + // Config option for wikitext editing "deployed" state (opt-out) + if ( $config->get( 'VisualEditorEnableWikitext' ) ) { + $preferences['visualeditor-newwikitext'] = [ + 'type' => 'toggle', + 'label-message' => 'visualeditor-preference-newwikitexteditor-enable', + 'section' => 'editing/editor' + ]; + } + // Config option for Single Edit Tab if ( $config->get( 'VisualEditorUseSingleEditTab' ) &&