DLynch has uploaded a new change for review.

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

Change subject: init: port in isUnModifiedLeftClick without any VE core 
dependencies
......................................................................

init: port in isUnModifiedLeftClick without any VE core dependencies

Bug: T143467
Change-Id: I4c0ecf80ecfff04472e136801264d50dafe39575
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/44/306044/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 9b595d5..8f577f6 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
@@ -544,8 +544,22 @@
                        }
                },
 
+               /**
+                * Check whether a jQuery event represents a plain left click, 
without
+                * any modifiers
+                *
+                * This is a duplicate of a function in ve.utils, because this 
file runs
+                * before any of VE core or OOui has been loaded.
+                *
+                * @param {jQuery.Event} e The jQuery event object
+                * @return {boolean} Whether it was an unmodified left click
+                */
+               isUnmodifiedLeftClick: function ( e ) {
+                       return e && e.which && e.which === 1 && !( e.shiftKey 
|| e.altKey || e.ctrlKey || e.metaKey );
+               },
+
                onEditTabClick: function ( e ) {
-                       if ( !ve.isUnmodifiedLeftClick( e ) ) {
+                       if ( !init.isUnmodifiedLeftClick( e ) ) {
                                return;
                        }
                        e.preventDefault();
@@ -553,7 +567,7 @@
                },
 
                onEditSourceTabClick: function ( e ) {
-                       if ( ( e.which && e.which !== 1 ) || e.shiftKey || 
e.altKey || e.ctrlKey || e.metaKey ) {
+                       if ( !init.isUnmodifiedLeftClick( e ) ) {
                                return;
                        }
                        e.preventDefault();
@@ -609,7 +623,7 @@
 
                onEditSectionLinkClick: function ( e ) {
                        var targetPromise;
-                       if ( !ve.isUnmodifiedLeftClick( e ) ) {
+                       if ( !init.isUnmodifiedLeftClick( e ) ) {
                                return;
                        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c0ecf80ecfff04472e136801264d50dafe39575
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to