mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Fix disabling spellchecker
This is quite ugly. We have to use the store here to get this working since spellCheckerEnabled isn't persistent Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
dabca5dc33
commit
55dffc8c52
@ -411,17 +411,25 @@ ipcMain.on('ipcCall', async function(ev, payload) {
|
|||||||
break;
|
break;
|
||||||
case 'setSpellCheckLanguages':
|
case 'setSpellCheckLanguages':
|
||||||
if (args[0] && args[0].length > 0) {
|
if (args[0] && args[0].length > 0) {
|
||||||
|
mainWindow.webContents.session.setSpellCheckerEnabled(true);
|
||||||
|
store.set("spellCheckerEnabled", true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mainWindow.webContents.session.setSpellCheckerLanguages(args[0]);
|
mainWindow.webContents.session.setSpellCheckerLanguages(args[0]);
|
||||||
} catch (er) {
|
} catch (er) {
|
||||||
console.log("There were problems setting the spellcheck languages", er);
|
console.log("There were problems setting the spellcheck languages", er);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mainWindow.webContents.session.setSpellCheckerLanguages([]);
|
mainWindow.webContents.session.setSpellCheckerEnabled(false);
|
||||||
|
store.set("spellCheckerEnabled", false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'getSpellCheckLanguages':
|
case 'getSpellCheckLanguages':
|
||||||
|
if (store.get("spellCheckerEnabled", true)) {
|
||||||
ret = mainWindow.webContents.session.getSpellCheckerLanguages();
|
ret = mainWindow.webContents.session.getSpellCheckerLanguages();
|
||||||
|
} else {
|
||||||
|
ret = [];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'getAvailableSpellCheckLanguages':
|
case 'getAvailableSpellCheckLanguages':
|
||||||
ret = mainWindow.webContents.session.availableSpellCheckerLanguages;
|
ret = mainWindow.webContents.session.availableSpellCheckerLanguages;
|
||||||
@ -921,12 +929,15 @@ app.on('ready', async () => {
|
|||||||
enableRemoteModule: false,
|
enableRemoteModule: false,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
webgl: false,
|
webgl: false,
|
||||||
spellcheck: true,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
mainWindow.loadURL('vector://vector/webapp/');
|
mainWindow.loadURL('vector://vector/webapp/');
|
||||||
Menu.setApplicationMenu(vectorMenu);
|
Menu.setApplicationMenu(vectorMenu);
|
||||||
|
|
||||||
|
// Handle spellchecker
|
||||||
|
// For some reason spellCheckerEnabled isn't persisted so we have to use the store here
|
||||||
|
mainWindow.webContents.session.setSpellCheckerEnabled(store.get("spellCheckerEnabled", true));
|
||||||
|
|
||||||
// Create trayIcon icon
|
// Create trayIcon icon
|
||||||
if (store.get('minimizeToTray', true)) tray.create(trayConfig);
|
if (store.get('minimizeToTray', true)) tray.create(trayConfig);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user