Browse Source

add keybind in composer textarea for secondary submit

closed-social-glitch-2
Ash Levy 5 years ago
committed by ThibG
parent
commit
e96a4434c7
2 changed files with 8 additions and 0 deletions
  1. +1
    -0
      app/javascript/flavours/glitch/features/composer/index.js
  2. +7
    -0
      app/javascript/flavours/glitch/features/composer/textarea/index.js

+ 1
- 0
app/javascript/flavours/glitch/features/composer/index.js View File

@ -331,6 +331,7 @@ class Composer extends React.Component {
onPaste={onUpload}
onPickEmoji={handleEmoji}
onSubmit={handleSubmit}
onSecondarySubmit={handleSecondarySubmit}
onSuggestionsClearRequested={onClearSuggestions}
onSuggestionsFetchRequested={onFetchSuggestions}
onSuggestionSelected={handleSelect}

+ 7
- 0
app/javascript/flavours/glitch/features/composer/textarea/index.js View File

@ -112,6 +112,7 @@ const handlers = {
const {
disabled,
onSubmit,
onSecondarySubmit,
onSuggestionSelected,
suggestions,
} = this.props;
@ -133,6 +134,11 @@ const handlers = {
onSubmit();
}
// Submit the status with secondary visibility on alt + enter.
if (onSecondarySubmit && e.keyCode === 13 && e.altKey) {
onSecondarySubmit();
}
// Switches over the pressed key.
switch(e.key) {
@ -294,6 +300,7 @@ ComposerTextarea.propTypes = {
onPaste: PropTypes.func,
onPickEmoji: PropTypes.func,
onSubmit: PropTypes.func,
onSecondarySubmit: PropTypes.func,
onSuggestionsClearRequested: PropTypes.func,
onSuggestionsFetchRequested: PropTypes.func,
onSuggestionSelected: PropTypes.func,

Loading…
Cancel
Save