fix: allow widgets to control value to be validated (#3448)
This commit is contained in:
@ -7,6 +7,7 @@ import { once } from 'lodash';
|
||||
import uuid from 'uuid/v4';
|
||||
import { oneLine } from 'common-tags';
|
||||
import { lengths, components, buttons, borders, effects, shadows } from 'netlify-cms-ui-default';
|
||||
import { basename } from 'netlify-cms-lib-util';
|
||||
|
||||
const MAX_DISPLAY_LENGTH = 50;
|
||||
|
||||
@ -175,6 +176,14 @@ export default function withFileControl({ forImage } = {}) {
|
||||
return this.props.onChange('');
|
||||
};
|
||||
|
||||
getValidateValue = () => {
|
||||
if (this.props.value) {
|
||||
return basename(this.props.value);
|
||||
}
|
||||
|
||||
return this.props.value;
|
||||
};
|
||||
|
||||
renderFileLink = value => {
|
||||
const size = MAX_DISPLAY_LENGTH;
|
||||
if (!value || value.length <= size) {
|
||||
|
Reference in New Issue
Block a user