This commit is contained in:
or-else
2018-12-01 15:51:21 +03:00
parent 4f70de3aa9
commit 00eeb2503a
7 changed files with 32 additions and 14 deletions
+6 -1
View File
@@ -54,7 +54,12 @@ export default class InPlaceEdit extends React.Component {
}
}
handleEditingFinished() {
handleEditingFinished(event) {
if (this.props.required && !event.target.checkValidity()) {
// Empty input
this.setState({value: this.props.value, active: false});
return;
}
this.setState({active: false});
let value = this.state.value.trim();
if ((value || this.props.value) && (value !== this.props.value)) {