Implemented Spell checker

This commit is contained in:
Kiran Niranjan 2017-07-25 14:27:57 +05:30 committed by Kiran Niranjan
parent dec95759e8
commit 6485324677
5 changed files with 43 additions and 7 deletions

View File

@ -2,4 +2,8 @@
<head>
</head>
Test Window has been opened
<p>
<label for='tag'>tag:</label>
<input type='text' id='tag' value=''/>
</p>
</html>

View File

@ -18,6 +18,7 @@ const apiEnums = require('../enums/api.js');
const apiCmds = apiEnums.cmds;
const apiName = apiEnums.apiName;
const getMediaSources = require('../desktopCapturer/getSources');
const SpellCheckerHelper = require('../spellChecker/spellChecker').SpellCheckHelper;
require('../downloadManager/downloadManager');
@ -328,4 +329,8 @@ function createAPI() {
window.addEventListener('online', updateOnlineStatus, false);
updateOnlineStatus();
// Method to initialize spell checker
const spellChecker = new SpellCheckerHelper();
spellChecker.initializeSpellChecker();
}

View File

@ -0,0 +1,25 @@
const { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } = require('electron-spellchecker');
class SpellCheckHelper {
constructor() {
this.spellCheckHandler = new SpellCheckHandler();
}
/**
* To initialize for a specific window
*/
initializeSpellChecker() {
this.spellCheckHandler.attachToInput();
const contextMenuBuilder = new ContextMenuBuilder(this.spellCheckHandler);
this.contextMenuListener = new ContextMenuListener((info) => {
contextMenuBuilder.showPopupMenu(info);
}, null, null);
}
}
module.exports = {
SpellCheckHelper: SpellCheckHelper
};

View File

@ -22,7 +22,8 @@ const { getConfigField, updateConfigField } = require('./config.js');
const { isNodeEnv } = require('./utils/misc');
//context menu
const contextMenu = require('./menus/contextMenu.js');
// TODO: remove this once spell checker is ready
//const contextMenu = require('./menus/contextMenu.js');
// show dialog when certificate errors occur
require('./dialogs/showCertError.js');
@ -319,7 +320,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
}
});
contextMenu(mainWindow);
//contextMenu(mainWindow);
}
app.on('before-quit', function () {

View File

@ -14,7 +14,7 @@
"unpacked-win": "npm run prebuild && npm run test && build --win --x64 --dir",
"unpacked-win-x86": "npm run prebuild && npm run test && build --win --ia32",
"prebuild": "npm run rebuild && npm run browserify-preload",
"browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js",
"browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --external electron-spellchecker js/preload/preloadMain.js > js/preload/_preloadMain.js",
"rebuild": "electron-rebuild -f",
"test": "npm run lint && jest --verbose --testPathPattern test && npm run rebuild && npm run spectron-test",
"spectron-test": "jest --config tests/spectron/jest_spectron.json --runInBand && npm run rebuild",
@ -87,15 +87,16 @@
},
"dependencies": {
"@paulcbetts/system-idle-time": "^1.0.4",
"appdirectory": "^0.1.0",
"async": "^2.1.5",
"auto-launch": "^5.0.1",
"electron-context-menu": "^0.8.0",
"electron-squirrel-startup": "^1.0.0",
"keymirror": "0.1.1",
"winreg": "^1.2.3",
"electron-dl": "^1.9.0",
"electron-spellchecker": "^1.2.0",
"electron-squirrel-startup": "^1.0.0",
"filesize": "^3.5.10",
"appdirectory": "^0.1.0"
"keymirror": "0.1.1",
"winreg": "^1.2.3"
},
"optionalDependencies": {
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet.git#v1.0.1"