Support internal dragndrop of multiple selected entries
This commit is contained in:
@@ -143,8 +143,8 @@ function FileTreeController($scope, $translate, $timeout, Client) {
|
||||
}
|
||||
|
||||
$scope.dragStart = function ($event, entry) {
|
||||
var filePath = sanitize($scope.cwd + '/' + entry.fileName);
|
||||
$event.originalEvent.dataTransfer.setData('application/cloudron-filemanager', filePath);
|
||||
var filePaths = $scope.selected.map(function (entry) { return sanitize($scope.cwd + '/' + entry.fileName); });
|
||||
$event.originalEvent.dataTransfer.setData('application/cloudron-filemanager', JSON.stringify(filePaths));
|
||||
};
|
||||
|
||||
$scope.dragEnter = function ($event, entry) {
|
||||
@@ -191,11 +191,16 @@ function FileTreeController($scope, $translate, $timeout, Client) {
|
||||
if (dragContent) {
|
||||
var moved = 0;
|
||||
|
||||
// FIXME only one currently supported
|
||||
var arr = [ dragContent ];
|
||||
// we expect a JSON.stringified Array here
|
||||
try {
|
||||
dragContent = JSON.parse(dragContent);
|
||||
} catch (e) {
|
||||
console.error('Wrong drag content.', e);
|
||||
return;
|
||||
}
|
||||
|
||||
// move files
|
||||
async.eachLimit(arr, 5, function (oldFilePath, callback) {
|
||||
async.eachLimit(dragContent, 5, function (oldFilePath, callback) {
|
||||
var fileName = oldFilePath.split('/').slice(-1);
|
||||
var newFilePath = sanitize(targetFolder + '/' + fileName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user