Browse Source

Save actual plugin instance instead of plugin.id in this.parent

Artur Paikin 6 years ago
parent
commit
7c19386114

+ 1 - 1
packages/@uppy/core/src/Plugin.js

@@ -139,7 +139,7 @@ module.exports = class Plugin {
 
     if (targetPlugin) {
       this.uppy.log(`Installing ${callerPluginName} to ${targetPlugin.id}`)
-      this.parent = targetPlugin.id
+      this.parent = targetPlugin
       this.el = targetPlugin.addTarget(plugin)
 
       this.onMount()

+ 2 - 3
packages/@uppy/url/src/index.js

@@ -143,9 +143,8 @@ module.exports = class Url extends Plugin {
       .then(() => {
         // 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()
+        // if (this.parent && this.parent.hideAllPanels) {
+        //   this.parent.hideAllPanels()
         // }
       })
       .catch((err) => {

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

@@ -186,9 +186,8 @@ module.exports = class Webcam extends Plugin {
 
       // 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()
+      // if (this.parent && this.parent.hideAllPanels) {
+      //   this.parent.hideAllPanels()
       // }
     }, (error) => {
       this.recordingChunks = null
@@ -249,9 +248,8 @@ module.exports = class Webcam extends Plugin {
       this.captureInProgress = false
       // 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()
+      // if (this.parent && this.parent.hideAllPanels) {
+      //   this.parent.hideAllPanels()
       // }
       try {
         this.uppy.addFile(tagFile)