mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-24 03:43:42 +01:00
Fix: Prevent submission using same logic as submit button disabling. (#6993)
This prevents submission through ctrl/cmd+enter when the submit button is disabled.
This commit is contained in:
parent
993ce0e5a7
commit
6a895e1ab3
1 changed files with 8 additions and 0 deletions
|
@ -74,6 +74,14 @@ export default class ComposeForm extends ImmutablePureComponent {
|
|||
this.props.onChange(this.autosuggestTextarea.textarea.value);
|
||||
}
|
||||
|
||||
// Submit disabled:
|
||||
const { is_submitting, is_uploading, anyMedia } = this.props;
|
||||
const fulltext = [this.props.spoiler_text, countableText(this.props.text)].join('');
|
||||
|
||||
if (is_submitting || is_uploading || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onSubmit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue