Merge pull request #3224 from matrix-org/bwindels/focus-composer-on-type
Focus composer when typing anywhere in the app
This commit is contained in:
commit
4fa7302f69
8 changed files with 57 additions and 29 deletions
|
@ -48,7 +48,7 @@ class MenuOption extends React.Component {
|
|||
});
|
||||
|
||||
return <div className={optClasses}
|
||||
onClick={this._onClick} onKeyPress={this._onKeyPress}
|
||||
onClick={this._onClick}
|
||||
onMouseEnter={this._onMouseEnter}
|
||||
>
|
||||
{ this.props.children }
|
||||
|
|
|
@ -222,7 +222,6 @@ export default class MessageEditor extends React.Component {
|
|||
dis.dispatch({action: 'edit_event', event: nextEvent});
|
||||
} else {
|
||||
dis.dispatch({action: 'edit_event', event: null});
|
||||
dis.dispatch({action: 'focus_composer'});
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
|
@ -230,7 +229,6 @@ export default class MessageEditor extends React.Component {
|
|||
|
||||
_cancelEdit = () => {
|
||||
dis.dispatch({action: "edit_event", event: null});
|
||||
dis.dispatch({action: 'focus_composer'});
|
||||
}
|
||||
|
||||
_hasModifications(newContent) {
|
||||
|
@ -257,7 +255,6 @@ export default class MessageEditor extends React.Component {
|
|||
this.context.matrixClient.sendMessage(roomId, editContent);
|
||||
|
||||
dis.dispatch({action: "edit_event", event: null});
|
||||
dis.dispatch({action: 'focus_composer'});
|
||||
}
|
||||
|
||||
_cancelPreviousPendingEdit() {
|
||||
|
|
|
@ -113,7 +113,7 @@ module.exports = React.createClass({
|
|||
this.props.onChange(parseInt(this.state.customValue), this.props.powerLevelKey);
|
||||
},
|
||||
|
||||
onCustomKeyPress: function(event) {
|
||||
onCustomKeyDown: function(event) {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -133,7 +133,7 @@ module.exports = React.createClass({
|
|||
picker = (
|
||||
<Field id={`powerSelector_custom_${this.props.powerLevelKey}`} type="number"
|
||||
label={this.props.label || _t("Power level")} max={this.props.maxValue}
|
||||
onBlur={this.onCustomBlur} onKeyPress={this.onCustomKeyPress} onChange={this.onCustomChange}
|
||||
onBlur={this.onCustomBlur} onKeyDown={this.onCustomKeyDown} onChange={this.onCustomChange}
|
||||
value={String(this.state.customValue)} disabled={this.props.disabled} />
|
||||
);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue