Przeglądaj źródła

add commented parent.hideAllPanels call

in case we need to manually close Dashboard panels, we now have a `this.parent` propety on Plugins, which means we can do `this.uppy.getPlugin(this.parent)` instead of `this.uppy.getPlugin('Dashboard')` — no need to know plugin id, see https://github.com/transloadit/uppy/issues/1057
Artur Paikin 6 lat temu
rodzic
commit
f8020d877b
1 zmienionych plików z 13 dodań i 4 usunięć
  1. 13 4
      packages/@uppy/webcam/src/index.js

+ 13 - 4
packages/@uppy/webcam/src/index.js

@@ -183,8 +183,13 @@ module.exports = class Webcam extends Plugin {
     .then(() => {
     .then(() => {
       this.recordingChunks = null
       this.recordingChunks = null
       this.recorder = null
       this.recorder = null
-      const dashboard = this.uppy.getPlugin('Dashboard')
-      if (dashboard) dashboard.hideAllPanels()
+
+      // Close the Dashboard panel if plugin is installed
+      // into Dashboard (could be other parent UI plugin)
+      // const parent = this.uppy.getPlugin(this.parent)
+      // if (parent && parent.hideAllPanels) {
+      //   parent.hideAllPanels()
+      // }
     }, (error) => {
     }, (error) => {
       this.recordingChunks = null
       this.recordingChunks = null
       this.recorder = null
       this.recorder = null
@@ -242,8 +247,12 @@ module.exports = class Webcam extends Plugin {
       return this.getImage()
       return this.getImage()
     }).then((tagFile) => {
     }).then((tagFile) => {
       this.captureInProgress = false
       this.captureInProgress = false
-      const dashboard = this.uppy.getPlugin('Dashboard')
-      if (dashboard) dashboard.hideAllPanels()
+      // Close the Dashboard panel if plugin is installed
+      // into Dashboard (could be other parent UI plugin)
+      // const parent = this.uppy.getPlugin(this.parent)
+      // if (parent && parent.hideAllPanels) {
+      //   parent.hideAllPanels()
+      // }
       try {
       try {
         this.uppy.addFile(tagFile)
         this.uppy.addFile(tagFile)
       } catch (err) {
       } catch (err) {