Skip to content

Commit 7488a9e

Browse files
ClearlyClaireGargron
authored andcommitted
Add support for submitting media description with ctrl+enter (#12272)
1 parent 8568018 commit 7488a9e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

app/javascript/mastodon/features/ui/components/focal_point_modal.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ class FocalPointModal extends ImmutablePureComponent {
184184
this.setState({ description: e.target.value, dirty: true });
185185
}
186186

187+
handleKeyDown = (e) => {
188+
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
189+
e.preventDefault();
190+
e.stopPropagation();
191+
this.setState({ description: e.target.value, dirty: true });
192+
this.handleSubmit();
193+
}
194+
}
195+
187196
handleSubmit = () => {
188197
this.props.onSave(this.state.description, this.state.focusX, this.state.focusY);
189198
this.props.onClose();
@@ -254,6 +263,7 @@ class FocalPointModal extends ImmutablePureComponent {
254263
className='setting-text light'
255264
value={detecting ? '…' : description}
256265
onChange={this.handleChange}
266+
onKeyDown={this.handleKeyDown}
257267
disabled={detecting}
258268
autoFocus
259269
/>

0 commit comments

Comments
 (0)