浏览代码

Fix: Prevent submission using same logic as submit button disabling. (#6993)

This prevents submission through ctrl/cmd+enter when the submit button is disabled.
master
Emelia Smith 6 年前
committed by Eugen Rochko
父节点
当前提交
6a895e1ab3
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. +8
    -0
      app/javascript/mastodon/features/compose/components/compose_form.js

+ 8
- 0
app/javascript/mastodon/features/compose/components/compose_form.js 查看文件

@@ -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();
}



正在加载...
取消
保存