|
|
@ -125,7 +125,7 @@ class ComposeForm extends ImmutablePureComponent {
|
|
|
|
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (!fulltext.trim().length && !anyMedia));
|
|
|
|
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (!fulltext.trim().length && !anyMedia));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
handleSubmit = (overriddenVisibility = null) => {
|
|
|
|
handleSubmit = (e, overriddenVisibility = null) => {
|
|
|
|
if (this.props.text !== this.textareaRef.current.value) {
|
|
|
|
if (this.props.text !== this.textareaRef.current.value) {
|
|
|
|
// Something changed the text inside the textarea (e.g. browser extensions like Grammarly)
|
|
|
|
// Something changed the text inside the textarea (e.g. browser extensions like Grammarly)
|
|
|
|
// Update the state to match the current text
|
|
|
|
// Update the state to match the current text
|
|
|
@ -136,6 +136,10 @@ class ComposeForm extends ImmutablePureComponent {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Submit unless there are media with missing descriptions
|
|
|
|
// Submit unless there are media with missing descriptions
|
|
|
|
if (this.props.mediaDescriptionConfirmation && this.props.media && this.props.media.some(item => !item.get('description'))) {
|
|
|
|
if (this.props.mediaDescriptionConfirmation && this.props.media && this.props.media.some(item => !item.get('description'))) {
|
|
|
|
const firstWithoutDescription = this.props.media.find(item => !item.get('description'));
|
|
|
|
const firstWithoutDescription = this.props.media.find(item => !item.get('description'));
|
|
|
@ -150,10 +154,8 @@ class ComposeForm extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
// Handles the secondary submit button.
|
|
|
|
// Handles the secondary submit button.
|
|
|
|
handleSecondarySubmit = () => {
|
|
|
|
handleSecondarySubmit = () => {
|
|
|
|
const {
|
|
|
|
const { sideArm } = this.props;
|
|
|
|
sideArm,
|
|
|
|
this.handleSubmit(null, sideArm === 'none' ? null : sideArm);
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
this.handleSubmit(sideArm === 'none' ? null : sideArm);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onSuggestionsClearRequested = () => {
|
|
|
|
onSuggestionsClearRequested = () => {
|
|
|
@ -342,7 +344,6 @@ class ComposeForm extends ImmutablePureComponent {
|
|
|
|
disabled={!this.canSubmit()}
|
|
|
|
disabled={!this.canSubmit()}
|
|
|
|
isEditing={isEditing}
|
|
|
|
isEditing={isEditing}
|
|
|
|
onSecondarySubmit={this.handleSecondarySubmit}
|
|
|
|
onSecondarySubmit={this.handleSecondarySubmit}
|
|
|
|
onSubmit={this.handleSubmit}
|
|
|
|
|
|
|
|
privacy={privacy}
|
|
|
|
privacy={privacy}
|
|
|
|
sideArm={sideArm}
|
|
|
|
sideArm={sideArm}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|