Allow to paste into directory entry

This commit is contained in:
Johannes Zellner
2021-01-30 23:26:32 +01:00
parent 77cb64369b
commit e18b522ff3

View File

@@ -352,11 +352,11 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$scope.clipboardCut = false;
};
$scope.actionPaste = function () {
$scope.actionPaste = function (destinationEntry) {
if ($scope.clipboardCut) {
// move files
async.eachLimit($scope.clipboard, 5, function (entry, callback) {
var newFilePath = sanitize($scope.cwd + '/' + entry.fileName);
var newFilePath = sanitize($scope.cwd + '/' + (destinationEntry.isDirectory ? destinationEntry.fileName : '') + '/' + entry.fileName);
// TODO this will overwrite files in destination!
Client.filesRename($scope.id, $scope.type, entry.fullFilePath, newFilePath, callback);
@@ -880,7 +880,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
text: tr['filemanager.list.menu.paste'],
hasBottomDivider: true,
enabled: function () { return $scope.clipboard.length; },
click: function ($itemScope, $event, entry) { $scope.actionPaste(); }
click: function ($itemScope, $event, entry) { $scope.actionPaste(entry); }
}, {
text: tr['filemanager.list.menu.rename'],
enabled: function () { return $scope.selected.length === 1; },