Selaa lähdekoodia

call `hideAllPanels` on `file-added`

I believe this was removed because we were doing `addFile` right away when it was selected in `Providers`, which is not the case now, so safe to close Dashboard panels when a file is added.
Artur Paikin 6 vuotta sitten
vanhempi
commit
06eda75be4
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 7 2
      packages/@uppy/dashboard/src/index.js

+ 7 - 2
packages/@uppy/dashboard/src/index.js

@@ -456,7 +456,10 @@ module.exports = class Dashboard extends Plugin {
     this.ro.observe(this.el.querySelector('.uppy-Dashboard-inner'))
     this.ro.observe(this.el.querySelector('.uppy-Dashboard-inner'))
 
 
     this.uppy.on('plugin-remove', this.removeTarget)
     this.uppy.on('plugin-remove', this.removeTarget)
-    this.uppy.on('file-added', (ev) => this.toggleAddFilesPanel(false))
+    this.uppy.on('file-added', (ev) => {
+      this.toggleAddFilesPanel(false)
+      this.hideAllPanels()
+    })
   }
   }
 
 
   removeEvents () {
   removeEvents () {
@@ -658,7 +661,9 @@ module.exports = class Dashboard extends Plugin {
     const plugins = this.opts.plugins || []
     const plugins = this.opts.plugins || []
     plugins.forEach((pluginID) => {
     plugins.forEach((pluginID) => {
       const plugin = this.uppy.getPlugin(pluginID)
       const plugin = this.uppy.getPlugin(pluginID)
-      if (plugin) plugin.mount(this, plugin)
+      if (plugin) {
+        plugin.mount(this, plugin)
+      }
     })
     })
 
 
     if (!this.opts.disableStatusBar) {
     if (!this.opts.disableStatusBar) {