mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-29 04:50:05 +00:00
Dashboard: emit fileId on both file-edit-start and file-edit-complete events (#2729)
* emit fileId on both file-edit-start and file-edit-complete * update docs * fileId --> fileID * fileID --> file
This commit is contained in:
parent
c7b097cd90
commit
1eff05ede7
4 changed files with 18 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ class FileCard extends Component {
|
|||
}
|
||||
|
||||
handleCancel = () => {
|
||||
this.props.toggleFileCard()
|
||||
this.props.toggleFileCard(false)
|
||||
}
|
||||
|
||||
renderMetaFields = () => {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ module.exports = function Buttons (props) {
|
|||
|
||||
const editAction = () => {
|
||||
if (metaFields && metaFields.length > 0) {
|
||||
toggleFileCard(file.id)
|
||||
toggleFileCard(true, file.id)
|
||||
} else {
|
||||
openFileEditor(file)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -399,16 +399,17 @@ module.exports = class Dashboard extends Plugin {
|
|||
this.setDarkModeCapability(isDarkModeOnNow)
|
||||
}
|
||||
|
||||
toggleFileCard = (fileId) => {
|
||||
if (fileId) {
|
||||
this.uppy.emit('dashboard:file-edit-start')
|
||||
toggleFileCard = (show, fileID) => {
|
||||
const file = this.uppy.getFile(fileID)
|
||||
if (show) {
|
||||
this.uppy.emit('dashboard:file-edit-start', file)
|
||||
} else {
|
||||
this.uppy.emit('dashboard:file-edit-complete')
|
||||
this.uppy.emit('dashboard:file-edit-complete', file)
|
||||
}
|
||||
|
||||
this.setPluginState({
|
||||
fileCardFor: fileId || null,
|
||||
activeOverlayType: fileId ? 'FileCard' : null
|
||||
fileCardFor: show ? fileID : null,
|
||||
activeOverlayType: show ? 'FileCard' : null
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -765,7 +766,7 @@ module.exports = class Dashboard extends Plugin {
|
|||
|
||||
saveFileCard = (meta, fileID) => {
|
||||
this.uppy.setFileMeta(fileID, meta)
|
||||
this.toggleFileCard()
|
||||
this.toggleFileCard(false, fileID)
|
||||
}
|
||||
|
||||
_attachRenderFunctionToTarget = (target) => {
|
||||
|
|
|
|||
|
|
@ -467,8 +467,16 @@ Fired when the Dashboard modal is closed.
|
|||
|
||||
### `dashboard:file-edit-start`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- `file` — The [File Object](https://uppy.io/docs/uppy/#File-Objects) representing the file that was opened for editing.
|
||||
|
||||
Fired when the user clicks “edit” icon next to a file in the Dashboard. The FileCard panel is then open with file metadata available for editing.
|
||||
|
||||
### `dashboard:file-edit-complete`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- `file` — The [File Object](https://uppy.io/docs/uppy/#File-Objects) representing the file that was edited.
|
||||
|
||||
Fired when the user finished editing the file metadata.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue