Revert commit r49090, because it breaks special ctrl key and click handling in nm. Need more investigation to solve it

This commit is contained in:
Hadi Nategh 2014-10-21 13:35:19 +00:00
parent b6f69d3a4c
commit 549431fb73

View File

@ -132,11 +132,12 @@ function egwDragActionImplementation()
var text = $j(document.createElement('div')).addClass('et2_egw_action_ddHelper_tip');
div.append(text);
// Add notice of Shift key, if supported
// Add notice of Ctrl key, if supported
if('draggable' in document.createElement('span') &&
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
{
text.text(egw.lang('Hold Shift to drag %1 to your computer', itemLabel));
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
text.text(egw.lang('Hold %1 to drag %2 to your computer',key, itemLabel));
}
// Final html DOM return as helper structor
return div;
@ -173,19 +174,15 @@ function egwDragActionImplementation()
}
if(action)
{
// As we are planning to remove this trigger key for drag out action in the future, and as
// we have a standard key (ctrl or command key in Mac) in nm context menu to be able to
// disable the context menu, therefore, we will make the Ctrl key a standard key to disabling dd actions too,
// which means user also would be able to select content by holding ctrl key.
/**
* We found an action with dragType 'file', so by holding Shift
* We found an action with dragType 'file', so by holding Ctrl
* key & dragging, user can drag from browser to system.
* The global data store must provide a full, absolute URL in 'download_url'
* and a mime in 'mime'.
*
* Unfortunately, Native DnD to drag the file conflicts with jQueryUI draggable,
* which handles all the other DnD actions. We get around this by:
* 1. Require the user indicate a file drag with Shift key
* 1. Require the user indicate a file drag with Ctrl key
* 2. Disable jQueryUI draggable, then turn on native draggable attribute
* This way we can at least toggle which one is operating, so they
* both work alternately if not together.
@ -196,12 +193,12 @@ function egwDragActionImplementation()
$j(node).off("mousedown")
.on("mousedown", function(event) {
$j(node).draggable("option","disabled",event.shiftKey || event.metaKey || event.ctrlKey);
$j(this).attr("draggable", event.shiftKey || event.metaKey ? "true" : "");
$j(node).draggable("option","disabled",event.ctrlKey || event.metaKey);
$j(this).attr("draggable", event.ctrlKey || event.metaKey ? "true" : "");
// Disabling draggable adds some UI classes, but we don't care so remove them
$j(node).removeClass("ui-draggable-disabled ui-state-disabled");
if(!(event.shiftKey || event.metaKey) || !this.addEventListener) return;
if(!(event.ctrlKey || event.metaKey) || !this.addEventListener) return;
})
.on("dragstart", function(event) {
if(event.dataTransfer == null) {
@ -264,15 +261,6 @@ function egwDragActionImplementation()
}
});
}
else
{
//Disable dragging to be able to select content of item by holding Ctrl then selecting content
$j(node).off("mousedown")
.on("mousedown", function(event) {
$j(node).draggable("option","disabled",event.ctrlKey || event.metaKey);
});
}
$j(node).draggable(
{
"distance": 20,