From: Stephen Smith Date: Mon, 27 Feb 2023 17:12:23 +0000 (-0500) Subject: 19930: Check if richtext project description contains text to omit saving empty html... X-Git-Tag: 2.6.0~13^2~2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/a2442ad07740434e1862c22fcbd1e9fd729ed401 19930: Check if richtext project description contains text to omit saving empty html tags Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/src/components/text-field/text-field.tsx b/src/components/text-field/text-field.tsx index 78e2c7fb..b2a8dd48 100644 --- a/src/components/text-field/text-field.tsx +++ b/src/components/text-field/text-field.tsx @@ -72,7 +72,11 @@ export const RichEditorTextField = withStyles(styles)( 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() {