From 1e445a75a99f788188cd4c87a9543f97f4520fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 28 Jul 2022 10:19:33 +0200 Subject: [PATCH] Add support for disabling spell check (#22220) Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- src/vector/platform/ElectronPlatform.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index b2aaa935a1..d50accc1c1 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -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 { + 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);