Fix ctm enter key press bug

This commit is contained in:
cyril lopez 2017-11-10 18:14:18 +01:00
parent 2418686b7b
commit be14886b79

View File

@ -107,8 +107,6 @@ export class Edit extends React.Component {
} else {
this.props.loadRecord(this.props.match.params.id);
}
document.addEventListener('keydown', this.handleSubmitOnEnterPress);
}
componentWillReceiveProps(nextProps) {
@ -123,9 +121,9 @@ export class Edit extends React.Component {
}
componentWillUnmount() {
document.removeEventListener('keydown', this.handleSubmitOnEnterPress);
this.props.recordEdited();
this.props.resetEditSuccess();
this.props.setInitialState();
}
handleChange = (e) => {
@ -153,12 +151,6 @@ export class Edit extends React.Component {
}
}
handleSubmitOnEnterPress = (e) => {
if (e.keyCode === 13) {
this.handleSubmit(e);
}
}
render() {
if (this.props.loading || !this.props.schema || !this.props.currentModelName) {
return <p>Loading...</p>;