Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lang attribute to compose textarea and CW field #23240

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/javascript/mastodon/components/autosuggest_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class AutosuggestInput extends ImmutablePureComponent {
id: PropTypes.string,
searchTokens: PropTypes.arrayOf(PropTypes.string),
maxLength: PropTypes.number,
lang: PropTypes.string,
};

static defaultProps = {
Expand Down Expand Up @@ -185,7 +186,7 @@ export default class AutosuggestInput extends ImmutablePureComponent {
}

render () {
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength } = this.props;
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength, lang } = this.props;
const { suggestionsHidden } = this.state;

return (
Expand All @@ -210,6 +211,7 @@ export default class AutosuggestInput extends ImmutablePureComponent {
id={id}
className={className}
maxLength={maxLength}
lang={lang}
/>
</label>

Expand Down
4 changes: 3 additions & 1 deletion app/javascript/mastodon/components/autosuggest_textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
onKeyDown: PropTypes.func,
onPaste: PropTypes.func.isRequired,
autoFocus: PropTypes.bool,
lang: PropTypes.string,
};

static defaultProps = {
Expand Down Expand Up @@ -192,7 +193,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
}

render () {
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props;
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, lang, children } = this.props;
const { suggestionsHidden } = this.state;

return [
Expand All @@ -216,6 +217,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
onPaste={this.onPaste}
dir='auto'
aria-autocomplete='list'
lang={lang}
/>
</label>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ComposeForm extends ImmutablePureComponent {
anyMedia: PropTypes.bool,
isInReply: PropTypes.bool,
singleColumn: PropTypes.bool,
lang: PropTypes.string,
};

static defaultProps = {
Expand Down Expand Up @@ -240,6 +241,7 @@ class ComposeForm extends ImmutablePureComponent {
searchTokens={[':']}
id='cw-spoiler-input'
className='spoiler-input__input'
lang={this.props.lang}
/>
</div>

Expand All @@ -257,6 +259,7 @@ class ComposeForm extends ImmutablePureComponent {
onSuggestionSelected={this.onSuggestionSelected}
onPaste={onPaste}
autoFocus={autoFocus}
lang={this.props.lang}
>
<EmojiPickerDropdown onPickEmoji={this.handleEmojiPick} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const mapStateToProps = state => ({
isUploading: state.getIn(['compose', 'is_uploading']),
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
lang: state.getIn(['compose', 'language']),
});

const mapDispatchToProps = (dispatch) => ({
Expand Down