Fixed that you can't finish off the name editing by pressing enter
This commit is contained in:
parent
2bd5a843f3
commit
1878c92a57
1 changed files with 2 additions and 2 deletions
|
@ -154,7 +154,7 @@ class ClientNameEdit extends React.Component<ClientNameEditProps, {}> {
|
||||||
ref={this.refDiv}
|
ref={this.refDiv}
|
||||||
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(this.props.initialName)}}
|
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(this.props.initialName)}}
|
||||||
onBlur={() => this.onBlur()}
|
onBlur={() => this.onBlur()}
|
||||||
onKeyPress={e => this.onKeyPress(e)}
|
onKeyDown={e => this.onKeyDown(e)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class ClientNameEdit extends React.Component<ClientNameEditProps, {}> {
|
||||||
this.props.editFinished(this.refDiv.current.textContent);
|
this.props.editFinished(this.refDiv.current.textContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onKeyPress(event: React.KeyboardEvent) {
|
private onKeyDown(event: React.KeyboardEvent) {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.onBlur();
|
this.onBlur();
|
||||||
|
|
Loading…
Add table
Reference in a new issue