Fix formatting

pull/21833/head
Šimon Brandner 2020-12-01 20:36:25 +01:00
parent 3c2bb6e4f6
commit db5bc0cb7a
3 changed files with 16 additions and 14 deletions

View File

@ -33,14 +33,15 @@ interface SpellCheckLanguagesDropdownIProps {
className: string,
value: string,
onOptionChange(language: string),
};
}
interface SpellCheckLanguagesDropdownIState {
searchQuery: string,
languages: any,
}
export default class SpellCheckLanguagesDropdown extends React.Component<SpellCheckLanguagesDropdownIProps, SpellCheckLanguagesDropdownIState> {
export default class SpellCheckLanguagesDropdown extends React.Component<SpellCheckLanguagesDropdownIProps,
SpellCheckLanguagesDropdownIState> {
constructor(props) {
super(props);
this._onSearchChange = this._onSearchChange.bind(this);
@ -58,7 +59,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component<SpellCh
if (a > b) return 1;
return 0;
});
var langs = [];
const langs = [];
languages.forEach((language) => {
langs.push({
label: language,

View File

@ -22,12 +22,12 @@ import {_t} from "../../../languageHandler";
interface ExistingSpellCheckLanguageIProps {
language: string,
onRemoved(language: string),
};
}
interface SpellCheckLanguagesIProps {
languages: Array<string>,
onLanguagesChange(languages: Array<string>),
};
}
interface SpellCheckLanguagesIState {
newLanguage: string,
@ -71,7 +71,7 @@ export default class SpellCheckLanguages extends React.Component<SpellCheckLangu
e.preventDefault();
const language = this.state.newLanguage;
if (!language) return;
if (this.props.languages.includes(language)) return;
@ -89,7 +89,7 @@ export default class SpellCheckLanguages extends React.Component<SpellCheckLangu
return <ExistingSpellCheckLanguage language={e} onRemoved={this._onRemoved} key={e} />;
});
let addButton = (
const addButton = (
<AccessibleButton onClick={this._onAddClick} kind="primary">
{_t("Add")}
</AccessibleButton>
@ -99,12 +99,13 @@ export default class SpellCheckLanguages extends React.Component<SpellCheckLangu
<div className="mx_SpellCheckLanguages">
{existingSpellCheckLanguages}
<form onSubmit={this._onAddClick} noValidate={true}>
<SpellCheckLanguagesDropdown className="mx_GeneralUserSettingsTab_spellCheckLanguageInput"
value={this.state.newLanguage}
onOptionChange={this._onNewLanguageChange} />
<SpellCheckLanguagesDropdown
className="mx_GeneralUserSettingsTab_spellCheckLanguageInput"
value={this.state.newLanguage}
onOptionChange={this._onNewLanguageChange} />
{addButton}
</form>
</div>
);
};
}
}

View File

@ -22,7 +22,7 @@ import ProfileSettings from "../../ProfileSettings";
import * as languageHandler from "../../../../../languageHandler";
import SettingsStore from "../../../../../settings/SettingsStore";
import LanguageDropdown from "../../../elements/LanguageDropdown";
import SpellCheckSettings from "../../SpellCheckSettings"
import SpellCheckSettings from "../../SpellCheckSettings";
import AccessibleButton from "../../../elements/AccessibleButton";
import DeactivateAccountDialog from "../../../dialogs/DeactivateAccountDialog";
import PropTypes from "prop-types";
@ -186,8 +186,8 @@ export default class GeneralUserSettingsTab extends React.Component {
_onSpellCheckLanguagesChange = (languages) => {
SettingsStore.setValue("spell-check-languages", null, SettingLevel.DEVICE, languages);
this.setState({spellCheckLanguages: languages})
this.setState({spellCheckLanguages: languages});
languageHandler.setSpellCheckLanguages(languages);
};