diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-06-08 13:40:48 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-06-08 19:15:28 +0200 |
commit | d8251344c1677ee3e6a60695291304c844c66377 (patch) | |
tree | 6f64d374812b013162b3aef0f6d72bc93c2abce7 /apps/files/js/file-upload.js | |
parent | bb64b6f87c18e0b708619758abe28f3cfe8f3f35 (diff) | |
download | nextcloud-server-d8251344c1677ee3e6a60695291304c844c66377.tar.gz nextcloud-server-d8251344c1677ee3e6a60695291304c844c66377.zip |
Use "dropnofiles" callback to disable the drop state in the UI
When a file is dragged from the desktop to the file list the file list
is highlighted, and when the file is finally dropped or the drag
operation is cancelled the highlighting is removed. In some cases, due
to a wrong implementation, a browser may end a file drag with a drop
with no files (for example, when a folder or text is dragged), which
would cause the highlight to not be removed. Now those cases are handled
with the "dropnofiles" callback, which restores the UI and also shows a
message to the user.
The error message is just a generic one, as in some cases it is not even
possible to know whether the problem came from a text drag or a folder
drag, and whether the problem appears or not depends on the browser,
version and even operating system.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r-- | apps/files/js/file-upload.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index dfa460c914a..4244bd673d6 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -1166,6 +1166,16 @@ OC.Uploader.prototype = _.extend({ }); fileupload.on('fileuploaddragleave fileuploaddrop', disableDropState); + // In some browsers the "drop" event can be triggered with no + // files even if the "dragover" event seemed to suggest that a + // file was being dragged (and thus caused "fileuploaddragover" + // to be triggered). + fileupload.on('fileuploaddropnofiles', function() { + disableDropState(); + + OC.Notification.show(t('files', 'Uploading that item is not supported'), {type: 'error'}); + }); + fileupload.on('fileuploadchunksend', function(e, data) { // modify the request to adjust it to our own chunking var upload = self.getUpload(data); |