|
@@ -25,9 +25,11 @@ module.exports = class DragDrop extends Plugin {
|
|
|
// Default options
|
|
|
const defaultOpts = {
|
|
|
target: null,
|
|
|
+ inputName: 'files[]',
|
|
|
+ allowMultipleFiles: true,
|
|
|
width: '100%',
|
|
|
height: '100%',
|
|
|
- note: '',
|
|
|
+ note: null,
|
|
|
locale: defaultLocale
|
|
|
}
|
|
|
|
|
@@ -102,11 +104,15 @@ module.exports = class DragDrop extends Plugin {
|
|
|
}
|
|
|
|
|
|
render (state) {
|
|
|
- const DragDropClass = `uppy uppy-DragDrop-container ${this.isDragDropSupported ? 'is-dragdrop-supported' : ''}`
|
|
|
+ const DragDropClass = `uppy-Root uppy-DragDrop-container ${this.isDragDropSupported ? 'is-dragdrop-supported' : ''}`
|
|
|
const DragDropStyle = {
|
|
|
width: this.opts.width,
|
|
|
height: this.opts.height
|
|
|
}
|
|
|
+
|
|
|
+ // empty value="" on file input, so that the input is cleared after a file is selected,
|
|
|
+ // because Uppy will be handling the upload and so we can select same file
|
|
|
+ // after removing — otherwise browser thinks it’s already selected
|
|
|
return (
|
|
|
<div class={DragDropClass} style={DragDropStyle}>
|
|
|
<div class="uppy-DragDrop-inner">
|
|
@@ -116,12 +122,11 @@ module.exports = class DragDrop extends Plugin {
|
|
|
<label class="uppy-DragDrop-label">
|
|
|
<input class="uppy-DragDrop-input"
|
|
|
type="file"
|
|
|
- name="files[]"
|
|
|
- multiple="true"
|
|
|
- ref={(input) => {
|
|
|
- this.input = input
|
|
|
- }}
|
|
|
- onchange={this.handleInputChange} />
|
|
|
+ name={this.opts.inputName}
|
|
|
+ multiple={this.opts.allowMultipleFiles}
|
|
|
+ ref={(input) => { this.input = input }}
|
|
|
+ onchange={this.handleInputChange}
|
|
|
+ value="" />
|
|
|
{this.i18n('dropHereOr')} <span class="uppy-DragDrop-dragText">{this.i18n('browse')}</span>
|
|
|
</label>
|
|
|
<span class="uppy-DragDrop-note">{this.opts.note}</span>
|