Composer: don't collapse if non-empty

This commit is contained in:
Alex Gleason 2021-05-17 15:13:42 -05:00
parent 681f62b5b3
commit 1e3b2f853f
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 7 additions and 2 deletions

View File

@ -99,6 +99,11 @@ class ComposeForm extends ImmutablePureComponent {
return clickableAreaRef ? clickableAreaRef.current : this.form;
}
isEmpty = () => {
const { text, spoilerText, anyMedia } = this.props;
return !(text || spoilerText || anyMedia);
}
isClickOutside = (e) => {
return ![
// List of elements that shouldn't collapse the composer when clicked
@ -111,7 +116,7 @@ class ComposeForm extends ImmutablePureComponent {
}
handleClick = (e) => {
if (this.isClickOutside(e)) {
if (this.isEmpty() && this.isClickOutside(e)) {
this.handleClickOutside();
}
}
@ -238,7 +243,7 @@ class ComposeForm extends ImmutablePureComponent {
render() {
const { intl, onPaste, showSearch, anyMedia, shouldCondense, autoFocus, isModalOpen, maxTootChars } = this.props;
const condensed = shouldCondense && !this.props.text && !this.state.composeFocused;
const condensed = shouldCondense && !this.state.composeFocused && this.isEmpty() && !this.props.isUploading;
const disabled = this.props.isSubmitting;
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxTootChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia);