|
|
|
@ -26,6 +26,7 @@ class Option extends React.PureComponent { |
|
|
|
|
|
|
|
|
|
static propTypes = { |
|
|
|
|
title: PropTypes.string.isRequired, |
|
|
|
|
lang: PropTypes.string, |
|
|
|
|
index: PropTypes.number.isRequired, |
|
|
|
|
isPollMultiple: PropTypes.bool, |
|
|
|
|
autoFocus: PropTypes.bool, |
|
|
|
@ -59,7 +60,7 @@ class Option extends React.PureComponent { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
|
const { isPollMultiple, title, index, autoFocus, intl } = this.props; |
|
|
|
|
const { isPollMultiple, title, lang, index, autoFocus, intl } = this.props; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<li> |
|
|
|
@ -70,6 +71,7 @@ class Option extends React.PureComponent { |
|
|
|
|
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })} |
|
|
|
|
maxLength={pollLimits.max_option_chars} |
|
|
|
|
value={title} |
|
|
|
|
lang={lang} |
|
|
|
|
onChange={this.handleOptionTitleChange} |
|
|
|
|
suggestions={this.props.suggestions} |
|
|
|
|
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested} |
|
|
|
@ -95,6 +97,7 @@ class PollForm extends ImmutablePureComponent { |
|
|
|
|
|
|
|
|
|
static propTypes = { |
|
|
|
|
options: ImmutablePropTypes.list, |
|
|
|
|
lang: PropTypes.string, |
|
|
|
|
expiresIn: PropTypes.number, |
|
|
|
|
isMultiple: PropTypes.bool, |
|
|
|
|
onChangeOption: PropTypes.func.isRequired, |
|
|
|
@ -121,7 +124,7 @@ class PollForm extends ImmutablePureComponent { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
|
const { options, expiresIn, isMultiple, onChangeOption, onRemoveOption, intl, ...other } = this.props; |
|
|
|
|
const { options, lang, expiresIn, isMultiple, onChangeOption, onRemoveOption, intl, ...other } = this.props; |
|
|
|
|
|
|
|
|
|
if (!options) { |
|
|
|
|
return null; |
|
|
|
@ -132,7 +135,7 @@ class PollForm extends ImmutablePureComponent { |
|
|
|
|
return ( |
|
|
|
|
<div className='compose-form__poll-wrapper'> |
|
|
|
|
<ul> |
|
|
|
|
{options.map((title, i) => <Option title={title} key={i} index={i} onChange={onChangeOption} onRemove={onRemoveOption} isPollMultiple={isMultiple} autoFocus={i === autoFocusIndex} {...other} />)} |
|
|
|
|
{options.map((title, i) => <Option title={title} lang={lang} key={i} index={i} onChange={onChangeOption} onRemove={onRemoveOption} isPollMultiple={isMultiple} autoFocus={i === autoFocusIndex} {...other} />)} |
|
|
|
|
{options.size < pollLimits.max_options && ( |
|
|
|
|
<label className='poll__text editable'> |
|
|
|
|
<span className={classNames('poll__input')} style={{ opacity: 0 }} /> |
|
|
|
|