diff options
author | Christian Schmidt <github@chsc.dk> | 2023-01-29 19:00:19 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2023-02-03 19:23:36 +0100 |
commit | fb9c786baf844d7f9f5e2f3920aa80efd0673abe (patch) | |
tree | 0d493917554c825481f2363395e43005e403f3aa /app/javascript/flavours/glitch | |
parent | aeacebb3d75112d0d22b9829813c388eef6ce5af (diff) |
[Glitch] Add lang attribute to image description textarea and poll option field
Port 2a4f2216d65bd5ac90239d5b99c70f4330d76fde to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch')
3 files changed, 10 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/poll_form.js b/app/javascript/flavours/glitch/features/compose/components/poll_form.js index afb5da097..2ab3c64ac 100644 --- a/app/javascript/flavours/glitch/features/compose/components/poll_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.js @@ -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 }} /> diff --git a/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js b/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js index e87e58771..1e0058341 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js @@ -10,6 +10,7 @@ import { const mapStateToProps = state => ({ suggestions: state.getIn(['compose', 'suggestions']), options: state.getIn(['compose', 'poll', 'options']), + lang: state.getIn(['compose', 'language']), expiresIn: state.getIn(['compose', 'poll', 'expires_in']), isMultiple: state.getIn(['compose', 'poll', 'multiple']), }); diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js index fb432cf9c..9eb1c0fbf 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js @@ -39,6 +39,7 @@ const mapStateToProps = (state, { id }) => ({ account: state.getIn(['accounts', me]), isUploadingThumbnail: state.getIn(['compose', 'isUploadingThumbnail']), description: state.getIn(['compose', 'media_modal', 'description']), + lang: state.getIn(['compose', 'language']), focusX: state.getIn(['compose', 'media_modal', 'focusX']), focusY: state.getIn(['compose', 'media_modal', 'focusY']), dirty: state.getIn(['compose', 'media_modal', 'dirty']), @@ -274,7 +275,7 @@ class FocalPointModal extends ImmutablePureComponent { } render () { - const { media, intl, account, onClose, isUploadingThumbnail, description, focusX, focusY, dirty, is_changing_upload } = this.props; + const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props; const { dragging, detecting, progress, ocrStatus } = this.state; const x = (focusX / 2) + .5; const y = (focusY / -2) + .5; @@ -349,6 +350,7 @@ class FocalPointModal extends ImmutablePureComponent { id='upload-modal__description' className='setting-text light' value={detecting ? '…' : description} + lang={lang} onChange={this.handleChange} onKeyDown={this.handleKeyDown} disabled={detecting || is_changing_upload} |