diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2014-05-30 16:28:20 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2014-05-30 16:28:20 +0200 |
commit | 756b158230cde33dcafa9352009c528caf4cc226 (patch) | |
tree | 9f4fe5c6fc8ab54d917323dbe044e3970ef42bac /apps/files/js | |
parent | 59b1f4c476f72f55585f74d261707e6a4a4bbfb9 (diff) | |
parent | d6e1643a0e448c45f35311c3635125a2c0f39a45 (diff) | |
download | nextcloud-server-756b158230cde33dcafa9352009c528caf4cc226.tar.gz nextcloud-server-756b158230cde33dcafa9352009c528caf4cc226.zip |
Merge pull request #8663 from owncloud/files-dndissue
Fixed drag and drop from external files, added tests
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 68b22207144..1b2a62137e5 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1529,13 +1529,18 @@ fileUploadStart.on('fileuploaddrop', function(e, data) { OC.Upload.log('filelist handle fileuploaddrop', e, data); - var dropTarget = $(e.originalEvent.target).closest('tr, .crumb'); - // check if dropped inside this list at all - if (dropTarget && !self.$el.has(dropTarget).length) { + var dropTarget = $(e.originalEvent.target); + // check if dropped inside this container and not another one + if (dropTarget.length && !self.$el.is(dropTarget) && !self.$el.has(dropTarget).length) { return false; } - if (dropTarget && (dropTarget.data('type') === 'dir' || dropTarget.hasClass('crumb'))) { // drag&drop upload to folder + // find the closest tr or crumb to use as target + dropTarget = dropTarget.closest('tr, .crumb'); + + // if dropping on tr or crumb, drag&drop upload to folder + if (dropTarget && (dropTarget.data('type') === 'dir' || + dropTarget.hasClass('crumb'))) { // remember as context data.context = dropTarget; @@ -1555,7 +1560,7 @@ } // update folder in form - data.formData = function(form) { + data.formData = function() { return [ {name: 'dir', value: dir}, {name: 'requesttoken', value: oc_requesttoken}, @@ -1563,6 +1568,9 @@ ]; }; } else { + // we are dropping somewhere inside the file list, which will + // upload the file to the current directory + // cancel uploads to current dir if no permission var isCreatable = (self.getDirectoryPermissions() & OC.PERMISSION_CREATE) !== 0; if (!isCreatable) { |