Add support for disabling spell check (#22220)

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Šimon Brandner 2022-07-28 10:19:33 +02:00 committed by GitHub
parent a620ff2b6a
commit 1e445a75a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,9 +175,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
* Return true if platform supports multi-language
* spell-checking, otherwise false.
*/
public supportsMultiLanguageSpellCheck(): boolean {
// Electron uses OS spell checking on macOS, so no need for in-app options
if (isMac) return false;
public supportsSpellCheckSettings(): boolean {
return true;
}
@ -305,7 +303,18 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this.ipc.call('setLanguage', preferredLangs);
}
public setSpellCheckLanguages(preferredLangs: string[]) {
public setSpellCheckEnabled(enabled: boolean): void {
this.ipc.call('setSpellCheckEnabled', enabled).catch(error => {
logger.log("Failed to send setSpellCheckEnabled IPC to Electron");
logger.error(error);
});
}
public async getSpellCheckEnabled(): Promise<boolean> {
return this.ipc.call('getSpellCheckEnabled');
}
public setSpellCheckLanguages(preferredLangs: string[]): void {
this.ipc.call('setSpellCheckLanguages', preferredLangs).catch(error => {
logger.log("Failed to send setSpellCheckLanguages IPC to Electron");
logger.error(error);