Skip to content

TagSpaces is an offline, open source, document manager with tagging support

enable multiple files upload

Stanimir150d803f4c5f
diff --git a/app/components/FileSourceDnd.tsx b/app/components/FileSourceDnd.tsx
index a14b9c805..4966e22f0 100644
--- a/app/components/FileSourceDnd.tsx
+++ b/app/components/FileSourceDnd.tsx
@@ -30,7 +30,8 @@ const boxSource = {
beginDrag(props) {
// console.log('beginDrag', props);
return {
- path: props.children.props.entryPath
+ path: props.children.props.entryPath,
+ selectedEntries: props.children.props.selectedEntries
};
}
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 0629f738f..969e378a1 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -500,6 +500,7 @@ class LocationManager extends React.Component<Props, State> {
}
this.props.loadDirectoryContent(location.paths[0]);
} else {
+ this.props.setSelectedEntries([]);
this.loadSubDirectories(location, 1);
this.props.openLocation(location);
this.state.locationRootPath = location.paths[0];
@@ -576,7 +577,15 @@ class LocationManager extends React.Component<Props, State> {
* @param monitor
*/
handleFileMoveDrop = (item, monitor) => {
- const { path } = monitor.getItem();
+ const { path, selectedEntries } = monitor.getItem();
+ const arrPath = [];
+ if (selectedEntries && selectedEntries.length > 0) {
+ selectedEntries.map(entry => {
+ arrPath.push(entry.path);
+ });
+ } else {
+ arrPath.push(path);
+ }
if (this.props.isReadOnlyMode) {
this.props.showNotification(
i18n.t('core:dndDisabledReadOnlyMode'),
@@ -610,7 +619,8 @@ class LocationManager extends React.Component<Props, State> {
if (monitor && targetPath) {
// TODO handle monitor -> isOver and change folder icon
console.log('Dropped files: ' + path);
- this.props.moveFiles([path], targetPath);
+ this.props.moveFiles(arrPath, targetPath);
+ this.props.setSelectedEntries([]);
}
};
@@ -974,7 +984,8 @@ function mapDispatchToProps(dispatch) {
openFile: AppActions.openFile,
showNotification: AppActions.showNotification,
moveFiles: IOActions.moveFiles,
- openURLExternally: AppActions.openURLExternally
+ openURLExternally: AppActions.openURLExternally,
+ setSelectedEntries: AppActions.setSelectedEntries
},
dispatch
);
diff --git a/app/components/TagDropContainer.tsx b/app/components/TagDropContainer.tsx
index 015a2a88c..2bc34e67f 100644
--- a/app/components/TagDropContainer.tsx
+++ b/app/components/TagDropContainer.tsx
@@ -30,6 +30,7 @@ interface Props {
const boxTarget = {
drop(props) {
return {
+ selectedEntries: props.selectedEntries,
entryPath: props.entryPath
};
}
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index e43b5071e..fc821de76 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -591,7 +591,10 @@ class GridPerspective extends React.Component<Props, State> {
}
const cellContent: any = (
- <TagDropContainer entryPath={fsEntry.path}>
+ <TagDropContainer
+ entryPath={fsEntry.path}
+ selectedEntries={selectedEntries}
+ >
<CellContent
selected={selected}
fsEntry={fsEntry}