mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-28 19:10:22 -05:00
add keybind in composer textarea for secondary submit
This commit is contained in:
parent
e6647ccf6d
commit
e96a4434c7
@ -331,6 +331,7 @@ class Composer extends React.Component {
|
|||||||
onPaste={onUpload}
|
onPaste={onUpload}
|
||||||
onPickEmoji={handleEmoji}
|
onPickEmoji={handleEmoji}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
|
onSecondarySubmit={handleSecondarySubmit}
|
||||||
onSuggestionsClearRequested={onClearSuggestions}
|
onSuggestionsClearRequested={onClearSuggestions}
|
||||||
onSuggestionsFetchRequested={onFetchSuggestions}
|
onSuggestionsFetchRequested={onFetchSuggestions}
|
||||||
onSuggestionSelected={handleSelect}
|
onSuggestionSelected={handleSelect}
|
||||||
|
@ -112,6 +112,7 @@ const handlers = {
|
|||||||
const {
|
const {
|
||||||
disabled,
|
disabled,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
onSecondarySubmit,
|
||||||
onSuggestionSelected,
|
onSuggestionSelected,
|
||||||
suggestions,
|
suggestions,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -133,6 +134,11 @@ const handlers = {
|
|||||||
onSubmit();
|
onSubmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Submit the status with secondary visibility on alt + enter.
|
||||||
|
if (onSecondarySubmit && e.keyCode === 13 && e.altKey) {
|
||||||
|
onSecondarySubmit();
|
||||||
|
}
|
||||||
|
|
||||||
// Switches over the pressed key.
|
// Switches over the pressed key.
|
||||||
switch(e.key) {
|
switch(e.key) {
|
||||||
|
|
||||||
@ -294,6 +300,7 @@ ComposerTextarea.propTypes = {
|
|||||||
onPaste: PropTypes.func,
|
onPaste: PropTypes.func,
|
||||||
onPickEmoji: PropTypes.func,
|
onPickEmoji: PropTypes.func,
|
||||||
onSubmit: PropTypes.func,
|
onSubmit: PropTypes.func,
|
||||||
|
onSecondarySubmit: PropTypes.func,
|
||||||
onSuggestionsClearRequested: PropTypes.func,
|
onSuggestionsClearRequested: PropTypes.func,
|
||||||
onSuggestionsFetchRequested: PropTypes.func,
|
onSuggestionsFetchRequested: PropTypes.func,
|
||||||
onSuggestionSelected: PropTypes.func,
|
onSuggestionSelected: PropTypes.func,
|
||||||
|
Loading…
Reference in New Issue
Block a user