From db400fc03245d6d4f219a77ed354163cb16caf3f Mon Sep 17 00:00:00 2001 From: Julian Alarcon Date: Fri, 28 Jul 2023 17:22:17 +0200 Subject: [PATCH] feat: added spellcheck using MS Editor using UA as Chrome --- README.md | 1 + src/controller/client-injector.js | 2 +- src/controller/mail-window-controller.js | 56 +----------------------- src/controller/tray-controller.js | 2 +- 4 files changed, 4 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index fb993d0..847d952 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ For other distributions please follow your specific steps. * Dock tray support * System notification * Connect to standard or custom outlook url +* Spellcheck using native Outlook MS Editor ## Settings diff --git a/src/controller/client-injector.js b/src/controller/client-injector.js index 22f8a0f..7d8eb81 100644 --- a/src/controller/client-injector.js +++ b/src/controller/client-injector.js @@ -17,4 +17,4 @@ module.exports = (relpath) => { console.log(`Prepare %o to be injected.`, relpath) cache[relpath] = fs.readFileSync(`${fullpath}`).toString() return cache[relpath] -} \ No newline at end of file +} diff --git a/src/controller/mail-window-controller.js b/src/controller/mail-window-controller.js index 6facfe6..162c665 100644 --- a/src/controller/mail-window-controller.js +++ b/src/controller/mail-window-controller.js @@ -58,7 +58,7 @@ class MailWindowController { }) // and load the index.html of the app. - this.win.loadURL(outlookUrl) + this.win.loadURL(outlookUrl,{userAgent: 'Chrome'}); // Show window handler ipcMain.on('show', (event) => { @@ -194,58 +194,7 @@ class MailWindowController { event.preventDefault() //console.log('context-menu', params) let menu = new Menu() - if (params && params.dictionarySuggestions) { - let show = false - menu.append(new MenuItem({ - label: '- Spelling -', - enabled: false - })) - menu.append(new MenuItem({ - type: 'separator' - })) - if (params.misspelledWord) { - // allow them to add to dictionary - show = true - menu.append(new MenuItem({ - label: 'Add to dictionary', - click: () => tWin.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord) - })) - } - menu.append(new MenuItem({ - type: 'separator' - })) - if (params.dictionarySuggestions.length > 0) { - show = true - // add each spelling suggestion - for (const suggestion of params.dictionarySuggestions) { - menu.append(new MenuItem({ - label: suggestion, - click: () => tWin.webContents.replaceMisspelling(suggestion) - })) - } - } else { - // no suggestions - menu.append(new MenuItem({ - label: 'No Suggestions', - enabled: false - })) - } - - if (!show) { - menu = new Menu() //remove all previuos items - } - } - - if (menu.items.length > 0) { - menu.append(new MenuItem({ - type: 'separator' - })) - menu.append(new MenuItem({ - label: '- Edit -', - enabled: false - })) - } if (params.linkURL) { menu.append(new MenuItem({ label: params.linkURL.length > 50 ? (params.linkURL.substring(0, 50 - 3) + '...') : params.linkURL, @@ -265,9 +214,6 @@ class MailWindowController { clipboard.writeText(params.linkText, 'selection'); } })) - menu.append(new MenuItem({ - type: 'separator' - })) } //console.log(params) diff --git a/src/controller/tray-controller.js b/src/controller/tray-controller.js index d8245e2..77479e1 100644 --- a/src/controller/tray-controller.js +++ b/src/controller/tray-controller.js @@ -118,4 +118,4 @@ class TrayController { } } -module.exports = TrayController \ No newline at end of file +module.exports = TrayController