Skip to content

Commit

Permalink
feat: added spellcheck using MS Editor using UA as Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-alarcon committed Jul 28, 2023
1 parent 7e353e8 commit db400fc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 57 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/controller/client-injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ module.exports = (relpath) => {
console.log(`Prepare %o to be injected.`, relpath)
cache[relpath] = fs.readFileSync(`${fullpath}`).toString()
return cache[relpath]
}
}
56 changes: 1 addition & 55 deletions src/controller/mail-window-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,
Expand All @@ -265,9 +214,6 @@ class MailWindowController {
clipboard.writeText(params.linkText, 'selection');
}
}))
menu.append(new MenuItem({
type: 'separator'
}))
}
//console.log(params)

Expand Down
2 changes: 1 addition & 1 deletion src/controller/tray-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ class TrayController {
}
}

module.exports = TrayController
module.exports = TrayController

0 comments on commit db400fc

Please sign in to comment.