Skip to content

Commit

Permalink
Dashboard: Log warning instead of an error when trigger is not found (#…
Browse files Browse the repository at this point in the history
…2144)

* Log warning instead of an error when trigger is not found

* Only issue warning if opts.trigger is not set
  • Loading branch information
arturi authored Mar 19, 2020
1 parent 3011895 commit 7021657
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/@uppy/dashboard/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,13 +609,13 @@ module.exports = class Dashboard extends Plugin {

initEvents () {
// Modal open button
const showModalTrigger = findAllDOMElements(this.opts.trigger)
if (!this.opts.inline && showModalTrigger) {
showModalTrigger.forEach(trigger => trigger.addEventListener('click', this.openModal))
}

if (!this.opts.inline && !showModalTrigger) {
this.uppy.log('Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options unless you are planning to call openModal() method yourself', 'error')
if (this.opts.trigger && !this.opts.inline) {
const showModalTrigger = findAllDOMElements(this.opts.trigger)
if (showModalTrigger) {
showModalTrigger.forEach(trigger => trigger.addEventListener('click', this.openModal))
} else {
this.uppy.log('Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself', 'warning')
}
}

this.startListeningToResize()
Expand Down

0 comments on commit 7021657

Please sign in to comment.