aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/plugin.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/plugin.js')
-rw-r--r--src/webview/plugin.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/webview/plugin.js b/src/webview/plugin.js
index ffc9084e4..c877132b1 100644
--- a/src/webview/plugin.js
+++ b/src/webview/plugin.js
@@ -1,11 +1,13 @@
1const { ipcRenderer } = require('electron'); 1import { ipcRenderer } from 'electron';
2const path = require('path'); 2import path from 'path';
3 3
4const RecipeWebview = require('./lib/RecipeWebview'); 4import RecipeWebview from './lib/RecipeWebview';
5 5
6require('./notifications.js'); 6import Spellchecker from './spellchecker.js';
7require('./spellchecker.js'); 7import './notifications.js';
8require('./ime.js'); 8import './ime.js';
9
10const spellchecker = new Spellchecker();
9 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');
@@ -19,6 +21,20 @@ ipcRenderer.on('initializeRecipe', (e, data) => {
19 } 21 }
20}); 22});
21 23
24ipcRenderer.on('settings-update', (e, 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 }
36});
37
22document.addEventListener('DOMContentLoaded', () => { 38document.addEventListener('DOMContentLoaded', () => {
23 ipcRenderer.sendToHost('hello'); 39 ipcRenderer.sendToHost('hello');
24}, false); 40}, false);