Alex Monk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310709

Change subject: Use correct switch type when opening welcome dialog on NWE
......................................................................

Use correct switch type when opening welcome dialog on NWE

Bug: T145225
Change-Id: I032652733576d1a9797cc3dbb3dd24ca69cb30e5
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
M modules/ve-mw/init/ve.init.MWWelcomeDialog.js
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
3 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/09/310709/1

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 5aa6038..6bf9527 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -962,7 +962,7 @@
                                        welcomeDialog,
                                        {
                                                switchable: init.isAvailable,
-                                               editor: 'wte'
+                                               editor: 'source'
                                        }
                                )
                                        .then( function ( opened ) { return 
opened; } )
diff --git a/modules/ve-mw/init/ve.init.MWWelcomeDialog.js 
b/modules/ve-mw/init/ve.init.MWWelcomeDialog.js
index 702f631..4599e36 100644
--- a/modules/ve-mw/init/ve.init.MWWelcomeDialog.js
+++ b/modules/ve-mw/init/ve.init.MWWelcomeDialog.js
@@ -40,18 +40,18 @@
        {
                action: 'switch-wte',
                label: OO.ui.deferMsg( 'visualeditor-welcomedialog-switch' ),
-               modes: [ 've' ]
+               modes: [ 'visual' ]
        },
        {
                action: 'switch-ve',
                label: OO.ui.deferMsg( 'visualeditor-welcomedialog-switch-ve' ),
-               modes: [ 'wte' ]
+               modes: [ 'source' ]
        },
        {
                action: 'accept',
                label: OO.ui.deferMsg( 'visualeditor-welcomedialog-action' ),
                flags: [ 'progressive', 'primary' ],
-               modes: [ 've', 'wte', 'noswitch' ]
+               modes: [ 'visual', 'source', 'noswitch' ]
        }
 ];
 
diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index e1c50d5..c3abf1c 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -1812,7 +1812,7 @@
                                this.welcomeDialog,
                                {
                                        switchable: 
this.constructor.static.trackingName !== 'mobile',
-                                       editor: 've'
+                                       editor: this.mode
                                }
                        )
                                .then( function ( opened ) {
@@ -1824,11 +1824,15 @@
                                .then( function ( data ) {
                                        target.welcomeDialogPromise.resolve();
                                        target.welcomeDialog = null;
+                                       // switchToWikitextEditor and 
switchToVisualEditor are actually
+                                       // only defined in subclasses :/
                                        if ( data && data.action === 
'switch-wte' ) {
                                                // TODO: Make this work on 
mobile - right now we can only
                                                // get away with it because the 
button which triggers this
                                                // action is hidden on mobile
                                                target.switchToWikitextEditor( 
true, true );
+                                       } else if ( data && data.action == 
'switch-ve' ) {
+                                               target.switchToVisualEditor();
                                        }
                                } );
                } else {

-- 
To view, visit https://gerrit.wikimedia.org/r/310709
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I032652733576d1a9797cc3dbb3dd24ca69cb30e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <a...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to