Removed unnecessary functions
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
ed02503462
commit
2ebc1252cb
3 changed files with 25 additions and 32 deletions
|
@ -18,7 +18,7 @@ import React from 'react';
|
||||||
|
|
||||||
import Dropdown from "../../views/elements/Dropdown"
|
import Dropdown from "../../views/elements/Dropdown"
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import * as languageHandler from '../../../languageHandler';
|
import PlatformPeg from "../../../PlatformPeg";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
|
|
||||||
|
@ -52,23 +52,26 @@ export default class SpellCheckLanguagesDropdown extends React.Component<SpellCh
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
languageHandler.getAvailableSpellCheckLanguages().then((languages) => {
|
const plaf = PlatformPeg.get();
|
||||||
languages.sort(function(a, b) {
|
if (plaf) {
|
||||||
if (a < b) return -1;
|
plaf.getAvailableSpellCheckLanguages().then((languages) => {
|
||||||
if (a > b) return 1;
|
languages.sort(function(a, b) {
|
||||||
return 0;
|
if (a < b) return -1;
|
||||||
});
|
if (a > b) return 1;
|
||||||
const langs = [];
|
return 0;
|
||||||
languages.forEach((language) => {
|
});
|
||||||
langs.push({
|
const langs = [];
|
||||||
label: language,
|
languages.forEach((language) => {
|
||||||
value: language,
|
langs.push({
|
||||||
|
label: language,
|
||||||
|
value: language,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
this.setState({languages: langs});
|
||||||
this.setState({languages: langs});
|
}).catch((e) => {
|
||||||
}).catch((e) => {
|
this.setState({languages: ['en']});
|
||||||
this.setState({languages: ['en']});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSearchChange(search) {
|
_onSearchChange(search) {
|
||||||
|
|
|
@ -188,7 +188,10 @@ export default class GeneralUserSettingsTab extends React.Component {
|
||||||
SettingsStore.setValue("spell-check-languages", null, SettingLevel.DEVICE, languages);
|
SettingsStore.setValue("spell-check-languages", null, SettingLevel.DEVICE, languages);
|
||||||
this.setState({spellCheckLanguages: languages});
|
this.setState({spellCheckLanguages: languages});
|
||||||
|
|
||||||
languageHandler.setSpellCheckLanguages(languages);
|
const plaf = PlatformPeg.get();
|
||||||
|
if (plaf) {
|
||||||
|
plaf.setSpellCheckLanguages(languages);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_onPasswordChangeError = (err) => {
|
_onPasswordChangeError = (err) => {
|
||||||
|
@ -402,6 +405,7 @@ export default class GeneralUserSettingsTab extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const plaf = PlatformPeg.get();
|
const plaf = PlatformPeg.get();
|
||||||
const supportsMultiLanguageSpellCheck = plaf.supportsMultiLanguageSpellCheck();
|
const supportsMultiLanguageSpellCheck = plaf.supportsMultiLanguageSpellCheck();
|
||||||
|
console.log("LOG", supportsMultiLanguageSpellCheck);
|
||||||
|
|
||||||
const discoWarning = this.state.requiredPolicyInfo.hasTerms
|
const discoWarning = this.state.requiredPolicyInfo.hasTerms
|
||||||
? <img className='mx_GeneralUserSettingsTab_warningIcon'
|
? <img className='mx_GeneralUserSettingsTab_warningIcon'
|
||||||
|
|
|
@ -346,20 +346,6 @@ export function setLanguage(preferredLangs: string | string[]) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setSpellCheckLanguages(preferredLangs: string[]) {
|
|
||||||
const plaf = PlatformPeg.get();
|
|
||||||
if (plaf) {
|
|
||||||
plaf.setSpellCheckLanguages(preferredLangs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAvailableSpellCheckLanguages(): Promise<string[]> {
|
|
||||||
const plaf = PlatformPeg.get();
|
|
||||||
if (plaf) {
|
|
||||||
return plaf.getAvailableSpellCheckLanguages();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getAllLanguagesFromJson() {
|
export function getAllLanguagesFromJson() {
|
||||||
return getLangsJson().then((langsObject) => {
|
return getLangsJson().then((langsObject) => {
|
||||||
const langs = [];
|
const langs = [];
|
||||||
|
|
Loading…
Reference in a new issue