|
@@ -1,18 +1,19 @@
|
|
-import Plugin from './Plugin'
|
|
|
|
-import { toArray } from '../core/Utils'
|
|
|
|
|
|
+import Plugin from './../Plugin'
|
|
|
|
+import { toArray } from '../../core/Utils'
|
|
import dragDrop from 'drag-drop'
|
|
import dragDrop from 'drag-drop'
|
|
-import html from '../core/html'
|
|
|
|
|
|
+import html from '../../core/html'
|
|
|
|
|
|
/**
|
|
/**
|
|
* Drag & Drop plugin
|
|
* Drag & Drop plugin
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
export default class DragDrop extends Plugin {
|
|
export default class DragDrop extends Plugin {
|
|
- constructor (core, opts) {
|
|
|
|
|
|
+ constructor (core, opts, props) {
|
|
super(core, opts)
|
|
super(core, opts)
|
|
this.type = 'acquirer'
|
|
this.type = 'acquirer'
|
|
this.id = 'DragDrop'
|
|
this.id = 'DragDrop'
|
|
this.title = 'Drag & Drop'
|
|
this.title = 'Drag & Drop'
|
|
|
|
+ this.props = props
|
|
this.icon = html`
|
|
this.icon = html`
|
|
<svg class="UppyIcon" width="28" height="28" viewBox="0 0 16 16">
|
|
<svg class="UppyIcon" width="28" height="28" viewBox="0 0 16 16">
|
|
<path d="M15.982 2.97c0-.02 0-.02-.018-.037 0-.017-.017-.035-.035-.053 0 0 0-.018-.02-.018-.017-.018-.034-.053-.052-.07L13.19.123c-.017-.017-.034-.035-.07-.053h-.018c-.018-.017-.035-.017-.053-.034h-.02c-.017 0-.034-.018-.052-.018h-6.31a.415.415 0 0 0-.446.426V11.11c0 .25.196.446.445.446h8.89A.44.44 0 0 0 16 11.11V3.023c-.018-.018-.018-.035-.018-.053zm-2.65-1.46l1.157 1.157h-1.157V1.51zm1.78 9.157h-8V.89h5.332v2.22c0 .25.196.446.445.446h2.22v7.11z"/>
|
|
<path d="M15.982 2.97c0-.02 0-.02-.018-.037 0-.017-.017-.035-.035-.053 0 0 0-.018-.02-.018-.017-.018-.034-.053-.052-.07L13.19.123c-.017-.017-.034-.035-.07-.053h-.018c-.018-.017-.035-.017-.053-.034h-.02c-.017 0-.034-.018-.052-.018h-6.31a.415.415 0 0 0-.446.426V11.11c0 .25.196.446.445.446h8.89A.44.44 0 0 0 16 11.11V3.023c-.018-.018-.018-.035-.018-.053zm-2.65-1.46l1.157 1.157h-1.157V1.51zm1.78 9.157h-8V.89h5.332v2.22c0 .25.196.446.445.446h2.22v7.11z"/>
|
|
@@ -64,18 +65,19 @@ export default class DragDrop extends Plugin {
|
|
handleDrop (files) {
|
|
handleDrop (files) {
|
|
this.core.log('All right, someone dropped something...')
|
|
this.core.log('All right, someone dropped something...')
|
|
|
|
|
|
- // this.core.emitter.emit('file-add', {
|
|
|
|
- // plugin: this,
|
|
|
|
- // acquiredFiles: files
|
|
|
|
- // })
|
|
|
|
-
|
|
|
|
files.forEach((file) => {
|
|
files.forEach((file) => {
|
|
- this.core.emitter.emit('file-add', {
|
|
|
|
|
|
+ this.props.addFile({
|
|
source: this.id,
|
|
source: this.id,
|
|
name: file.name,
|
|
name: file.name,
|
|
type: file.type,
|
|
type: file.type,
|
|
data: file
|
|
data: file
|
|
})
|
|
})
|
|
|
|
+ // this.core.emitter.emit('file-add', {
|
|
|
|
+ // source: this.id,
|
|
|
|
+ // name: file.name,
|
|
|
|
+ // type: file.type,
|
|
|
|
+ // data: file
|
|
|
|
+ // })
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -138,7 +140,7 @@ export default class DragDrop extends Plugin {
|
|
<strong>${this.core.i18n('chooseFile')}</strong>
|
|
<strong>${this.core.i18n('chooseFile')}</strong>
|
|
<span class="UppyDragDrop-dragText">${this.core.i18n('orDragDrop')}</span>
|
|
<span class="UppyDragDrop-dragText">${this.core.i18n('orDragDrop')}</span>
|
|
</label>
|
|
</label>
|
|
- ${!this.core.opts.autoProceed && target !== 'Modal'
|
|
|
|
|
|
+ ${!this.core.opts.autoProceed && target !== 'Dashboard'
|
|
? html`<button class="UppyDragDrop-uploadBtn UppyNextBtn"
|
|
? html`<button class="UppyDragDrop-uploadBtn UppyNextBtn"
|
|
type="submit"
|
|
type="submit"
|
|
onclick=${next}>
|
|
onclick=${next}>
|