Use getSpellCheckLanguages() instead of a setting

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-02-18 20:12:48 +01:00
parent 305d64cda8
commit 1ba512af2a
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
2 changed files with 14 additions and 1 deletions

View file

@ -250,6 +250,10 @@ export default abstract class BasePlatform {
setSpellCheckLanguages(preferredLangs: string[]) {} setSpellCheckLanguages(preferredLangs: string[]) {}
getSpellCheckLanguages(): Promise<string[]> | null {
return null;
}
getAvailableSpellCheckLanguages(): Promise<string[]> | null { getAvailableSpellCheckLanguages(): Promise<string[]> | null {
return null; return null;
} }

View file

@ -50,7 +50,7 @@ export default class GeneralUserSettingsTab extends React.Component {
this.state = { this.state = {
language: languageHandler.getCurrentLanguage(), language: languageHandler.getCurrentLanguage(),
spellCheckLanguages: SettingsStore.getValue("spell-check-languages", null, false), spellCheckLanguages: [],
haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()), haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()),
serverSupportsSeparateAddAndBind: null, serverSupportsSeparateAddAndBind: null,
idServerHasUnsignedTerms: false, idServerHasUnsignedTerms: false,
@ -87,6 +87,15 @@ export default class GeneralUserSettingsTab extends React.Component {
this._getThreepidState(); this._getThreepidState();
} }
async componentDidMount() {
const plaf = PlatformPeg.get();
if (plaf) {
this.setState({
spellCheckLanguages: await plaf.getSpellCheckLanguages(),
});
}
}
componentWillUnmount() { componentWillUnmount() {
dis.unregister(this.dispatcherRef); dis.unregister(this.dispatcherRef);
} }