ソースを参照

Save meta fields when opening the image editor (#3339)

Merlijn Vos 3 年 前
コミット
6b9d6dd423
1 ファイル変更8 行追加1 行削除
  1. 8 1
      packages/@uppy/dashboard/src/components/FileCard/index.js

+ 8 - 1
packages/@uppy/dashboard/src/components/FileCard/index.js

@@ -152,7 +152,14 @@ class FileCard extends Component {
               <button
                 type="button"
                 className="uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit"
-                onClick={() => this.props.openFileEditor(file)}
+                onClick={(event) => {
+                  // When opening the image editor we want to save any meta fields changes.
+                  // Otherwise it's confusing for the user to click save in the editor,
+                  // but the changes here are discarded. This bypasses validation,
+                  // but we are okay with that.
+                  this.handleSave(event)
+                  this.props.openFileEditor(file)
+                }}
                 form={this.form.id}
               >
                 {this.props.i18n('editFile')}