1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

forbid drag&drop on ie brower less than ie11

This commit is contained in:
shanshuirenjia
2019-06-04 15:59:25 +08:00
parent 7756093299
commit 9ba1278eca
2 changed files with 30 additions and 1 deletions

View File

@@ -346,32 +346,49 @@ class DirentListItem extends React.Component {
}
onItemDragStart = (e) => {
if (Utils.isIEBrower()) { // is ie <= ie11 not include edage
return false;
}
let nodeRootPath = '';
nodeRootPath = this.props.path === '/' ? `${this.props.path}${this.props.dirent.name}` : `${this.props.path}/${this.props.dirent.name}`;
let dragStartItemData = {nodeDirent: this.props.dirent, nodeParentPath: this.props.path, nodeRootPath: nodeRootPath};
dragStartItemData = JSON.stringify(dragStartItemData);
e.dataTransfer.effectAllowed = 'move';
if (e.dataTransfer && e.dataTransfer.setDragImage) {
e.dataTransfer.setDragImage(this.refs.drag_icon, 15, 15);
}
e.dataTransfer.setData('applicaiton/drag-item-info', dragStartItemData);
}
onItemDragEnter = () => {
if (Utils.isIEBrower()) { // is ie <= ie11 not include edage
return false;
}
if (this.props.dirent.type === 'dir') {
this.setState({isDropTipshow: true});
}
}
onItemDragOver = (e) => {
if (Utils.isIEBrower()) { // is ie <= ie11 not include edage
return false;
}
e.preventDefault();
e.dataTransfer.dropEffect = 'move';
}
onItemDragLeave = () => {
if (Utils.isIEBrower()) { // is ie <= ie11 not include edage
return false;
}
this.setState({isDropTipshow: false});
}
onItemDragDrop = (e) => {
if (Utils.isIEBrower()) { // is ie <= ie11 not include edage
return false;
}
this.setState({isDropTipshow: false});
if (e.dataTransfer.files.length) { // uploaded files
return;

View File

@@ -537,23 +537,35 @@ class DirentListView extends React.Component {
}
onTableDragEnter = (e) => {
if (Utils.isIEBrower()) {
return false;
}
if (e.target.className === 'table-container ') {
this.setState({isListDropTipShow: true});
}
}
onTableDragOver = (e) => {
if (Utils.isIEBrower) {
return false;
}
e.preventDefault();
e.dataTransfer.dropEffect = 'move';
}
onTableDragLeave = (e) => {
if (Utils.isIEBrower) {
return false;
}
if (e.target.className === 'table-container table-drop-active') {
this.setState({isListDropTipShow: false});
}
}
tableDrop = (e) => {
if (Utils.isIEBrower) {
return false;
}
e.persist();
this.setState({isListDropTipShow: false});
if (e.dataTransfer.files.length) { // uploaded files