Use correct switch type when opening welcome dialog on NWE

Bug: T145225
Change-Id: I032652733576d1a9797cc3dbb3dd24ca69cb30e5
This commit is contained in:
Alex Monk 2016-09-15 01:18:10 +01:00
parent 1d297d8bc1
commit 926212dbae
3 changed files with 9 additions and 5 deletions

View file

@ -962,7 +962,7 @@
welcomeDialog,
{
switchable: init.isAvailable,
editor: 'wte'
editor: 'source'
}
)
.then( function ( opened ) { return opened; } )

View file

@ -40,18 +40,18 @@ mw.libs.ve.WelcomeDialog.static.actions = [
{
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' ]
}
];

View file

@ -1812,7 +1812,7 @@ ve.init.mw.ArticleTarget.prototype.maybeShowWelcomeDialog = function () {
this.welcomeDialog,
{
switchable: this.constructor.static.trackingName !== 'mobile',
editor: 've'
editor: this.mode
}
)
.then( function ( opened ) {
@ -1824,11 +1824,15 @@ ve.init.mw.ArticleTarget.prototype.maybeShowWelcomeDialog = function () {
.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 {