feat: field based media/public folders (#3208)

This commit is contained in:
Erez Rokah
2020-02-10 18:05:47 +02:00
committed by GitHub
parent ee7445d49d
commit 97bc0c8dc4
30 changed files with 738 additions and 127 deletions

View File

@ -18,6 +18,7 @@ export interface ImplementationMediaFile {
draft?: boolean;
url?: string;
file?: File;
folder?: string;
}
export interface UnpublishedEntryMediaFile {
@ -264,6 +265,11 @@ export const unpublishedEntries = async (
}
};
export const blobToFileObj = (name: string, blob: Blob) => {
const options = name.match(/.svg$/) ? { type: 'image/svg+xml' } : {};
return new File([blob], name, options);
};
export const getMediaAsBlob = async (path: string, id: string | null, readFile: ReadFile) => {
let blob: Blob;
if (path.match(/.svg$/)) {