mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-24 03:43:42 +01:00
Merge pull request #396 from ticky/fix-cmd-enter
Fix Command-enter tooting
This commit is contained in:
commit
52850c51db
2 changed files with 10 additions and 3 deletions
|
@ -38,7 +38,8 @@ const AutosuggestTextarea = React.createClass({
|
|||
onSuggestionsClearRequested: React.PropTypes.func.isRequired,
|
||||
onSuggestionsFetchRequested: React.PropTypes.func.isRequired,
|
||||
onChange: React.PropTypes.func.isRequired,
|
||||
onKeyUp: React.PropTypes.func
|
||||
onKeyUp: React.PropTypes.func,
|
||||
onKeyDown: React.PropTypes.func
|
||||
},
|
||||
|
||||
getInitialState () {
|
||||
|
@ -108,6 +109,12 @@ const AutosuggestTextarea = React.createClass({
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
if (e.defaultPrevented || !this.props.onKeyDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onKeyDown(e);
|
||||
},
|
||||
|
||||
onBlur () {
|
||||
|
|
|
@ -49,7 +49,7 @@ const ComposeForm = React.createClass({
|
|||
this.props.onChange(e.target.value);
|
||||
},
|
||||
|
||||
handleKeyUp (e) {
|
||||
handleKeyDown (e) {
|
||||
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
|
||||
this.props.onSubmit();
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ const ComposeForm = React.createClass({
|
|||
value={this.props.text}
|
||||
onChange={this.handleChange}
|
||||
suggestions={this.props.suggestions}
|
||||
onKeyUp={this.handleKeyUp}
|
||||
onKeyDown={this.handleKeyDown}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
||||
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
|
||||
onSuggestionSelected={this.onSuggestionSelected}
|
||||
|
|
Loading…
Reference in a new issue