In github comment box, you have the option to drag/drop, paste or select file/images. This plugin lacks the "select" using file input.
I achieved this by directly modifying a dist js (jquery version) by adding the option bindedFileInput. This should trigger the upload when change event occurs on the input element. I'm not that familiar with grunt/npm and don't have the time implement a build so if your kind enough to add this bits of code for me that would be awesome.
/**
* called on bindedFileInput change event occured
* @param {Event} e
* @return {Boolean} if the event was handled
*/
inlineAttachment.prototype.onBindedFileInputChange = function(e) {
var result = false,
files = e.target.files || [];
for (var i = 0; i < files.length; i++) {
var file = files[i];
if (this.isFileAllowed(file)) {
result = true;
this.onFileInserted(file);
this.uploadFile(file);
}
}
if (result) { e.preventDefault(); }
return result;
}
add the option to defaults
/**
* Binded File Input element to trigger uploaded when changed
*/
bindedFileInput: undefined,
In github comment box, you have the option to drag/drop, paste or select file/images. This plugin lacks the "select" using file input.
I achieved this by directly modifying a dist js (jquery version) by adding the option
bindedFileInput
. This should trigger the upload whenchange
event occurs on the input element. I'm not that familiar with grunt/npm and don't have the time implement a build so if your kind enough to add this bits of code for me that would be awesome.init (jquery)
inside class definition
add the option to defaults
great plugin btw.