feat: field based media/public folders (#3208)
This commit is contained in:
@ -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$/)) {
|
||||
|
@ -36,6 +36,7 @@ import {
|
||||
runWithLock,
|
||||
Config as C,
|
||||
UnpublishedEntryMediaFile as UEMF,
|
||||
blobToFileObj,
|
||||
} from './implementation';
|
||||
import {
|
||||
readFile,
|
||||
@ -136,6 +137,7 @@ export const NetlifyCmsLibUtil = {
|
||||
getPointerFileForMediaFileObj,
|
||||
branchFromContentKey,
|
||||
contentKeyFromBranch,
|
||||
blobToFileObj,
|
||||
};
|
||||
export {
|
||||
APIError,
|
||||
@ -186,4 +188,5 @@ export {
|
||||
getPointerFileForMediaFileObj,
|
||||
branchFromContentKey,
|
||||
contentKeyFromBranch,
|
||||
blobToFileObj,
|
||||
};
|
||||
|
Reference in New Issue
Block a user