@ -93,7 +93,7 @@ class ComposeForm extends ImmutablePureComponent {
return ! ( isSubmitting || isUploading || isChangingUpload || length ( fulltext ) > 500 || ( isOnlyWhitespace && ! anyMedia ) ) ;
return ! ( isSubmitting || isUploading || isChangingUpload || length ( fulltext ) > 500 || ( isOnlyWhitespace && ! anyMedia ) ) ;
}
}
handleSubmit = ( ) => {
handleSubmit = ( e ) => {
if ( this . props . text !== this . autosuggestTextarea . textarea . value ) {
if ( this . props . text !== this . autosuggestTextarea . textarea . 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
@ -105,6 +105,10 @@ class ComposeForm extends ImmutablePureComponent {
}
}
this . props . onSubmit ( this . context . router ? this . context . router . history : null ) ;
this . props . onSubmit ( this . context . router ? this . context . router . history : null ) ;
if ( e ) {
e . preventDefault ( ) ;
}
}
}
onSuggestionsClearRequested = ( ) => {
onSuggestionsClearRequested = ( ) => {
@ -217,7 +221,7 @@ class ComposeForm extends ImmutablePureComponent {
}
}
return (
return (
< form className = 'compose-form' >
< form className = 'compose-form' onSubmit = { this . handleSubmit } >
< WarningContainer / >
< WarningContainer / >
< ReplyIndicatorContainer / >
< ReplyIndicatorContainer / >
@ -280,9 +284,8 @@ class ComposeForm extends ImmutablePureComponent {
< div className = 'compose-form__publish' >
< div className = 'compose-form__publish' >
< div className = 'compose-form__publish-button-wrapper' >
< div className = 'compose-form__publish-button-wrapper' >
< Button
< Button
type = "submit"
type = 'submit'
text = { publishText }
text = { publishText }
onClick = { this . handleSubmit }
disabled = { ! this . canSubmit ( ) }
disabled = { ! this . canSubmit ( ) }
block
block
/ >
/ >