|
|
@@ -20,7 +20,9 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; |
|
|
|
import { length } from 'stringz'; |
|
|
|
import { countableText } from '../util/counter'; |
|
|
|
import Icon from 'mastodon/components/icon'; |
|
|
|
import { max_toot_chars } from '../../../initial_state'; |
|
|
|
|
|
|
|
const maxChars = max_toot_chars || 500; |
|
|
|
const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; |
|
|
|
|
|
|
|
const messages = defineMessages({ |
|
|
@@ -88,7 +90,7 @@ class ComposeForm extends ImmutablePureComponent { |
|
|
|
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; |
|
|
|
const fulltext = [this.props.spoilerText, countableText(this.props.text)].join(''); |
|
|
|
|
|
|
|
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { |
|
|
|
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@@ -181,7 +183,7 @@ class ComposeForm extends ImmutablePureComponent { |
|
|
|
const { intl, onPaste, showSearch, anyMedia } = this.props; |
|
|
|
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) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia); |
|
|
|
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia); |
|
|
|
let publishText = ''; |
|
|
|
|
|
|
|
if (this.props.privacy === 'private' || this.props.privacy === 'direct') { |
|
|
@@ -243,7 +245,7 @@ class ComposeForm extends ImmutablePureComponent { |
|
|
|
<PrivacyDropdownContainer /> |
|
|
|
<SpoilerButtonContainer /> |
|
|
|
</div> |
|
|
|
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div> |
|
|
|
<div className='character-counter__wrapper'><CharacterCounter max={maxChars} text={text} /></div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div className='compose-form__publish'> |
|
|
|