Alex Monk has uploaded a new change for review.

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

Change subject: Revert "Simplify some SET logic"
......................................................................

Revert "Simplify some SET logic"

This reverts commit b7227f96fea916d2df0c16047c43057045d270c2.

Change-Id: I46fdcf336f556680fa72df0893447b6850cc4b1d
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 13 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/05/259205/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 5d67b21..22e5ea7 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
@@ -241,7 +241,6 @@
 
        function getLastEditor() {
                var editor = $.cookie( 'VEE' );
-               // TODO: Check validity?
                if ( !mw.user.isAnon() || !editor ) {
                        editor = mw.user.options.get( 'visualeditor-editor' );
                }
@@ -693,7 +692,7 @@
        }
 
        $( function () {
-               var key;
+               var key, loadVEInPage;
                if ( uri.query.action === 'edit' && $( '#wpTextbox1' ).length ) 
{
                        initialWikitext = $( '#wpTextbox1' ).val();
                }
@@ -769,28 +768,31 @@
                                        } );
                                } );
                        }
-
                        if (
                                conf.singleEditTab &&
                                mw.user.options.get( 'visualeditor-tabs' ) !== 
'multi-tab' &&
-                               userPrefEnabled &&
-                               pageCanLoadVE && (
+                               userPrefEnabled
+                       ) {
+                               loadVEInPage = pageCanLoadVE && (
                                        mw.user.options.get( 
'visualeditor-tabs' ) === 'prefer-ve' ||
                                        (
                                                getLastEditor() !== 'wikitext' 
&&
                                                mw.user.options.get( 
'visualeditor-tabs' ) !== 'prefer-wt'
                                        )
-                               )
-                       ) {
+                               );
                                // Handle section edit link clicks
                                $( '.mw-editsection a' ).on( 'click', function 
( e ) {
-                                       init.onEditSectionLinkClick( e );
+                                       if ( loadVEInPage ) {
+                                               init.onEditSectionLinkClick( e 
);
+                                       }
                                } );
                                // Allow instant switching to edit mode, 
without refresh
                                $( '#ca-edit' ).on( 'click', function ( e ) {
-                                       trackActivateStart( { type: 'page', 
mechanism: 'click' } );
-                                       activateTarget();
-                                       e.preventDefault();
+                                       if ( loadVEInPage ) {
+                                               trackActivateStart( { type: 
'page', mechanism: 'click' } );
+                                               activateTarget();
+                                               e.preventDefault();
+                                       }
                                } );
                        } else if ( userPrefEnabled ) {
                                init.setupSkin();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I46fdcf336f556680fa72df0893447b6850cc4b1d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <kren...@gmail.com>

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

Reply via email to