mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1293: Do not use double click - use click when file is focused.
This commit is contained in:
@@ -142,26 +142,42 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser(
|
|||||||
// Create from internal template
|
// Create from internal template
|
||||||
var element = angular.element($interpolate(fileTemplate)(file));
|
var element = angular.element($interpolate(fileTemplate)(file));
|
||||||
|
|
||||||
|
// Double-clicking on unknown file types will do nothing
|
||||||
|
var fileAction = function doNothing() {};
|
||||||
|
|
||||||
// Change current directory when directories are clicked
|
// Change current directory when directories are clicked
|
||||||
if ($scope.isDirectory(file)) {
|
if ($scope.isDirectory(file)) {
|
||||||
element.addClass('directory');
|
element.addClass('directory');
|
||||||
element.on('dblclick', function changeDirectory() {
|
fileAction = function changeDirectory() {
|
||||||
$scope.changeDirectory(file);
|
$scope.changeDirectory(file);
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate downloads when normal files are clicked
|
// Initiate downloads when normal files are clicked
|
||||||
else if ($scope.isNormalFile(file)) {
|
else if ($scope.isNormalFile(file)) {
|
||||||
element.addClass('normal-file');
|
element.addClass('normal-file');
|
||||||
element.on('dblclick', function downloadFile() {
|
fileAction = function downloadFile() {
|
||||||
$scope.downloadFile(file);
|
$scope.downloadFile(file);
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark file as focused upon click
|
// Mark file as focused upon click
|
||||||
element.on('click', function focusFile() {
|
element.on('click', function focusFile(e) {
|
||||||
element.parent().children().removeClass('focused');
|
|
||||||
element.addClass('focused');
|
// Fire file-specific action if already focused
|
||||||
|
if (element.hasClass('focused'))
|
||||||
|
fileAction();
|
||||||
|
|
||||||
|
// Otherwise mark as focused
|
||||||
|
else {
|
||||||
|
element.parent().children().removeClass('focused');
|
||||||
|
element.addClass('focused');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not allow default action
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Prevent text selection during navigation
|
// Prevent text selection during navigation
|
||||||
|
Reference in New Issue
Block a user