1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

Putting the file out is the same as putting it in a blank space

This commit is contained in:
zxj96
2019-06-21 14:07:52 +08:00
parent 7abc1039b5
commit 9a8da1ac19
2 changed files with 28 additions and 19 deletions

View File

@@ -375,11 +375,12 @@ class DirentListItem extends React.Component {
e.dataTransfer.setData('applicaiton/drag-item-info', dragStartItemData); e.dataTransfer.setData('applicaiton/drag-item-info', dragStartItemData);
} }
onItemDragEnter = () => { onItemDragEnter = (e) => {
if (Utils.isIEBrower()) { if (Utils.isIEBrower()) {
return false; return false;
} }
if (this.props.dirent.type === 'dir') { if (this.props.dirent.type === 'dir') {
e.stopPropagation();
this.setState({isDropTipshow: true}); this.setState({isDropTipshow: true});
} }
} }
@@ -392,10 +393,14 @@ class DirentListItem extends React.Component {
e.dataTransfer.dropEffect = 'move'; e.dataTransfer.dropEffect = 'move';
} }
onItemDragLeave = () => { onItemDragLeave = (e) => {
if (Utils.isIEBrower()) { if (Utils.isIEBrower()) {
return false; return false;
} }
if (this.props.dirent.type === 'dir') {
e.stopPropagation();
}
this.setState({isDropTipshow: false}); this.setState({isDropTipshow: false});
} }
@@ -407,6 +412,9 @@ class DirentListItem extends React.Component {
if (e.dataTransfer.files.length) { // uploaded files if (e.dataTransfer.files.length) { // uploaded files
return; return;
} }
if (this.props.dirent.type === 'dir') {
e.stopPropagation();
}
let dragStartItemData = e.dataTransfer.getData('applicaiton/drag-item-info'); let dragStartItemData = e.dataTransfer.getData('applicaiton/drag-item-info');
dragStartItemData = JSON.parse(dragStartItemData); dragStartItemData = JSON.parse(dragStartItemData);
if (Array.isArray(dragStartItemData)) { //move items if (Array.isArray(dragStartItemData)) { //move items

View File

@@ -71,6 +71,7 @@ class DirentListView extends React.Component {
isListDropTipShow: false, isListDropTipShow: false,
}; };
this.enterChildAmount = 0;
this.isRepoOwner = props.currentRepoInfo.owner_email === username; this.isRepoOwner = props.currentRepoInfo.owner_email === username;
this.isAdmin = props.currentRepoInfo.is_admin; this.isAdmin = props.currentRepoInfo.is_admin;
this.repoEncrypted = props.currentRepoInfo.encrypted; this.repoEncrypted = props.currentRepoInfo.encrypted;
@@ -540,7 +541,8 @@ class DirentListView extends React.Component {
if (Utils.isIEBrower()) { if (Utils.isIEBrower()) {
return false; return false;
} }
if (e.target.className === 'table-container ') { this.enterChildAmount++;
if (this.enterChildAmount !== 0) {
this.setState({isListDropTipShow: true}); this.setState({isListDropTipShow: true});
} }
} }
@@ -557,7 +559,8 @@ class DirentListView extends React.Component {
if (Utils.isIEBrower()) { if (Utils.isIEBrower()) {
return false; return false;
} }
if (e.target.className === 'table-container table-drop-active') { this.enterChildAmount--;
if (this.enterChildAmount === 0) {
this.setState({isListDropTipShow: false}); this.setState({isListDropTipShow: false});
} }
} }
@@ -567,6 +570,7 @@ class DirentListView extends React.Component {
return false; return false;
} }
e.persist(); e.persist();
this.enterChildAmount = 0;
this.setState({isListDropTipShow: false}); this.setState({isListDropTipShow: false});
if (e.dataTransfer.files.length) { // uploaded files if (e.dataTransfer.files.length) { // uploaded files
return; return;
@@ -576,8 +580,6 @@ class DirentListView extends React.Component {
let {nodeDirent, nodeParentPath, nodeRootPath} = dragStartItemData; let {nodeDirent, nodeParentPath, nodeRootPath} = dragStartItemData;
if (e.target.className === 'table-container table-drop-active') {
if (Array.isArray(dragStartItemData)) { //selected items if (Array.isArray(dragStartItemData)) { //selected items
return; return;
} }
@@ -592,7 +594,6 @@ class DirentListView extends React.Component {
this.props.onItemMove(this.props.currentRepoInfo, nodeDirent, this.props.path, nodeParentPath); this.props.onItemMove(this.props.currentRepoInfo, nodeDirent, this.props.path, nodeParentPath);
} }
}
render() { render() {
const { direntList, sortBy, sortOrder } = this.props; const { direntList, sortBy, sortOrder } = this.props;