about summary refs log tree commit diff
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorJessica Stokes <hello@jessicastokes.net>2017-01-04 18:29:43 -0800
committerJessica Stokes <hello@jessicastokes.net>2017-01-04 18:29:43 -0800
commit1da73ecadedf26c5f04dc2de3bb65349ffc52ab9 (patch)
tree59ed36ee9bdce575ed8db18449040de7a9b7825e /app/assets/javascripts
parent251b04298e826818ecb48c2fdf96a83649e14e93 (diff)
Fix Command-enter tooting
metaKey is only set correctly on keyDown, not keyUp, so this swaps to using that
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/components/components/autosuggest_textarea.jsx9
-rw-r--r--app/assets/javascripts/components/features/compose/components/compose_form.jsx4
2 files changed, 10 insertions, 3 deletions
diff --git a/app/assets/javascripts/components/components/autosuggest_textarea.jsx b/app/assets/javascripts/components/components/autosuggest_textarea.jsx
index 39ccbcaf9..57352be90 100644
--- a/app/assets/javascripts/components/components/autosuggest_textarea.jsx
+++ b/app/assets/javascripts/components/components/autosuggest_textarea.jsx
@@ -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 () {
diff --git a/app/assets/javascripts/components/features/compose/components/compose_form.jsx b/app/assets/javascripts/components/features/compose/components/compose_form.jsx
index 55f361b0b..412c29310 100644
--- a/app/assets/javascripts/components/features/compose/components/compose_form.jsx
+++ b/app/assets/javascripts/components/features/compose/components/compose_form.jsx
@@ -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}