disable spellchecker

This commit is contained in:
Nicolas Constant 2020-09-04 22:19:49 -04:00
parent 4e453903f2
commit 8f03d7f19e
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 31 additions and 4 deletions

View File

@ -1,4 +1,4 @@
const { app, Menu, BrowserWindow, shell } = require("electron"); const { app, Menu, MenuItem, BrowserWindow, shell } = require("electron");
// Keep a global reference of the window object, if you don't, the window will // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
@ -12,6 +12,9 @@ function createWindow() {
title: "Sengi", title: "Sengi",
backgroundColor: "#131925", backgroundColor: "#131925",
useContentSize: true, useContentSize: true,
webPreferences: {
spellcheck: false
}
// webPreferences: { // webPreferences: {
// contextIsolation: true, // contextIsolation: true,
// nodeIntegration: false, // nodeIntegration: false,
@ -21,7 +24,7 @@ function createWindow() {
win.setAutoHideMenuBar(true); win.setAutoHideMenuBar(true);
win.setMenuBarVisibility(false); win.setMenuBarVisibility(false);
const sengiUrl = "https://sengi.nicolas-constant.com"; const sengiUrl = "https://sengi.nicolas-constant.com";
win.loadURL(sengiUrl); win.loadURL(sengiUrl);
@ -75,7 +78,7 @@ function createWindow() {
Menu.buildFromTemplate([ Menu.buildFromTemplate([
{ {
label: "Sengi", label: "Sengi",
submenu: [ submenu: [
{ role: "close" }, { role: "close" },
{ role: 'quit' } { role: 'quit' }
] ]
@ -114,7 +117,7 @@ function createWindow() {
} }
}, },
{ type: "separator" }, { type: "separator" },
{ role: "reload" }, { role: "reload" },
{ role: "forcereload" }, { role: "forcereload" },
{ type: 'separator' }, { type: 'separator' },
{ role: 'togglefullscreen' } { role: 'togglefullscreen' }
@ -156,6 +159,30 @@ function createWindow() {
// when you should delete the corresponding element. // when you should delete the corresponding element.
win = null; win = null;
}); });
// win.webContents.on('context-menu', (event, params) => {
// const menu = new Menu();
// // Add each spelling suggestion
// for (const suggestion of params.dictionarySuggestions) {
// menu.append(new MenuItem({
// label: suggestion,
// click: () => mainWindow.webContents.replaceMisspelling(suggestion)
// }));
// }
// // Allow users to add the misspelled word to the dictionary
// if (params.misspelledWord) {
// menu.append(
// new MenuItem({
// label: 'Add to dictionary',
// click: () => mainWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)
// }));
// }
// menu.popup();
// });
} }
app.commandLine.appendSwitch("force-color-profile", "srgb"); app.commandLine.appendSwitch("force-color-profile", "srgb");