feat: add cloudinary support (#1932)

This commit is contained in:
Shawn Erquhart
2018-12-04 17:04:52 -05:00
committed by GitHub
parent 9662eb292f
commit 1fc2f50499
15 changed files with 281 additions and 17 deletions

View File

@ -63,8 +63,8 @@ export function openMediaLibrary(payload = {}) {
const state = getState();
const mediaLibrary = state.mediaLibrary.get('externalLibrary');
if (mediaLibrary) {
const { controlID: id, value, config = Map(), forImage } = payload;
mediaLibrary.show({ id, value, config: config.toJS(), imagesOnly: forImage });
const { controlID: id, value, config = Map(), allowMultiple, forImage } = payload;
mediaLibrary.show({ id, value, config: config.toJS(), allowMultiple, imagesOnly: forImage });
}
dispatch({ type: MEDIA_LIBRARY_OPEN, payload });
};

View File

@ -56,5 +56,12 @@ export const selectUnpublishedEntriesByStatus = (state, status) =>
export const selectIntegration = (state, collection, hook) =>
fromIntegrations.selectIntegration(state.integrations, collection, hook);
export const getAsset = (state, path) =>
fromMedias.getAsset(state.config.get('public_folder'), state.medias, path);
export const getAsset = (state, path) => {
/**
* If an external media library is in use, just return the path.
*/
if (state.mediaLibrary.get('externalLibrary')) {
return path;
}
return fromMedias.getAsset(state.config.get('public_folder'), state.medias, path);
};