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

@ -113,8 +113,10 @@ async function init({ options = { config: {} }, handleInsert }) {
* On show, create a new widget, cache it in the widgets object, and open.
* No hide method is provided because the widget doesn't provide it.
*/
show: ({ value, config: instanceConfig = {}, imagesOnly }) => {
show: ({ value, config: instanceConfig = {}, allowMultiple, imagesOnly }) => {
const config = { ...baseConfig, imagesOnly, ...instanceConfig };
const multiple = allowMultiple === false ? false : !!config.multiple;
const resolvedConfig = { ...config, multiple };
const files = getFiles(value);
/**
@ -122,9 +124,9 @@ async function init({ options = { config: {} }, handleInsert }) {
* from the Uploadcare library will have a `state` method.
*/
if (files && !files.state) {
files.then(result => openDialog(result, config, handleInsert));
files.then(result => openDialog(result, resolvedConfig, handleInsert));
} else {
openDialog(files, config, handleInsert);
openDialog(files, resolvedConfig, handleInsert);
}
},