fix(uploadcare): allow to be Uploadcare to be used in list widget (#1774)

This commit is contained in:
Aleksandr Grenishin 2018-10-24 04:47:53 +03:00 committed by Shawn Erquhart
parent f22c4dbd96
commit deaac3d78b

View File

@ -1,4 +1,5 @@
import { loadScript } from 'netlify-cms-lib-util';
import { Iterable } from 'immutable';
/**
* Default Uploadcare widget configuration, can be overriden via config.yml.
@ -44,7 +45,7 @@ function getFileGroup(files) {
* because the value we're returning may be a promise that we created.
*/
function getFiles(value, cdnBase) {
if (typeof value === 'object') {
if (Array.isArray(value) || Iterable.isIterable(value)) {
const arr = Array.isArray(value) ? value : value.toJS();
return isFileGroup(arr) ? getFileGroup(arr) : arr.map(val => getFile(val, cdnBase));
}