Fix missing media description dialog when sending toots with keyboard shortcuts
This commit is contained in:
		
							parent
							
								
									03309b0dc5
								
							
						
					
					
						commit
						e16832bc9c
					
				
					 1 changed files with 12 additions and 15 deletions
				
			
		|  | @ -81,18 +81,6 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|     this.props.onChange(e.target.value); |     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) => { |   handleSubmit = (overriddenVisibility = null) => { | ||||||
|     const { textarea: { value }, uploadForm } = this; |     const { textarea: { value }, uploadForm } = this; | ||||||
|     const { |     const { | ||||||
|  | @ -171,10 +159,20 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   //  When the escape key is released, we focus the UI.
 |   //  When the escape key is released, we focus the UI.
 | ||||||
|   handleKeyUp = ({ key }) => { |   handleKeyUp = ({ key, ctrlKey, keyCode, metaKey, altKey }) => { | ||||||
|     if (key === 'Escape') { |     if (key === 'Escape') { | ||||||
|       document.querySelector('.ui').parentElement.focus(); |       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.
 |   //  Sets a reference to the textarea.
 | ||||||
|  | @ -307,7 +305,6 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|             placeholder={intl.formatMessage(messages.spoiler_placeholder)} |             placeholder={intl.formatMessage(messages.spoiler_placeholder)} | ||||||
|             value={spoilerText} |             value={spoilerText} | ||||||
|             onChange={this.handleChangeSpoiler} |             onChange={this.handleChangeSpoiler} | ||||||
|             onKeyDown={this.handleKeyDown} |  | ||||||
|             onKeyUp={this.handleKeyUp} |             onKeyUp={this.handleKeyUp} | ||||||
|             disabled={!spoiler} |             disabled={!spoiler} | ||||||
|             ref={this.handleRefSpoilerText} |             ref={this.handleRefSpoilerText} | ||||||
|  | @ -328,9 +325,9 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|           disabled={isSubmitting} |           disabled={isSubmitting} | ||||||
|           value={this.props.text} |           value={this.props.text} | ||||||
|           onChange={this.handleChange} |           onChange={this.handleChange} | ||||||
|  |           onKeyUp={this.handleKeyUp} | ||||||
|           suggestions={this.props.suggestions} |           suggestions={this.props.suggestions} | ||||||
|           onFocus={this.handleFocus} |           onFocus={this.handleFocus} | ||||||
|           onKeyDown={this.handleKeyDown} |  | ||||||
|           onSuggestionsFetchRequested={onFetchSuggestions} |           onSuggestionsFetchRequested={onFetchSuggestions} | ||||||
|           onSuggestionsClearRequested={onClearSuggestions} |           onSuggestionsClearRequested={onClearSuggestions} | ||||||
|           onSuggestionSelected={this.onSuggestionSelected} |           onSuggestionSelected={this.onSuggestionSelected} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue