feat: Added "Open" button to file upload success notification (#2091)
This commit is contained in:
@@ -40,6 +40,6 @@ export type PopoverFileItemAction =
|
||||
type: PopoverFileItemActionType.PreviewFile
|
||||
payload: {
|
||||
file: FileItem
|
||||
otherFiles: FileItem[]
|
||||
otherFiles?: FileItem[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ export class FilePreviewModalController {
|
||||
this.currentFile = currentFile
|
||||
}
|
||||
|
||||
activate = (currentFile: FileItem, otherFiles: FileItem[]) => {
|
||||
activate = (currentFile: FileItem, otherFiles?: FileItem[]) => {
|
||||
this.currentFile = currentFile
|
||||
this.otherFiles = otherFiles
|
||||
if (otherFiles) {
|
||||
this.otherFiles = otherFiles
|
||||
}
|
||||
this.isOpen = true
|
||||
}
|
||||
|
||||
|
||||
@@ -421,6 +421,19 @@ export class FilesController extends AbstractViewController<FilesControllerEvent
|
||||
addToast({
|
||||
type: ToastType.Success,
|
||||
message: `Uploaded file "${uploadedFile.name}"`,
|
||||
actions: [
|
||||
{
|
||||
label: 'Open',
|
||||
handler: (toastId) => {
|
||||
void this.handleFileAction({
|
||||
type: PopoverFileItemActionType.PreviewFile,
|
||||
payload: { file: uploadedFile },
|
||||
})
|
||||
dismissToast(toastId)
|
||||
},
|
||||
},
|
||||
],
|
||||
autoClose: true,
|
||||
})
|
||||
|
||||
return uploadedFile
|
||||
|
||||
Reference in New Issue
Block a user