PropTypes
} from '@material-ui/core';
import RichTextEditor from 'react-rte';
-import Margin from 'PropTypes';
type CssRules = 'textField' | 'rte';
type TextFieldProps = WrappedFieldProps & WithStyles<CssRules>;
export const TextField = withStyles(styles)((props: TextFieldProps & {
- label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string,
+ label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: PropTypes.Margin, placeholder?: string,
helperText?: string, type?: string,
}) =>
<MaterialTextField
onChange = (value: any) => {
this.setState({ value });
- this.props.input.onChange(value.toString('html'));
+ this.props.input.onChange(
+ !!value.getEditorState().getCurrentContent().getPlainText().trim()
+ ? value.toString('html')
+ : null
+ );
}
render() {