From bb5cc76b55b21bf9ddc53344f0273dcc4f58eb40 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 2 Apr 2013 06:45:20 -0700 Subject: [PATCH] Allow drag-and-drop uploads from Chrome download shelf Summary: Fixes T2811. Chrome requires this, but only for files dragged from the download shelf, I guess? Not entirely sure what's going on here. I couldn't find much documentation on this and figured it out mostly by process of elimination. Test Plan: Drag and drop still works everywhere, plus from the Chrome download shelf. Reviewers: blc, btrahan, skrul Reviewed By: skrul CC: aran Maniphest Tasks: T2811 Differential Revision: https://secure.phabricator.com/D5528 --- src/__celerity_resource_map__.php | 48 +++++++++---------- .../application/core/DragAndDropFileUpload.js | 3 ++ 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index f2cb99be7f..2e5e8b0648 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1253,7 +1253,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-conpherence-menu' => array( - 'uri' => '/res/35811cd4/rsrc/js/application/conpherence/behavior-menu.js', + 'uri' => '/res/08fcd75a/rsrc/js/application/conpherence/behavior-menu.js', 'type' => 'js', 'requires' => array( @@ -2879,7 +2879,7 @@ celerity_register_resource_map(array( ), 'phabricator-drag-and-drop-file-upload' => array( - 'uri' => '/res/1daa63d1/rsrc/js/application/core/DragAndDropFileUpload.js', + 'uri' => '/res/a4c31f49/rsrc/js/application/core/DragAndDropFileUpload.js', 'type' => 'js', 'requires' => array( @@ -3927,7 +3927,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/8aaacd1b/differential.pkg.css', 'type' => 'css', ), - '67ea27d0' => + '68d5f4ba' => array( 'name' => 'differential.pkg.js', 'symbols' => @@ -3953,7 +3953,7 @@ celerity_register_resource_map(array( 18 => 'javelin-behavior-differential-toggle-files', 19 => 'javelin-behavior-differential-user-select', ), - 'uri' => '/res/pkg/67ea27d0/differential.pkg.js', + 'uri' => '/res/pkg/68d5f4ba/differential.pkg.js', 'type' => 'js', ), 'c8ce2d88' => @@ -4050,7 +4050,7 @@ celerity_register_resource_map(array( 'aphront-typeahead-control-css' => '9882678b', 'differential-changeset-view-css' => '8aaacd1b', 'differential-core-view-css' => '8aaacd1b', - 'differential-inline-comment-editor' => '67ea27d0', + 'differential-inline-comment-editor' => '68d5f4ba', 'differential-local-commits-view-css' => '8aaacd1b', 'differential-results-table-css' => '8aaacd1b', 'differential-revision-add-comment-css' => '8aaacd1b', @@ -4068,24 +4068,24 @@ celerity_register_resource_map(array( 'javelin-behavior-aphlict-dropdown' => 'def4c982', 'javelin-behavior-aphlict-listen' => 'def4c982', 'javelin-behavior-aphront-basic-tokenizer' => 'def4c982', - 'javelin-behavior-aphront-drag-and-drop' => '67ea27d0', - 'javelin-behavior-aphront-drag-and-drop-textarea' => '67ea27d0', + 'javelin-behavior-aphront-drag-and-drop' => '68d5f4ba', + 'javelin-behavior-aphront-drag-and-drop-textarea' => '68d5f4ba', 'javelin-behavior-aphront-form-disable-on-submit' => 'def4c982', 'javelin-behavior-audit-preview' => 'f96657b8', 'javelin-behavior-dark-console' => 'dca4a03d', 'javelin-behavior-device' => 'def4c982', - 'javelin-behavior-differential-accept-with-errors' => '67ea27d0', - 'javelin-behavior-differential-add-reviewers-and-ccs' => '67ea27d0', - 'javelin-behavior-differential-comment-jump' => '67ea27d0', - 'javelin-behavior-differential-diff-radios' => '67ea27d0', - 'javelin-behavior-differential-dropdown-menus' => '67ea27d0', - 'javelin-behavior-differential-edit-inline-comments' => '67ea27d0', - 'javelin-behavior-differential-feedback-preview' => '67ea27d0', - 'javelin-behavior-differential-keyboard-navigation' => '67ea27d0', - 'javelin-behavior-differential-populate' => '67ea27d0', - 'javelin-behavior-differential-show-more' => '67ea27d0', - 'javelin-behavior-differential-toggle-files' => '67ea27d0', - 'javelin-behavior-differential-user-select' => '67ea27d0', + 'javelin-behavior-differential-accept-with-errors' => '68d5f4ba', + 'javelin-behavior-differential-add-reviewers-and-ccs' => '68d5f4ba', + 'javelin-behavior-differential-comment-jump' => '68d5f4ba', + 'javelin-behavior-differential-diff-radios' => '68d5f4ba', + 'javelin-behavior-differential-dropdown-menus' => '68d5f4ba', + 'javelin-behavior-differential-edit-inline-comments' => '68d5f4ba', + 'javelin-behavior-differential-feedback-preview' => '68d5f4ba', + 'javelin-behavior-differential-keyboard-navigation' => '68d5f4ba', + 'javelin-behavior-differential-populate' => '68d5f4ba', + 'javelin-behavior-differential-show-more' => '68d5f4ba', + 'javelin-behavior-differential-toggle-files' => '68d5f4ba', + 'javelin-behavior-differential-user-select' => '68d5f4ba', 'javelin-behavior-diffusion-commit-graph' => 'f96657b8', 'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8', 'javelin-behavior-error-log' => 'dca4a03d', @@ -4093,7 +4093,7 @@ celerity_register_resource_map(array( 'javelin-behavior-history-install' => 'def4c982', 'javelin-behavior-konami' => 'def4c982', 'javelin-behavior-lightbox-attachments' => 'def4c982', - 'javelin-behavior-load-blame' => '67ea27d0', + 'javelin-behavior-load-blame' => '68d5f4ba', 'javelin-behavior-maniphest-batch-selector' => 'f85eb6d8', 'javelin-behavior-maniphest-subpriority-editor' => 'f85eb6d8', 'javelin-behavior-maniphest-transaction-controls' => 'f85eb6d8', @@ -4104,7 +4104,7 @@ celerity_register_resource_map(array( 'javelin-behavior-phabricator-gesture' => 'def4c982', 'javelin-behavior-phabricator-keyboard-shortcuts' => 'def4c982', 'javelin-behavior-phabricator-nav' => 'def4c982', - 'javelin-behavior-phabricator-object-selector' => '67ea27d0', + 'javelin-behavior-phabricator-object-selector' => '68d5f4ba', 'javelin-behavior-phabricator-oncopy' => 'def4c982', 'javelin-behavior-phabricator-remarkup-assist' => 'def4c982', 'javelin-behavior-phabricator-reveal-content' => 'def4c982', @@ -4112,7 +4112,7 @@ celerity_register_resource_map(array( 'javelin-behavior-phabricator-tooltips' => 'def4c982', 'javelin-behavior-phabricator-watch-anchor' => 'def4c982', 'javelin-behavior-refresh-csrf' => 'def4c982', - 'javelin-behavior-repository-crossreference' => '67ea27d0', + 'javelin-behavior-repository-crossreference' => '68d5f4ba', 'javelin-behavior-toggle-class' => 'def4c982', 'javelin-behavior-workflow' => 'def4c982', 'javelin-dom' => 'fe22443b', @@ -4142,7 +4142,7 @@ celerity_register_resource_map(array( 'phabricator-core-css' => '9882678b', 'phabricator-crumbs-view-css' => '9882678b', 'phabricator-directory-css' => '9882678b', - 'phabricator-drag-and-drop-file-upload' => '67ea27d0', + 'phabricator-drag-and-drop-file-upload' => '68d5f4ba', 'phabricator-dropdown-menu' => 'def4c982', 'phabricator-file-upload' => 'def4c982', 'phabricator-filetree-view-css' => '9882678b', @@ -4164,7 +4164,7 @@ celerity_register_resource_map(array( 'phabricator-prefab' => 'def4c982', 'phabricator-project-tag-css' => '6b1fccc6', 'phabricator-remarkup-css' => '9882678b', - 'phabricator-shaped-request' => '67ea27d0', + 'phabricator-shaped-request' => '68d5f4ba', 'phabricator-side-menu-view-css' => '9882678b', 'phabricator-standard-page-view' => '9882678b', 'phabricator-textareautils' => 'def4c982', diff --git a/webroot/rsrc/js/application/core/DragAndDropFileUpload.js b/webroot/rsrc/js/application/core/DragAndDropFileUpload.js index 9141aa22be..316b801def 100644 --- a/webroot/rsrc/js/application/core/DragAndDropFileUpload.js +++ b/webroot/rsrc/js/application/core/DragAndDropFileUpload.js @@ -88,6 +88,9 @@ JX.install('PhabricatorDragAndDropFileUpload', { 'dragover', null, function(e) { + // NOTE: We must set this, or Chrome refuses to drop files from the + // download shelf. + e.getRawEvent().dataTransfer.dropEffect = 'copy'; e.kill(); });