aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/plugin.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-11-14 21:04:41 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-11-14 21:04:41 +0100
commitdcab45a323f53a10ff5f419daa5ba6442817eebc (patch)
treeb9212d00a8c3a088292180d72895dfeef3536ed1 /src/webview/plugin.js
parent[wip] share user settings with service (diff)
downloadferdium-app-dcab45a323f53a10ff5f419daa5ba6442817eebc.tar.gz
ferdium-app-dcab45a323f53a10ff5f419daa5ba6442817eebc.tar.zst
ferdium-app-dcab45a323f53a10ff5f419daa5ba6442817eebc.zip
feat(App): Add option to enable/disable spell checker
Diffstat (limited to 'src/webview/plugin.js')
-rw-r--r--src/webview/plugin.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/webview/plugin.js b/src/webview/plugin.js
index fec353f34..c877132b1 100644
--- a/src/webview/plugin.js
+++ b/src/webview/plugin.js
@@ -3,10 +3,12 @@ import path from 'path';
3 3
4import RecipeWebview from './lib/RecipeWebview'; 4import RecipeWebview from './lib/RecipeWebview';
5 5
6import './spellchecker.js'; 6import Spellchecker from './spellchecker.js';
7import './notifications.js'; 7import './notifications.js';
8import './ime.js'; 8import './ime.js';
9 9
10const spellchecker = new Spellchecker();
11
10ipcRenderer.on('initializeRecipe', (e, data) => { 12ipcRenderer.on('initializeRecipe', (e, data) => {
11 const modulePath = path.join(data.recipe.path, 'webview.js'); 13 const modulePath = path.join(data.recipe.path, 'webview.js');
12 // Delete module from cache 14 // Delete module from cache
@@ -20,7 +22,17 @@ ipcRenderer.on('initializeRecipe', (e, data) => {
20}); 22});
21 23
22ipcRenderer.on('settings-update', (e, data) => { 24ipcRenderer.on('settings-update', (e, data) => {
23 console.log(data); 25 if (data.enableSpellchecking) {
26 if (!spellchecker.isEnabled) {
27 spellchecker.enable();
28
29 // TODO: this does not work yet, needs more testing
30 // if (data.spellcheckingLanguage !== 'auto') {
31 // console.log('set spellchecking language to', data.spellcheckingLanguage);
32 // spellchecker.switchLanguage(data.spellcheckingLanguage);
33 // }
34 }
35 }
24}); 36});
25 37
26document.addEventListener('DOMContentLoaded', () => { 38document.addEventListener('DOMContentLoaded', () => {