Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Electron Spellchecker Support #247

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
'use strict';
const electron = require('electron');
const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker');
const config = require('./config');

const {ipcRenderer: ipc} = electron;

// Spellchecking for user input
window.spellCheckHandler = new SpellCheckHandler();
window.spellCheckHandler.attachToInput();
window.spellCheckHandler.switchLanguage(navigator.language);
const contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler);
// eslint-disable-next-line no-unused-vars
const contextMenuListener = new ContextMenuListener(info => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this variable if it's never used? Could just call new ContextMenuListener directly?

contextMenuBuilder.showPopupMenu(info);
});

const listSelector = 'div[role="navigation"] > div > ul';
const conversationSelector = '._4u-c._1wfr > ._5f0v.uiScrollableArea';
const selectedConversationSelector = '._5l-3._1ht1._1ht2';
Expand Down
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ app.disableHardwareAcceleration();

require('electron-debug')({enabled: true});
require('electron-dl')();
require('electron-context-menu')();

let mainWindow;
let isQuitting = false;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"dist": "build"
},
"dependencies": {
"electron-context-menu": "^0.8.0",
"electron-debug": "^1.0.0",
"electron-dl": "^1.0.0",
"electron-is-dev": "^0.1.2",
"electron-localshortcut": "^2.0.0",
"electron-log": "^2.0.2",
"electron-spellchecker": "^1.1.0",
"electron-store": "^1.1.0",
"electron-updater": "^1.3.2",
"facebook-locales": "^1.0.464",
Expand Down