Page MenuHomePhabricator

D11513.id27691.diff
No OneTemporary

D11513.id27691.diff

diff --git a/webroot/rsrc/js/core/DragAndDropFileUpload.js b/webroot/rsrc/js/core/DragAndDropFileUpload.js
--- a/webroot/rsrc/js/core/DragAndDropFileUpload.js
+++ b/webroot/rsrc/js/core/DragAndDropFileUpload.js
@@ -168,6 +168,34 @@
}
}));
}
+
+ var inputField, wipeInputField, handleFileSelect;
+
+ handleFileSelect = JX.bind(this, function (evt) {
+ var files = evt.target.files;
+ for (var i = 0; i < files.length; i++) {
+ this._sendRequest(files[i]);
+ }
+
+ wipeInputField();
+ });
+
+ wipeInputField = JX.bind(this, function () {
+ if(inputField) {
+ inputField.parentNode.removeChild(inputField);
+ }
+
+ inputField = document.createElement('input');
+ inputField.setAttribute('type', 'file');
+ inputField.setAttribute('multiple', 'multiple');
+ inputField.setAttribute('id', 'file-upload-input');
+
+ this._node.parentNode.appendChild(inputField);
+ inputField.addEventListener('change', handleFileSelect, false);
+ });
+
+ wipeInputField();
+ JX.DOM.hide(inputField);
},
_sendRequest : function(spec) {
var file = new JX.PhabricatorFileUpload()
diff --git a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
--- a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
+++ b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js
@@ -150,7 +150,7 @@
.start();
break;
case 'fa-cloud-upload':
- new JX.Workflow('/file/uploaddialog/').start();
+ JX.DOM.show(JX.$('file-upload-input'));
break;
case 'fa-arrows-alt':
if (edit_mode == 'fa-arrows-alt') {

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 20, 12:48 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736471
Default Alt Text
D11513.id27691.diff (1 KB)

Event Timeline