Merge pull request #961 from matrix-org/luke/enter-to-submit-mxid
Allow pressing Enter to submit setMxIdpull/21833/head
commit
e2813737cd
|
@ -20,6 +20,7 @@ import React from 'react';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import MatrixClientPeg from '../../../MatrixClientPeg';
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
import KeyCode from '../../../KeyCode';
|
||||||
|
|
||||||
// The amount of time to wait for further changes to the input username before
|
// The amount of time to wait for further changes to the input username before
|
||||||
// sending a request to the server
|
// 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) {
|
onSubmit: function(ev) {
|
||||||
this.setState({
|
this.setState({
|
||||||
doingUIAuth: true,
|
doingUIAuth: true,
|
||||||
|
@ -233,7 +240,10 @@ export default React.createClass({
|
||||||
<div className="mx_Dialog_content">
|
<div className="mx_Dialog_content">
|
||||||
<div className="mx_SetMxIdDialog_input_group">
|
<div className="mx_SetMxIdDialog_input_group">
|
||||||
<input type="text" ref="input_value" value={this.state.username}
|
<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}
|
className={inputClasses}
|
||||||
/>
|
/>
|
||||||
{ usernameBusyIndicator }
|
{ usernameBusyIndicator }
|
||||||
|
|
Loading…
Reference in New Issue