feat: Added "Open" button to file upload success notification (#2091)

This commit is contained in:
Aman Harwara
2022-12-09 00:58:32 +05:30
committed by GitHub
parent 1dc9086257
commit 220f62665e
3 changed files with 18 additions and 3 deletions

View File

@@ -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
}

View File

@@ -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