Fixed that you can't finish off the name editing by pressing enter

master
WolverinDEV 2021-03-30 00:23:01 +02:00
parent 2bd5a843f3
commit 1878c92a57
1 changed files with 2 additions and 2 deletions

View File

@ -154,7 +154,7 @@ class ClientNameEdit extends React.Component<ClientNameEditProps, {}> {
ref={this.refDiv}
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(this.props.initialName)}}
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);
}
private onKeyPress(event: React.KeyboardEvent) {
private onKeyDown(event: React.KeyboardEvent) {
if (event.key === "Enter") {
event.preventDefault();
this.onBlur();