diff options
author | Spanky <2788886+SpankyWorks@users.noreply.github.com> | 2018-08-18 12:40:35 -0500 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-08-18 19:40:35 +0200 |
commit | 7a0f781aa9aad505dbde6a2bf3aa5048638c2de0 (patch) | |
tree | 444875dad83b3d3b07746429f00f6313f57e1808 /app/javascript/mastodon/features/compose/components/upload.js | |
parent | 298ee84488758fc08a0ae9233e04c9637aa2fe02 (diff) |
Fix ctrl+enter not submitting toot when text cursor is composing image description (#8273)
Diffstat (limited to 'app/javascript/mastodon/features/compose/components/upload.js')
-rw-r--r-- | app/javascript/mastodon/features/compose/components/upload.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/javascript/mastodon/features/compose/components/upload.js b/app/javascript/mastodon/features/compose/components/upload.js index bfa2b4727..3d09217dc 100644 --- a/app/javascript/mastodon/features/compose/components/upload.js +++ b/app/javascript/mastodon/features/compose/components/upload.js @@ -20,6 +20,7 @@ export default class Upload extends ImmutablePureComponent { onUndo: PropTypes.func.isRequired, onDescriptionChange: PropTypes.func.isRequired, onOpenFocalPoint: PropTypes.func.isRequired, + onSubmit: PropTypes.func.isRequired, }; state = { @@ -28,6 +29,17 @@ export default class Upload extends ImmutablePureComponent { dirtyDescription: null, }; + handleKeyDown = (e) => { + if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { + this.handleSubmit(); + } + } + + handleSubmit = () => { + this.handleInputBlur(); + this.props.onSubmit(); + } + handleUndoClick = () => { this.props.onUndo(this.props.media.get('id')); } @@ -93,6 +105,7 @@ export default class Upload extends ImmutablePureComponent { onFocus={this.handleInputFocus} onChange={this.handleInputChange} onBlur={this.handleInputBlur} + onKeyDown={this.handleKeyDown} /> </label> </div> |