From 8f03d7f19e7356d03ce2739b1592bccbe9b91ff3 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 4 Sep 2020 22:19:49 -0400 Subject: [PATCH] disable spellchecker --- main-electron.js | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/main-electron.js b/main-electron.js index 6cb015e2..1249be75 100644 --- a/main-electron.js +++ b/main-electron.js @@ -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 // be closed automatically when the JavaScript object is garbage collected. @@ -12,6 +12,9 @@ function createWindow() { title: "Sengi", backgroundColor: "#131925", useContentSize: true, + webPreferences: { + spellcheck: false + } // webPreferences: { // contextIsolation: true, // nodeIntegration: false, @@ -21,7 +24,7 @@ function createWindow() { win.setAutoHideMenuBar(true); win.setMenuBarVisibility(false); - + const sengiUrl = "https://sengi.nicolas-constant.com"; win.loadURL(sengiUrl); @@ -75,7 +78,7 @@ function createWindow() { Menu.buildFromTemplate([ { label: "Sengi", - submenu: [ + submenu: [ { role: "close" }, { role: 'quit' } ] @@ -114,7 +117,7 @@ function createWindow() { } }, { type: "separator" }, - { role: "reload" }, + { role: "reload" }, { role: "forcereload" }, { type: 'separator' }, { role: 'togglefullscreen' } @@ -156,6 +159,30 @@ function createWindow() { // when you should delete the corresponding element. 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");