Disallow switching in NWE welcome dialog if VE should be unavailable

When NWE is enabled but VE is supposed to be unavailable on the page
(e.g. in talk namespaces), do not show the option to switch to VE in
the welcome dialog.

This is relevant if new users use NWE, due to config like below
(we use this on WMF Office wiki):

    $wgDefaultUserOptions['visualeditor-newwikitext'] = true;

Change-Id: Iee8c3d3604a13dcd20efa713e49461ba9b885749
This commit is contained in:
Bartosz Dziewoński 2020-01-25 15:34:30 +01:00
parent 36c2cb90ab
commit 5c8d04afdb

View file

@ -2074,7 +2074,7 @@ ve.init.mw.ArticleTarget.prototype.getSectionFragmentFromPage = function ( conte
* Show the beta dialog as needed
*/
ve.init.mw.ArticleTarget.prototype.maybeShowWelcomeDialog = function () {
var usePrefs, prefSaysShow, urlSaysHide,
var usePrefs, prefSaysShow, urlSaysHide, editorMode,
windowManager = this.getSurface().dialogs,
target = this;
@ -2102,13 +2102,14 @@ ve.init.mw.ArticleTarget.prototype.maybeShowWelcomeDialog = function () {
)
)
) {
editorMode = this.getDefaultMode();
this.welcomeDialog = new mw.libs.ve.WelcomeDialog();
windowManager.addWindows( [ this.welcomeDialog ] );
windowManager.openWindow(
this.welcomeDialog,
{
switchable: true,
editor: this.getDefaultMode()
switchable: editorMode === 'source' ? this.isModeAvailable( 'visual' ) : true,
editor: editorMode
}
)
.closed.then( function ( data ) {