Artur Paikin 4 years ago
parent
commit
32e2e02102

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

@@ -246,17 +246,15 @@ module.exports = class Dashboard extends Plugin {
 
   openFileEditor = (file) => {
     const { targets } = this.getPluginState()
+    const editors = this._getEditors(targets)
 
     this.setPluginState({
       showFileEditor: true,
       activeOverlayType: 'FileEditor'
     })
 
-    const editors = this._getEditors(targets)
     editors.forEach((editor) => {
-      const editorPlugin = this.uppy.getPlugin(editor.id)
-      editorPlugin.selectFile(file)
-      setTimeout(editorPlugin.initEditor, 4)
+      this.uppy.getPlugin(editor.id).selectFile(file)
     })
   }
 

+ 6 - 3
packages/@uppy/image-editor/src/Editor.js

@@ -16,9 +16,12 @@ module.exports = class Editor extends Component {
   }
 
   save = () => {
-    this.cropper.getCroppedCanvas().toBlob((blob) => {
-      this.props.save(blob)
-    }, this.props.currentImage.type, 0.8)
+    this.cropper.getCroppedCanvas()
+      .toBlob(
+        (blob) => this.props.save(blob),
+        this.props.currentImage.type,
+        0.8
+      )
   }
 
   render () {