fixes #1013. dragging page elements

This commit is contained in:
Danny Coates 2018-11-19 10:48:52 -08:00
parent c99697caae
commit 74d8a12c07
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
2 changed files with 9 additions and 1 deletions

View File

@ -98,6 +98,9 @@ export default function(state, emitter) {
}); });
emitter.on('addFiles', async ({ files }) => { emitter.on('addFiles', async ({ files }) => {
if (files.length < 1) {
return;
}
const maxSize = state.user.maxSize; const maxSize = state.user.maxSize;
state.archive = state.archive || new Archive(); state.archive = state.archive || new Archive();
try { try {

View File

@ -6,7 +6,12 @@ export default function(state, emitter) {
} }
}); });
document.body.addEventListener('drop', event => { document.body.addEventListener('drop', event => {
if (state.route === '/' && !state.uploading) { if (
state.route === '/' &&
!state.uploading &&
event.dataTransfer &&
event.dataTransfer.files
) {
event.preventDefault(); event.preventDefault();
emitter.emit('addFiles', { emitter.emit('addFiles', {
files: Array.from(event.dataTransfer.files) files: Array.from(event.dataTransfer.files)