|
@ -18,6 +18,7 @@ import WarningContainer from '../containers/warning_container'; |
|
|
import { isMobile } from '../../../is_mobile'; |
|
|
import { isMobile } from '../../../is_mobile'; |
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'; |
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'; |
|
|
import { length } from 'stringz'; |
|
|
import { length } from 'stringz'; |
|
|
|
|
|
import { countableText } from '../util/counter'; |
|
|
|
|
|
|
|
|
const messages = defineMessages({ |
|
|
const messages = defineMessages({ |
|
|
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, |
|
|
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, |
|
@ -145,9 +146,9 @@ export default class ComposeForm extends ImmutablePureComponent { |
|
|
render () { |
|
|
render () { |
|
|
const { intl, onPaste, showSearch } = this.props; |
|
|
const { intl, onPaste, showSearch } = this.props; |
|
|
const disabled = this.props.is_submitting; |
|
|
const disabled = this.props.is_submitting; |
|
|
const text = [this.props.spoiler_text, this.props.text].join(''); |
|
|
|
|
|
|
|
|
const text = [this.props.spoiler_text, countableText(this.props.text)].join(''); |
|
|
|
|
|
|
|
|
let publishText = ''; |
|
|
|
|
|
|
|
|
let publishText = ''; |
|
|
|
|
|
|
|
|
if (this.props.privacy === 'private' || this.props.privacy === 'direct') { |
|
|
if (this.props.privacy === 'private' || this.props.privacy === 'direct') { |
|
|
publishText = <span className='compose-form__publish-private'><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>; |
|
|
publishText = <span className='compose-form__publish-private'><i className='fa fa-lock' /> {intl.formatMessage(messages.publish)}</span>; |
|
@ -203,7 +204,7 @@ export default class ComposeForm extends ImmutablePureComponent { |
|
|
|
|
|
|
|
|
<div className='compose-form__publish'> |
|
|
<div className='compose-form__publish'> |
|
|
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div> |
|
|
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div> |
|
|
<div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !==0 && text.trim().length === 0)} block /></div> |
|
|
|
|
|
|
|
|
<div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block /></div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|