fix(widget-image): multiple image support (#3538)

This commit is contained in:
Erez Rokah 2020-04-05 12:33:54 +03:00 committed by GitHub
parent afb2f72ea5
commit 76732f7208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,7 +94,11 @@ export default function withFileControl({ forImage } = {}) {
onClearMediaControl: PropTypes.func.isRequired,
onRemoveMediaControl: PropTypes.func.isRequired,
classNameWrapper: PropTypes.string.isRequired,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string),
ImmutablePropTypes.listOf(PropTypes.string),
]),
t: PropTypes.func.isRequired,
};
@ -177,11 +181,12 @@ export default function withFileControl({ forImage } = {}) {
};
getValidateValue = () => {
if (this.props.value) {
return basename(this.props.value);
const { value } = this.props;
if (value) {
return isMultiple(value) ? value.map(v => basename(v)) : basename(value);
}
return this.props.value;
return value;
};
renderFileLink = value => {