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 {
}
// 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.
placeholder={intl.formatMessage(messages.spoiler_placeholder)}
value={spoilerText}
onChange={this.handleChangeSpoiler}
- onKeyDown={this.handleKeyDown}
onKeyUp={this.handleKeyUp}
disabled={!spoiler}
ref={this.handleRefSpoilerText}
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}