Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
erquhart committed Dec 4, 2018
1 parent 3362f55 commit a039fa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 4 additions & 5 deletions packages/netlify-cms-media-library-cloudinary/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const defaultOptions = {
use_secure_url: true,
use_transformations: true,
output_filename_only: false,
}
};
/**
* This configuration hash cannot be overriden, as the values here are required
* for the integration to work properly.
Expand Down Expand Up @@ -54,13 +54,12 @@ async function init({ options, handleInsert }) {

await loadScript('https://media-library.cloudinary.com/global/all.js');


const insertHandler = data => {
const assets = data.assets.map(asset => getAssetUrl(asset, resolvedOptions));
handleInsert(cloudinaryConfig.multiple ? assets : assets[0]);
}
};

const mediaLibrary = cloudinary.createMediaLibrary(cloudinaryConfig, { insertHandler });
const mediaLibrary = window.cloudinary.createMediaLibrary(cloudinaryConfig, { insertHandler });

return {
show: ({ config: instanceConfig = {}, allowMultiple }) => {
Expand All @@ -71,7 +70,7 @@ async function init({ options, handleInsert }) {
if (allowMultiple === false) {
instanceConfig.multiple = false;
}
return mediaLibrary.show({ config: instanceConfig });
return mediaLibrary.show({ config: { ...cloudinaryBehaviorConfig, instanceConfig } });
},
hide: () => mediaLibrary.hide(),
enableStandalone: () => true,
Expand Down
9 changes: 5 additions & 4 deletions packages/netlify-cms-widget-file/src/withFileControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ function isMultiple(value) {
return Array.isArray(value) || List.isList(value);
}

const warnDeprecatedOptions = once(field => console.warn(oneLine`
const warnDeprecatedOptions = once(field =>
console.warn(oneLine`
Netlify CMS config: ${field.get('name')} field: property "options" has been deprecated for the
${field.get('widget')} widget and will be removed in the next major release. Rather than
\`field.options.media_library\`, apply media library options for this widget under
\`field.media_library\`.
`));
`),
);

export default function withFileControl({ forImage } = {}) {
return class FileControl extends React.Component {
Expand Down Expand Up @@ -144,7 +146,7 @@ export default function withFileControl({ forImage } = {}) {
* purpose.
*/
if (field.hasIn(['options', 'media_library'])) {
warnDeprecatedOptions(field)
warnDeprecatedOptions(field);
mediaLibraryFieldOptions = field.getIn(['options', 'media_library'], Map());
} else {
mediaLibraryFieldOptions = field.get('media_library', Map());
Expand All @@ -157,7 +159,6 @@ export default function withFileControl({ forImage } = {}) {
value,
allowMultiple: !!mediaLibraryFieldOptions.get('allow_multiple', true),
config: mediaLibraryFieldOptions.get('config'),

});
};

Expand Down

0 comments on commit a039fa2

Please sign in to comment.