Merge pull request #15851 from SimonBrandner/feature-multi-language-spell-check

Add multi language spell check
This commit is contained in:
J. Ryan Stinnett 2021-03-02 14:38:29 +00:00 committed by GitHub
commit 4f0fccfe96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -323,6 +323,16 @@ export default class ElectronPlatform extends VectorBasePlatform {
return 'Electron Platform'; // no translation required: only used for analytics return 'Electron Platform'; // no translation required: only used for analytics
} }
/**
* Return true if platform supports multi-language
* spell-checking, otherwise false.
*/
supportsMultiLanguageSpellCheck(): boolean {
// Electron uses OS spell checking on macOS, so no need for in-app options
if (isMac) return false;
return true;
}
setNotificationCount(count: number) { setNotificationCount(count: number) {
if (this.notificationCount === count) return; if (this.notificationCount === count) return;
super.setNotificationCount(count); super.setNotificationCount(count);
@ -488,13 +498,21 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this.eventIndexManager; return this.eventIndexManager;
} }
setLanguage(preferredLangs: string[]) { setSpellCheckLanguages(preferredLangs: string[]) {
this._ipcCall('setLanguage', preferredLangs).catch(error => { this._ipcCall('setSpellCheckLanguages', preferredLangs).catch(error => {
console.log("Failed to send setLanguage IPC to Electron"); console.log("Failed to send setSpellCheckLanguages IPC to Electron");
console.error(error); console.error(error);
}); });
} }
async getSpellCheckLanguages(): Promise<string[]> {
return this._ipcCall('getSpellCheckLanguages');
}
async getAvailableSpellCheckLanguages(): Promise<string[]> {
return this._ipcCall('getAvailableSpellCheckLanguages');
}
getSSOCallbackUrl(fragmentAfterLogin: string): URL { getSSOCallbackUrl(fragmentAfterLogin: string): URL {
const url = super.getSSOCallbackUrl(fragmentAfterLogin); const url = super.getSSOCallbackUrl(fragmentAfterLogin);
url.protocol = "element"; url.protocol = "element";