Skip to content

Commit

Permalink
Add support for disabling spell check (#22220)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Telatynski <[email protected]>
  • Loading branch information
SimonBrandner and t3chguy authored Jul 28, 2022
1 parent a620ff2 commit 1e445a7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1e445a7

Please sign in to comment.