fix: switching between previewable & non-previewable files (#1021)

This commit is contained in:
Aman Harwara
2022-05-10 21:54:12 +05:30
committed by GitHub
parent 072af12ffe
commit ae1097f207
2 changed files with 8 additions and 2 deletions

View File

@@ -210,10 +210,15 @@ export const AttachedFilesButton: FunctionComponent<Props> = observer(
case PopoverFileItemActionType.RenameFile: case PopoverFileItemActionType.RenameFile:
await renameFile(file, action.payload.name) await renameFile(file, action.payload.name)
break break
case PopoverFileItemActionType.PreviewFile: case PopoverFileItemActionType.PreviewFile: {
keepMenuOpen(true) keepMenuOpen(true)
appState.filePreviewModal.activate(file, currentTab === PopoverTabs.AllFiles ? allFiles : attachedFiles) const otherFiles = currentTab === PopoverTabs.AllFiles ? allFiles : attachedFiles
appState.filePreviewModal.activate(
file,
otherFiles.filter((file) => !file.protected),
)
break break
}
} }
if ( if (

View File

@@ -69,6 +69,7 @@ export const FilePreviewModal: FunctionComponent<Props> = observer(({ applicatio
setIsFilePreviewable(isPreviewable) setIsFilePreviewable(isPreviewable)
if (!isPreviewable) { if (!isPreviewable) {
setObjectUrl('')
setIsLoadingFile(false) setIsLoadingFile(false)
} }