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 8324fb273f..48e1a94a24 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 @@ -733,7 +733,7 @@ // On a view page, extend the current URI so parameters like oldid are carried over // On a non-view page, use viewUri - if ( isOnlyTabVE() ) { + if ( init.isSingleEditTab ) { veEditUri = viewUri.clone().extend( { action: 'edit' } ); delete veEditUri.query.veaction; } else { @@ -746,23 +746,6 @@ veEditUri.extend( { oldid: oldid } ); } - userPrefEnabled = ( - // Allow disabling for anonymous users separately from changing the - // default preference (bug 50000) - !( conf.disableForAnons && mw.config.get( 'wgUserName' ) === null ) && - - // User has 'visualeditor-enable' preference enabled (for alpha opt-in) - // User has 'visualeditor-betatempdisable' preference disabled - // User has 'visualeditor-autodisable' preference disabled - enable && !tempdisable && !autodisable - ); - userPrefPreferShow = ( - userPrefEnabled && - - // If in two-edit-tab mode, or the user doesn't prefer wikitext always - ( !conf.singleEditTab || tabPreference !== 'prefer-wt' ) - ); - // Whether VisualEditor should be available for the current user, page, wiki, mediawiki skin, // browser etc. init.isAvailable = ( @@ -808,6 +791,23 @@ editModes.editsource = 'source'; } + userPrefEnabled = ( + // Allow disabling for anonymous users separately from changing the + // default preference (bug 50000) + !( conf.disableForAnons && mw.config.get( 'wgUserName' ) === null ) && + + // User has 'visualeditor-enable' preference enabled (for alpha opt-in) + // User has 'visualeditor-betatempdisable' preference disabled + // User has 'visualeditor-autodisable' preference disabled + enable && !tempdisable && !autodisable + ); + userPrefPreferShow = ( + userPrefEnabled && + + // Except when single edit tab for old wikitext + !( conf.singleEditTab && tabPreference === 'prefer-wt' && !init.isWikitextAvailable ) + ); + // FIXME: We should do this more elegantly init.setEditorPreference = setEditorPreference; @@ -1052,7 +1052,7 @@ // Set up the tabs appropriately if the user has VE on if ( init.isAvailable && userPrefPreferShow ) { // … on two-edit-tab wikis, or single-edit-tab wikis, where the user wants both … - if ( !conf.singleEditTab || tabPreference === 'multi-tab' ) { + if ( !init.isSingleEditTab ) { // … set the skin up with both tabs and both section edit links. init.setupMultiTabSkin(); } else if ( diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index b88f9207ca..77d9ed6404 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -1318,10 +1318,7 @@ ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () { // Set the current URL uri = this.currentUri; - if ( - mw.config.get( 'wgVisualEditorConfig' ).singleEditTab && - mw.user.options.get( 'visualeditor-tabs' ) !== 'multi-tab' - ) { + if ( mw.libs.ve.isSingleEditTab ) { uri.query.action = 'edit'; mw.config.set( 'wgAction', 'edit' ); } else {