TagSpaces is an offline, open source, document manager with tagging support
fix: disabling drag and drop from cloud to local location and vice versa
Ilian Sapundshiev49fe43a5a369
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsxindex 305bc7d76..0629f738f 100644--- a/app/components/LocationManager.tsx+++ b/app/components/LocationManager.tsx@@ -576,6 +576,7 @@ class LocationManager extends React.Component<Props, State> {* @param monitor*/handleFileMoveDrop = (item, monitor) => {+ const { path } = monitor.getItem();if (this.props.isReadOnlyMode) {this.props.showNotification(i18n.t('core:dndDisabledReadOnlyMode'),@@ -584,6 +585,22 @@ class LocationManager extends React.Component<Props, State> {);return;}+ if (!AppConfig.isWin && !path.startsWith('/')) {+ this.props.showNotification(+ i18n.t('Moving file not possible'),+ 'error',+ true+ );+ return;+ }+ if (AppConfig.isWin && !path.substr(1).startsWith(':')) {+ this.props.showNotification(+ i18n.t('Moving file not possible'),+ 'error',+ true+ );+ return;+ }let targetPath;if (item.children && item.children.props && item.children.props.path) {targetPath = item.children.props.path;@@ -592,7 +609,6 @@ class LocationManager extends React.Component<Props, State> {}if (monitor && targetPath) {// TODO handle monitor -> isOver and change folder icon- const { path } = monitor.getItem();console.log('Dropped files: ' + path);this.props.moveFiles([path], targetPath);}@@ -613,6 +629,7 @@ class LocationManager extends React.Component<Props, State> {// <Tooltip id="tooltip-icon" title={i18n.t('core:moreOperations')} placement="bottom"></Tooltip>renderLocation = (location: Location) => {let table;+ const isCloudLocation = location.type === locationType.TYPE_CLOUD;if (this.state.dirs[location.uuid] !== undefined) {const columns = [{@@ -683,12 +700,8 @@ class LocationManager extends React.Component<Props, State> {)}</ListItemIcon>- <TargetMoveFileBox- // @ts-ignore- accepts={[DragItemTypes.FILE]}- onDrop={this.handleFileMoveDrop}- >- <div style={{ maxWidth: 250 }} path={location.paths[0]}>+ {isCloudLocation ? (+ <div style={{ maxWidth: 250 }}><Typographyvariant="inherit"style={{ paddingLeft: 5, paddingRight: 5 }}@@ -699,7 +712,25 @@ class LocationManager extends React.Component<Props, State> {{location.name}</Typography></div>- </TargetMoveFileBox>+ ) : (+ <TargetMoveFileBox+ // @ts-ignore+ accepts={[DragItemTypes.FILE]}+ onDrop={this.handleFileMoveDrop}+ >+ <div style={{ maxWidth: 250 }} path={location.paths[0]}>+ <Typography+ variant="inherit"+ style={{ paddingLeft: 5, paddingRight: 5 }}+ className={this.props.classes.header}+ data-tid="locationTitleElement"+ noWrap+ >+ {location.name}+ </Typography>+ </div>+ </TargetMoveFileBox>+ )}{!isLocationsReadOnly && (<ListItemSecondaryAction><IconButton