Merge pull request #12282 from PhMemmel/waiting-room-message-area-improvement

Waiting room panel: Hitting enter sends message
This commit is contained in:
Anton Georgiev 2021-05-05 08:49:28 -04:00 committed by GitHub
commit 2fce6e3897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,13 @@ class TextInput extends PureComponent {
this.setState({ message });
}
handleOnKeyDown(e) {
if (e.keyCode === 13 && e.shiftKey === false) {
e.preventDefault();
this.handleOnClick();
}
}
handleOnClick() {
const { send } = this.props;
const { message } = this.state;
@ -58,6 +65,7 @@ class TextInput extends PureComponent {
className={styles.textarea}
maxLength={maxLength}
onChange={(e) => this.handleOnChange(e)}
onKeyDown={(e) => this.handleOnKeyDown(e)}
placeholder={placeholder}
value={message}
/>