2017-03-12 00:31:23 +00:00
|
|
|
import HTML5Backend from 'react-dnd-html5-backend/lib/HTML5Backend';
|
|
|
|
|
|
|
|
class DNDBackend extends HTML5Backend {
|
2018-06-25 17:42:50 +00:00
|
|
|
handleTopDragEndCapture(e) {
|
2017-03-12 00:31:23 +00:00
|
|
|
if (this.isDraggingNativeItem()) {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.actions.endDrag();
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
super.handleTopDragEndCapture(e);
|
|
|
|
}
|
|
|
|
|
2018-06-25 17:42:50 +00:00
|
|
|
handleTopDragOver(e) {
|
2017-03-12 00:31:23 +00:00
|
|
|
if (this.isDraggingNativeItem()) return;
|
|
|
|
super.handleTopDragOver(e);
|
|
|
|
}
|
|
|
|
|
2018-06-25 17:42:50 +00:00
|
|
|
handleTopDragLeaveCapture(e) {
|
2017-03-12 00:31:23 +00:00
|
|
|
if (this.isDraggingNativeItem()) return;
|
|
|
|
super.handleTopDragLeaveCapture(e);
|
|
|
|
}
|
|
|
|
|
2018-06-25 17:42:50 +00:00
|
|
|
handleTopDropCapture(e) {
|
2017-03-12 00:31:23 +00:00
|
|
|
if (this.isDraggingNativeItem()) return;
|
|
|
|
super.handleTopDropCapture(e);
|
|
|
|
}
|
|
|
|
|
2018-06-25 17:42:50 +00:00
|
|
|
handleTopDrop(e) {
|
2017-03-12 00:31:23 +00:00
|
|
|
if (!this.monitor.isDragging() || this.isDraggingNativeItem()) return;
|
|
|
|
super.handleTopDrop(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 17:42:50 +00:00
|
|
|
export default function(manager) {
|
2017-03-12 00:31:23 +00:00
|
|
|
return new DNDBackend(manager);
|
|
|
|
}
|