TagSpaces is an offline, open source, document manager with tagging support
Tsn155 dnd of files to folders && files to Locations Folders Tree (#785)
Stanimir5f6e4b773359
diff --git a/app/components/LocationManager.js b/app/components/LocationManager.jsindex 700a31be6..647873037 100644--- a/app/components/LocationManager.js+++ b/app/components/LocationManager.js@@ -67,6 +67,9 @@ import i18n from '../services/i18n';import { isObj } from '../utils/misc';import AppConfig from '../config';import PlatformIO from '../services/platform-io';+import TargetMoveFileBox from './TargetMoveFileBox';+import DragItemTypes from './DragItemTypes';+import IOActions from '../reducers/io-actions';type Props = {classes: Object,@@ -91,7 +94,8 @@ type Props = {text: string,notificationType: string,autohide: boolean- ) => void+ ) => void,+ moveFiles: (files: Array<string>, destination: string) => void};type State = {@@ -498,24 +502,25 @@ class LocationManager extends React.Component<Props, State> {this.props.loadDirectoryContent(subDir.path);};- renderHeaderRow = col =>- /* const { children, ...rest } = col;- const isSelectionBox = col.className.includes('selection-column');+ /**+ * https://github.com/react-component/table/blob/master/examples/react-dnd.js+ * @param item+ * @param monitor+ */+ handleFileMoveDrop = (item, monitor) => {+ if (monitor) { // TODO handle monitor -> isOver and change folder icon+ const { path } = monitor.getItem();+ console.log('Dropped files: ' + path);+ this.props.moveFiles([path], item.children[1].props.record.path);+ }+ };- return (- <th {...rest}>- {isSelectionBox ? (- children- ) : (- <span>- <span xs={4}>{children}</span>- <span xs={2}>Age</span>- <span xs>Bar</span>- </span>- )}- </th>- ); */- (<span />)+ renderBodyCell = (props) =>+ (+ <td {...props} style={{ position: 'relative' }} >+ <TargetMoveFileBox accepts={[DragItemTypes.FILE]} onDrop={this.handleFileMoveDrop} >{props.children}</TargetMoveFileBox>+ </td>+ );// expandedRowRender = (record, index, indent, expanded) => (<p>extra: {record.name}</p>);/* CustomExpandIcon = (props) => {@@ -552,8 +557,10 @@ class LocationManager extends React.Component<Props, State> {// defaultExpandAllRows// className={classes.locationListArea}components={{- header: { cell: this.renderHeaderRow },+ // header: { cell: this.renderHeaderRow },+ body: { cell: this.renderBodyCell }}}+ showHeader={false}// className="table"rowKey="path"data={this.state.dirs[location.uuid]}@@ -792,6 +799,7 @@ function mapDispatchToProps(dispatch) {deleteDirectory: AppActions.deleteDirectory,openDirectory: AppActions.openDirectory,openFileNatively: AppActions.openFileNatively,+ moveFiles: IOActions.moveFiles}, dispatch);}diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.jsindex 4ceba3fe0..466b12a9d 100644--- a/app/perspectives/grid-perspective/src/index.js+++ b/app/perspectives/grid-perspective/src/index.js@@ -110,8 +110,12 @@ const styles = theme => ({},rowCell: {backgroundColor: theme.palette.background.paper,+ boxShadow: 'none',+ borderTop: '1px solid transparent',+ borderBottom: '1px solid ' + theme.palette.divider,margin: 0,- marginBottom: 1,+ marginTop: 0,+ marginBottom: 0,borderRadius: 0},selectedGridCell: {