drop.chapril.org-firefoxsend/app/dragManager.js

18 lines
486 B
JavaScript
Raw Normal View History

export default function(state, emitter) {
emitter.on('DOMContentLoaded', () => {
document.body.addEventListener('dragover', event => {
if (state.route === '/') {
event.preventDefault();
}
});
document.body.addEventListener('drop', event => {
if (state.route === '/' && !state.uploading) {
event.preventDefault();
2018-10-31 19:40:54 +01:00
emitter.emit('addFiles', {
files: Array.from(event.dataTransfer.files)
});
}
});
});
}