mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Add new spell check ipc calls
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
f00f33d7a9
commit
97c9378ddc
@ -499,28 +499,30 @@ ipcMain.on('ipcCall', async function(_ev: IpcMainEvent, payload) {
|
||||
mainWindow.webContents.goForward();
|
||||
}
|
||||
break;
|
||||
case 'setSpellCheckLanguages':
|
||||
if (args[0] && args[0].length > 0) {
|
||||
mainWindow.webContents.session.setSpellCheckerEnabled(true);
|
||||
store.set("spellCheckerEnabled", true);
|
||||
case 'setSpellCheckEnabled':
|
||||
if (typeof args[0] !== 'boolean') return;
|
||||
|
||||
try {
|
||||
mainWindow.webContents.session.setSpellCheckerLanguages(args[0]);
|
||||
} catch (er) {
|
||||
console.log("There were problems setting the spellcheck languages", er);
|
||||
}
|
||||
} else {
|
||||
mainWindow.webContents.session.setSpellCheckerEnabled(false);
|
||||
store.set("spellCheckerEnabled", false);
|
||||
mainWindow.webContents.session.setSpellCheckerEnabled(args[0]);
|
||||
store.set("spellCheckerEnabled", args[0]);
|
||||
|
||||
break;
|
||||
|
||||
case 'getSpellCheckEnabled':
|
||||
ret = store.get("spellCheckerEnabled", true);
|
||||
break;
|
||||
|
||||
case 'setSpellCheckLanguages':
|
||||
try {
|
||||
mainWindow.webContents.session.setSpellCheckerLanguages(args[0]);
|
||||
} catch (er) {
|
||||
console.log("There were problems setting the spellcheck languages", er);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'getSpellCheckLanguages':
|
||||
if (store.get("spellCheckerEnabled", true)) {
|
||||
ret = mainWindow.webContents.session.getSpellCheckerLanguages();
|
||||
} else {
|
||||
ret = [];
|
||||
}
|
||||
ret = mainWindow.webContents.session.getSpellCheckerLanguages();
|
||||
break;
|
||||
|
||||
case 'getAvailableSpellCheckLanguages':
|
||||
ret = mainWindow.webContents.session.availableSpellCheckerLanguages;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user