Fixes T7685. This required making the global drag and drop behavior able to "uninstall" itself so to speak, and then it re-installs it self as necessary.
Details
- Reviewers
epriestley - Maniphest Tasks
- T7685: Pasting file into Remarkup textarea takes user on wondrous journey to Files application
- Commits
- Restricted Diffusion Commit
rPe40aa8f78249: Quicksand - make things work correctly with global drag and drop upload
Did the following all successfully
- uploaded a file to homepage
- homepage -> differential -- no way to upload via drag and drop
- homepage -> differential -> homepage -- uploaded a file
- homepage -> differential -> browser back button to homepage -- uploaded a file
Diff Detail
- Repository
- rP Phabricator
- Branch
- T7685
- Lint
Lint Passed - Unit
Tests Passed - Build Status
Buildable 5476 Build 5494: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
webroot/rsrc/js/core/behavior-global-drag-and-drop.js | ||
---|---|---|
20–22 | As far as I can tell, this doesn't actually do anything? The data only gets set on the file upload controller and the pertinent div is not hidden to begin with... Safe to kill or did this break or? |
src/applications/files/view/PhabricatorGlobalUploadTargetView.php | ||
---|---|---|
33 | I was getting errors on this being dynamic - differs per page - so I just figured making it a big long unique string would work. |
webroot/rsrc/js/core/behavior-global-drag-and-drop.js | ||
---|---|---|
20–22 | The div is initially hidden for me, at least -- this hides it on my system: PhabricatorFileUploadController.php 40 ->setControlStyle('display: none') That said, it would probably be fine to kill it; every reasonable browser supports this now. | |
94–108 | Another approach would be to just make this do: statics.drop.setEnabled(data.newResponse.globalDragAndDrop); ...and all the listeners in DragAndDropFileUpload just did something like: if (!this.getEnabled()) { return; } I'm not sure if that would actually be any smaller in this case, but it usually seems to end up a bit cleaner than trying to uninstall/reinstall listeners. |