Merge pull request #961 from matrix-org/luke/enter-to-submit-mxid

Allow pressing Enter to submit setMxId
pull/21833/head
Matthew Hodgson 2017-05-30 14:02:23 +01:00 committed by GitHub
commit e2813737cd
1 changed files with 11 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import React from 'react';
import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg';
import classnames from 'classnames';
import KeyCode from '../../../KeyCode';
// The amount of time to wait for further changes to the input username before
// sending a request to the server
@ -91,6 +92,12 @@ export default React.createClass({
});
},
onKeyUp: function(ev) {
if (ev.keyCode === KeyCode.ENTER) {
this.onSubmit();
}
},
onSubmit: function(ev) {
this.setState({
doingUIAuth: true,
@ -233,7 +240,10 @@ export default React.createClass({
<div className="mx_Dialog_content">
<div className="mx_SetMxIdDialog_input_group">
<input type="text" ref="input_value" value={this.state.username}
autoFocus={true} onChange={this.onValueChange} size="30"
autoFocus={true}
onChange={this.onValueChange}
onKeyUp={this.onKeyUp}
size="30"
className={inputClasses}
/>
{ usernameBusyIndicator }