jenkins-bot has submitted this change and it was merged.

Change subject: (attempt to) make NWE work with SET
......................................................................


(attempt to) make NWE work with SET

Ugh.

Bug: T143578
Change-Id: I71e08508eb0914be9d624202b13a4369df512b80
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 33 insertions(+), 4 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



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 6bf9527..e7a207e 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
@@ -764,7 +764,8 @@
                var showWikitextWelcome = true,
                        isLoggedIn = !mw.user.isAnon(),
                        prefSaysShowWelcome = isLoggedIn && 
!mw.user.options.get( 'visualeditor-hidebetawelcome' ),
-                       urlSaysHideWelcome = 'hidewelcomedialog' in new mw.Uri( 
location.href ).query;
+                       urlSaysHideWelcome = 'hidewelcomedialog' in new mw.Uri( 
location.href ).query,
+                       action = 'edit';
 
                if ( uri.query.action === 'edit' && $( '#wpTextbox1' ).length ) 
{
                        initialWikitext = $( '#wpTextbox1' ).textSelection( 
'getContents' );
@@ -784,7 +785,7 @@
                                // TODO: other params too? See identical list 
in VisualEditor.hooks.php)
                        ) {
                                if (
-                                       // … if on a ?veaction=edit page
+                                       // … if on a ?veaction=edit/editsource 
page
                                        ( isViewPage && uri.query.veaction in 
editModes ) ||
                                        // … or if on ?action=edit in single 
edit mode and the user wants it
                                        (
@@ -802,8 +803,19 @@
                                                                                
mw.config.get( 'wgAction' ) !== 'submit'
                                                                        ) ||
                                                                        (
+                                                                               
tabPreference === 'prefer-wte' &&
+                                                                               
conf.enableWikitext &&
+                                                                               
mw.user.options.get( 'visualeditor-newwikitext' )
+                                                                       ) ||
+                                                                       (
                                                                                
tabPreference === 'remember-last' &&
-                                                                               
getLastEditor() !== 'wikitext'
+                                                                               
(
+                                                                               
        getLastEditor() !== 'wikitext' ||
+                                                                               
        (
+                                                                               
                conf.enableWikitext &&
+                                                                               
                mw.user.options.get( 'visualeditor-newwikitext' )
+                                                                               
        )
+                                                                               
)
                                                                        )
                                                                )
                                                        )
@@ -815,7 +827,24 @@
                                                type: uri.query.vesection === 
undefined ? 'page' : 'section',
                                                mechanism: 'url'
                                        } );
-                                       activateTarget( editModes[ 
uri.query.veaction ] );
+                                       if ( isViewPage && uri.query.veaction 
in editModes ) {
+                                               activateTarget( editModes[ 
uri.query.veaction ] );
+                                       } else {
+                                               if (
+                                                       conf.enableWikitext &&
+                                                       mw.user.options.get( 
'visualeditor-newwikitext' ) &&
+                                                       (
+                                                               tabPreference 
=== 'prefer-ve' ||
+                                                               (
+                                                                       
tabPreference === 'remember-last' &&
+                                                                       
getLastEditor() === 'wikitext'
+                                                               )
+                                                       )
+                                               ) {
+                                                       action = 'editsource';
+                                               }
+                                               activateTarget( editModes[ 
action ] );
+                                       }
                                } else if ( pageCanLoadVE && userPrefEnabled ) {
                                        // Page can be edited in VE, parameters 
are good, user prefs are mostly good
                                        // but have 
visualeditor-tabs=prefer-wt? Add a keyboard shortcut to go to

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I71e08508eb0914be9d624202b13a4369df512b80
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <a...@wikimedia.org>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to