insomnia/packages/insomnia-app/app/ui/dnd-backend.js

39 lines
856 B
JavaScript
Raw Normal View History

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