diff --git a/packages/firecms_core/src/preview/PropertyPreview.tsx b/packages/firecms_core/src/preview/PropertyPreview.tsx index b5881e7ec..edaee6e6f 100644 --- a/packages/firecms_core/src/preview/PropertyPreview.tsx +++ b/packages/firecms_core/src/preview/PropertyPreview.tsx @@ -87,10 +87,11 @@ export const PropertyPreview = React.memo(function PropertyPreview; } else if (stringProperty.storage) { + const filePath = stringProperty.storage.previewUrl ? stringProperty.storage.previewUrl(value) : value; content = ; + storagePathOrDownloadUrl={filePath}/>; } else if (stringProperty.markdown) { content = ; } else { diff --git a/packages/firecms_core/src/types/properties.ts b/packages/firecms_core/src/types/properties.ts index ed3d77fa0..7e42e75d4 100644 --- a/packages/firecms_core/src/types/properties.ts +++ b/packages/firecms_core/src/types/properties.ts @@ -772,6 +772,11 @@ export type StorageConfig = { */ postProcess?: (pathOrUrl: string) => Promise; + /** + * You can use this prop in order to provide a custom preview URL. + * Useful when the file's path is different from the original field value + */ + previewUrl?: (fileName: string) => string; } /**