2021-12-31, 02:02 PM
The only one that actually handles the drag and drop upload is this:
The rest don't actually handle anything with the upload, but if you wanted to remove the functionality you'd need to remove all the bindings other than click (basically all the drag ones) so it doesn't update the UI when you try and drag.
I was looking into it, and the issue is this:
A callback is bound to the change event:
So on change, it should run the addAttachments function. In Chrome is runs it once, but in Safari it runs it twice.
[attachment=44774][attachment=44775]
If I remove the line that manually triggers the change, it doesn't run addAttachments at all. So I'm not sure why it would be triggering the change event twice in Safari.
Post.dropZone.on('drop', function (e) {
e.preventDefault();
$(this).removeClass('activated');
var files = e.originalEvent.dataTransfer.files;
Post.fileInput.prop('files', files).trigger('change');
});
The rest don't actually handle anything with the upload, but if you wanted to remove the functionality you'd need to remove all the bindings other than click (basically all the drag ones) so it doesn't update the UI when you try and drag.
I was looking into it, and the issue is this:
Post.fileInput.prop('files', files).trigger('change');
A callback is bound to the change event:
Post.fileInput.on('change', Post.addAttachments);
So on change, it should run the addAttachments function. In Chrome is runs it once, but in Safari it runs it twice.
[attachment=44774][attachment=44775]
If I remove the line that manually triggers the change, it doesn't run addAttachments at all. So I'm not sure why it would be triggering the change event twice in Safari.