diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-03-14 12:40:07 +0100 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2020-03-14 14:59:14 +0100 |
commit | 7115b0b8c99b7e88aee264be75945e592dec33e4 (patch) | |
tree | 17e9a0d7d4dfb651075abd3dec0bb099bb908d9a /app | |
parent | 531658d6cfbac3277ee3bf306683126f2c585719 (diff) |
Fix missing media description dialog when sending toots with keyboard shortcuts
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/components/compose_form.js | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index 0cf633358..3d736e83f 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -81,18 +81,6 @@ class ComposeForm extends ImmutablePureComponent { this.props.onChange(e.target.value); } - handleKeyDown = ({ ctrlKey, keyCode, metaKey, altKey }) => { - // We submit the status on control/meta + enter. - if (keyCode === 13 && (ctrlKey || metaKey)) { - this.handleSubmit(); - } - - // Submit the status with secondary visibility on alt + enter. - if (keyCode === 13 && altKey) { - this.handleSecondarySubmit(); - } - } - handleSubmit = (overriddenVisibility = null) => { const { textarea: { value }, uploadForm } = this; const { @@ -171,10 +159,20 @@ class ComposeForm extends ImmutablePureComponent { } // When the escape key is released, we focus the UI. - handleKeyUp = ({ key }) => { + handleKeyUp = ({ key, ctrlKey, keyCode, metaKey, altKey }) => { if (key === 'Escape') { document.querySelector('.ui').parentElement.focus(); } + + // We submit the status on control/meta + enter. + if (keyCode === 13 && (ctrlKey || metaKey)) { + this.handleSubmit(); + } + + // Submit the status with secondary visibility on alt + enter. + if (keyCode === 13 && altKey) { + this.handleSecondarySubmit(); + } } // Sets a reference to the textarea. @@ -307,7 +305,6 @@ class ComposeForm extends ImmutablePureComponent { placeholder={intl.formatMessage(messages.spoiler_placeholder)} value={spoilerText} onChange={this.handleChangeSpoiler} - onKeyDown={this.handleKeyDown} onKeyUp={this.handleKeyUp} disabled={!spoiler} ref={this.handleRefSpoilerText} @@ -328,9 +325,9 @@ class ComposeForm extends ImmutablePureComponent { disabled={isSubmitting} value={this.props.text} onChange={this.handleChange} + onKeyUp={this.handleKeyUp} suggestions={this.props.suggestions} onFocus={this.handleFocus} - onKeyDown={this.handleKeyDown} onSuggestionsFetchRequested={onFetchSuggestions} onSuggestionsClearRequested={onClearSuggestions} onSuggestionSelected={this.onSuggestionSelected} |