From 25a52cb267d7332a52d265df64d8e193635ffc58 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 29 Mar 2016 12:49:05 +0000 Subject: [PATCH] Fix user-select not working in FF --- phpgwapi/js/egw_action/egw_action.js | 12 ++++++------ phpgwapi/js/egw_action/egw_action_dragdrop.js | 17 +++++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/phpgwapi/js/egw_action/egw_action.js b/phpgwapi/js/egw_action/egw_action.js index 2c620db1dd..502fd0d961 100644 --- a/phpgwapi/js/egw_action/egw_action.js +++ b/phpgwapi/js/egw_action/egw_action.js @@ -2161,11 +2161,11 @@ egwActionObject.prototype.getActionImplementationGroups = function(_test, _group /** * Check if user tries to get dragOut action - * + * * keys for dragOut: * -Mac: Command + Shift * -Others: Alt + Shift - * + * * @param {event} _event * @return {boolean} return true if Alt+Shift keys and left mouse click arre pressed, otherwise false */ @@ -2176,17 +2176,17 @@ egwActionObject.prototype.isDragOut = function (_event) /** * Check if user tries to get selection action - * + * * Keys for selection: * -Mac: Command key * -Others: Ctrl key - * + * * @param {type} _event - * @returns {Boolean} return true if left mouse click and Ctrl key are pressed, otherwise false + * @returns {Boolean} return true if left mouse click and Ctrl/Alt key are pressed, otherwise false */ egwActionObject.prototype.isSelection = function (_event) { - return !(_event.shiftKey) && _event.which == 1 && (_event.metaKey || _event.ctrlKey); + return !(_event.shiftKey) && _event.which == 1 && (_event.metaKey || _event.ctrlKey || _event.altKey); }; /** egwActionObjectInterface Interface **/ diff --git a/phpgwapi/js/egw_action/egw_action_dragdrop.js b/phpgwapi/js/egw_action/egw_action_dragdrop.js index e5cf7aae41..24d86f8097 100644 --- a/phpgwapi/js/egw_action/egw_action_dragdrop.js +++ b/phpgwapi/js/egw_action/egw_action_dragdrop.js @@ -342,7 +342,7 @@ function egwDragActionImplementation() return ai.defaultDDHelper(ai.selected);//$j(document.createElement("div")).addClass('et2_egw_action_ddHelper'); }, "start": function(e) { - + //Stop dragging if user tries to do scrolling by mouse down and drag //Seems this issue is only happening in FF var $target = $j(e.originalEvent.target); @@ -350,7 +350,7 @@ function egwDragActionImplementation() { return false; } - + return ai.helper != null; }, revert: function(valid) @@ -368,9 +368,14 @@ function egwDragActionImplementation() { var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? egw.lang("Ctrl") : egw.lang("Command ⌘"); + // We can not use Ctrl key for FF because FF has specific function + // for element selection bound to ctrl key and it would confilicts + // with our selection functionallity. Therefore, we use Alt key when + // it comes to FF regardless of OS. + if (window.navigator.userAgent.match(/firefox/i)) key = egw.lang("Alt"); egw.message(egw.lang('Hold [%1] key to select text eg. to copy it', key), 'info'); } - + // Invalid target return true; } @@ -638,10 +643,10 @@ function egwDropActionImplementation() // set of properties. var popup = getPopupImplementation(); var pos = popup._getPageXY(event.originalEvent); - + // Don't add paste actions, this is a drop popup.auto_paste = false; - + window.setTimeout(function() { popup.doExecuteImplementation(pos, selected, links, _context); @@ -651,7 +656,7 @@ function egwDropActionImplementation() } // Set cursor back to auto. Seems FF can't handle cursor reversion $j('body').css({cursor:'auto'}); - + _aoi.triggerEvent(EGW_AI_DRAG_OUT,{event: event,ui:ui}); }, "over": function(event, ui) {