hide edit input if original text and edited are same

This commit is contained in:
Vyrtsev Mikhail
2019-01-17 00:06:04 +03:00
parent 7ba4518587
commit 86fde18b7d
+6 -4
View File
@@ -74,6 +74,11 @@ export default class Input extends Component {
if (!text || !text.trim()) return;
if (text === this.props.value) {
this.props.onCancel && this.props.onCancel();
this.setState({ preview: null, text: '' });
}
this.setState({ isDisabled: true, isErrorShown: false });
const request =
@@ -83,10 +88,7 @@ export default class Input extends Component {
request
.then(comment => {
if (this.props.onSubmit) {
this.props.onSubmit(comment);
}
this.props.onSubmit && this.props.onSubmit(comment);
this.setState({ preview: null, text: '' });
})
.catch(e => {