1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 22:40:55 +01:00

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
This commit is contained in:
epriestley 2013-04-02 06:45:20 -07:00
parent 0dfcb35377
commit bb5cc76b55
2 changed files with 27 additions and 24 deletions

View file

@ -1253,7 +1253,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-conpherence-menu' => 'javelin-behavior-conpherence-menu' =>
array( array(
'uri' => '/res/35811cd4/rsrc/js/application/conpherence/behavior-menu.js', 'uri' => '/res/08fcd75a/rsrc/js/application/conpherence/behavior-menu.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -2879,7 +2879,7 @@ celerity_register_resource_map(array(
), ),
'phabricator-drag-and-drop-file-upload' => 'phabricator-drag-and-drop-file-upload' =>
array( array(
'uri' => '/res/1daa63d1/rsrc/js/application/core/DragAndDropFileUpload.js', 'uri' => '/res/a4c31f49/rsrc/js/application/core/DragAndDropFileUpload.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -3927,7 +3927,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/8aaacd1b/differential.pkg.css', 'uri' => '/res/pkg/8aaacd1b/differential.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'67ea27d0' => '68d5f4ba' =>
array( array(
'name' => 'differential.pkg.js', 'name' => 'differential.pkg.js',
'symbols' => 'symbols' =>
@ -3953,7 +3953,7 @@ celerity_register_resource_map(array(
18 => 'javelin-behavior-differential-toggle-files', 18 => 'javelin-behavior-differential-toggle-files',
19 => 'javelin-behavior-differential-user-select', 19 => 'javelin-behavior-differential-user-select',
), ),
'uri' => '/res/pkg/67ea27d0/differential.pkg.js', 'uri' => '/res/pkg/68d5f4ba/differential.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'c8ce2d88' => 'c8ce2d88' =>
@ -4050,7 +4050,7 @@ celerity_register_resource_map(array(
'aphront-typeahead-control-css' => '9882678b', 'aphront-typeahead-control-css' => '9882678b',
'differential-changeset-view-css' => '8aaacd1b', 'differential-changeset-view-css' => '8aaacd1b',
'differential-core-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-local-commits-view-css' => '8aaacd1b',
'differential-results-table-css' => '8aaacd1b', 'differential-results-table-css' => '8aaacd1b',
'differential-revision-add-comment-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-dropdown' => 'def4c982',
'javelin-behavior-aphlict-listen' => 'def4c982', 'javelin-behavior-aphlict-listen' => 'def4c982',
'javelin-behavior-aphront-basic-tokenizer' => 'def4c982', 'javelin-behavior-aphront-basic-tokenizer' => 'def4c982',
'javelin-behavior-aphront-drag-and-drop' => '67ea27d0', 'javelin-behavior-aphront-drag-and-drop' => '68d5f4ba',
'javelin-behavior-aphront-drag-and-drop-textarea' => '67ea27d0', 'javelin-behavior-aphront-drag-and-drop-textarea' => '68d5f4ba',
'javelin-behavior-aphront-form-disable-on-submit' => 'def4c982', 'javelin-behavior-aphront-form-disable-on-submit' => 'def4c982',
'javelin-behavior-audit-preview' => 'f96657b8', 'javelin-behavior-audit-preview' => 'f96657b8',
'javelin-behavior-dark-console' => 'dca4a03d', 'javelin-behavior-dark-console' => 'dca4a03d',
'javelin-behavior-device' => 'def4c982', 'javelin-behavior-device' => 'def4c982',
'javelin-behavior-differential-accept-with-errors' => '67ea27d0', 'javelin-behavior-differential-accept-with-errors' => '68d5f4ba',
'javelin-behavior-differential-add-reviewers-and-ccs' => '67ea27d0', 'javelin-behavior-differential-add-reviewers-and-ccs' => '68d5f4ba',
'javelin-behavior-differential-comment-jump' => '67ea27d0', 'javelin-behavior-differential-comment-jump' => '68d5f4ba',
'javelin-behavior-differential-diff-radios' => '67ea27d0', 'javelin-behavior-differential-diff-radios' => '68d5f4ba',
'javelin-behavior-differential-dropdown-menus' => '67ea27d0', 'javelin-behavior-differential-dropdown-menus' => '68d5f4ba',
'javelin-behavior-differential-edit-inline-comments' => '67ea27d0', 'javelin-behavior-differential-edit-inline-comments' => '68d5f4ba',
'javelin-behavior-differential-feedback-preview' => '67ea27d0', 'javelin-behavior-differential-feedback-preview' => '68d5f4ba',
'javelin-behavior-differential-keyboard-navigation' => '67ea27d0', 'javelin-behavior-differential-keyboard-navigation' => '68d5f4ba',
'javelin-behavior-differential-populate' => '67ea27d0', 'javelin-behavior-differential-populate' => '68d5f4ba',
'javelin-behavior-differential-show-more' => '67ea27d0', 'javelin-behavior-differential-show-more' => '68d5f4ba',
'javelin-behavior-differential-toggle-files' => '67ea27d0', 'javelin-behavior-differential-toggle-files' => '68d5f4ba',
'javelin-behavior-differential-user-select' => '67ea27d0', 'javelin-behavior-differential-user-select' => '68d5f4ba',
'javelin-behavior-diffusion-commit-graph' => 'f96657b8', 'javelin-behavior-diffusion-commit-graph' => 'f96657b8',
'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8', 'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8',
'javelin-behavior-error-log' => 'dca4a03d', 'javelin-behavior-error-log' => 'dca4a03d',
@ -4093,7 +4093,7 @@ celerity_register_resource_map(array(
'javelin-behavior-history-install' => 'def4c982', 'javelin-behavior-history-install' => 'def4c982',
'javelin-behavior-konami' => 'def4c982', 'javelin-behavior-konami' => 'def4c982',
'javelin-behavior-lightbox-attachments' => '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-batch-selector' => 'f85eb6d8',
'javelin-behavior-maniphest-subpriority-editor' => 'f85eb6d8', 'javelin-behavior-maniphest-subpriority-editor' => 'f85eb6d8',
'javelin-behavior-maniphest-transaction-controls' => 'f85eb6d8', 'javelin-behavior-maniphest-transaction-controls' => 'f85eb6d8',
@ -4104,7 +4104,7 @@ celerity_register_resource_map(array(
'javelin-behavior-phabricator-gesture' => 'def4c982', 'javelin-behavior-phabricator-gesture' => 'def4c982',
'javelin-behavior-phabricator-keyboard-shortcuts' => 'def4c982', 'javelin-behavior-phabricator-keyboard-shortcuts' => 'def4c982',
'javelin-behavior-phabricator-nav' => '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-oncopy' => 'def4c982',
'javelin-behavior-phabricator-remarkup-assist' => 'def4c982', 'javelin-behavior-phabricator-remarkup-assist' => 'def4c982',
'javelin-behavior-phabricator-reveal-content' => 'def4c982', 'javelin-behavior-phabricator-reveal-content' => 'def4c982',
@ -4112,7 +4112,7 @@ celerity_register_resource_map(array(
'javelin-behavior-phabricator-tooltips' => 'def4c982', 'javelin-behavior-phabricator-tooltips' => 'def4c982',
'javelin-behavior-phabricator-watch-anchor' => 'def4c982', 'javelin-behavior-phabricator-watch-anchor' => 'def4c982',
'javelin-behavior-refresh-csrf' => 'def4c982', 'javelin-behavior-refresh-csrf' => 'def4c982',
'javelin-behavior-repository-crossreference' => '67ea27d0', 'javelin-behavior-repository-crossreference' => '68d5f4ba',
'javelin-behavior-toggle-class' => 'def4c982', 'javelin-behavior-toggle-class' => 'def4c982',
'javelin-behavior-workflow' => 'def4c982', 'javelin-behavior-workflow' => 'def4c982',
'javelin-dom' => 'fe22443b', 'javelin-dom' => 'fe22443b',
@ -4142,7 +4142,7 @@ celerity_register_resource_map(array(
'phabricator-core-css' => '9882678b', 'phabricator-core-css' => '9882678b',
'phabricator-crumbs-view-css' => '9882678b', 'phabricator-crumbs-view-css' => '9882678b',
'phabricator-directory-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-dropdown-menu' => 'def4c982',
'phabricator-file-upload' => 'def4c982', 'phabricator-file-upload' => 'def4c982',
'phabricator-filetree-view-css' => '9882678b', 'phabricator-filetree-view-css' => '9882678b',
@ -4164,7 +4164,7 @@ celerity_register_resource_map(array(
'phabricator-prefab' => 'def4c982', 'phabricator-prefab' => 'def4c982',
'phabricator-project-tag-css' => '6b1fccc6', 'phabricator-project-tag-css' => '6b1fccc6',
'phabricator-remarkup-css' => '9882678b', 'phabricator-remarkup-css' => '9882678b',
'phabricator-shaped-request' => '67ea27d0', 'phabricator-shaped-request' => '68d5f4ba',
'phabricator-side-menu-view-css' => '9882678b', 'phabricator-side-menu-view-css' => '9882678b',
'phabricator-standard-page-view' => '9882678b', 'phabricator-standard-page-view' => '9882678b',
'phabricator-textareautils' => 'def4c982', 'phabricator-textareautils' => 'def4c982',

View file

@ -88,6 +88,9 @@ JX.install('PhabricatorDragAndDropFileUpload', {
'dragover', 'dragover',
null, null,
function(e) { function(e) {
// NOTE: We must set this, or Chrome refuses to drop files from the
// download shelf.
e.getRawEvent().dataTransfer.dropEffect = 'copy';
e.kill(); e.kill();
}); });