Implement simple spellchecker

This commit is contained in:
Yuya Ochiai
2017-04-20 21:32:34 +09:00
parent 4d884a217a
commit 84d0ec432a
15 changed files with 312 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
const electron = require('electron');
const ipc = electron.ipcRenderer;
const webFrame = electron.webFrame;
const notification = require('../js/notification');
Reflect.deleteProperty(global.Buffer); // http://electron.atom.io/docs/tutorial/security/#buffer-global
@@ -146,3 +147,11 @@ notification.override({
ipc.sendToHost('onNotificationClick');
}
});
const spellCheckerLocale = ipc.sendSync('get-spellchecker-locale');
webFrame.setSpellCheckProvider(spellCheckerLocale, false, {
spellCheck(text) {
const res = ipc.sendSync('checkspell', text);
return res === null ? true : res;
}
});