|
@@ -42,12 +42,14 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
|
|
|
const defaultOptions = {
|
|
|
target: 'body',
|
|
|
+ getMetaFromForm: true,
|
|
|
inline: false,
|
|
|
width: 750,
|
|
|
height: 550,
|
|
|
semiTransparent: false,
|
|
|
defaultTabIcon: defaultTabIcon(),
|
|
|
showProgressDetails: false,
|
|
|
+ setMetaFromTargetForm: true,
|
|
|
locale: defaultLocale
|
|
|
}
|
|
|
|
|
@@ -88,7 +90,7 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
if (callerPluginType !== 'acquirer' &&
|
|
|
callerPluginType !== 'progressindicator' &&
|
|
|
callerPluginType !== 'presenter') {
|
|
|
- let msg = 'Error: Modal can only be used by plugins of types: acquirer, progressindicator, presenter'
|
|
|
+ let msg = 'Dashboard: Modal can only be used by plugins of types: acquirer, progressindicator, presenter'
|
|
|
this.core.log(msg)
|
|
|
return
|
|
|
}
|
|
@@ -162,9 +164,9 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
|
|
|
this.target.querySelector('.UppyDashboard-inner').focus()
|
|
|
|
|
|
- this.updateDashboardElWidth()
|
|
|
+
|
|
|
|
|
|
- setTimeout(this.updateDashboardElWidth, 300)
|
|
|
+ setTimeout(this.updateDashboardElWidth, 500)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -175,14 +177,14 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
}
|
|
|
|
|
|
initEvents () {
|
|
|
-
|
|
|
-
|
|
|
|
|
|
const showModalTrigger = findDOMElement(this.opts.trigger)
|
|
|
if (!this.opts.inline && showModalTrigger) {
|
|
|
showModalTrigger.addEventListener('click', this.showModal)
|
|
|
- } else {
|
|
|
- this.core.log('Modal trigger wasn’t found')
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!this.opts.inline && !showModalTrigger) {
|
|
|
+ this.core.log('Dashboard modal trigger not found, you won’t be able to select files. Make sure `trigger` is set correctly in Dashboard options', 'error')
|
|
|
}
|
|
|
|
|
|
document.body.addEventListener('keyup', this.handleEscapeKeyPress)
|
|
@@ -223,7 +225,7 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
|
|
|
updateDashboardElWidth () {
|
|
|
const dashboardEl = this.target.querySelector('.UppyDashboard-inner')
|
|
|
-
|
|
|
+ this.core.log(`Dashboard width: ${dashboardEl.offsetWidth}`)
|
|
|
|
|
|
const modal = this.core.getState().modal
|
|
|
this.core.setState({
|
|
@@ -303,9 +305,9 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
return target.type === 'progressindicator'
|
|
|
})
|
|
|
|
|
|
- const addFile = (file) => {
|
|
|
- this.core.emitter.emit('core:file-add', file)
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const removeFile = (fileID) => {
|
|
|
this.core.emitter.emit('core:file-remove', fileID)
|
|
@@ -364,7 +366,7 @@ module.exports = class DashboardUI extends Plugin {
|
|
|
i18n: this.containerWidth,
|
|
|
pauseAll: this.pauseAll,
|
|
|
resumeAll: this.resumeAll,
|
|
|
- addFile: addFile,
|
|
|
+ addFile: this.core.addFile,
|
|
|
removeFile: removeFile,
|
|
|
info: info,
|
|
|
metaFields: state.metaFields,
|