1
0
mirror of https://github.com/EGroupware/egroupware.git synced 2025-01-06 14:09:52 +01:00

Fix user-select not working in FF

This commit is contained in:
Hadi Nategh 2016-03-29 12:49:05 +00:00
parent 3f6a9531cd
commit 25a52cb267
2 changed files with 17 additions and 12 deletions

View File

@ -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 **/

View File

@ -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) {