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.js29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/webview/plugin.js b/src/webview/plugin.js
index ffc9084e4..9903ee07a 100644
--- a/src/webview/plugin.js
+++ b/src/webview/plugin.js
@@ -1,11 +1,12 @@
1const { ipcRenderer } = require('electron'); 1import { ipcRenderer } from 'electron';
2const path = require('path'); 2import { ContextMenuListener, ContextMenuBuilder } from 'electron-spellchecker';
3import path from 'path';
3 4
4const RecipeWebview = require('./lib/RecipeWebview'); 5import { isDevMode } from '../environment';
6import RecipeWebview from './lib/RecipeWebview';
5 7
6require('./notifications.js'); 8import Spellchecker from './spellchecker.js';
7require('./spellchecker.js'); 9import './notifications.js';
8require('./ime.js');
9 10
10ipcRenderer.on('initializeRecipe', (e, data) => { 11ipcRenderer.on('initializeRecipe', (e, data) => {
11 const modulePath = path.join(data.recipe.path, 'webview.js'); 12 const modulePath = path.join(data.recipe.path, 'webview.js');
@@ -19,6 +20,22 @@ ipcRenderer.on('initializeRecipe', (e, data) => {
19 } 20 }
20}); 21});
21 22
23const spellchecker = new Spellchecker();
24spellchecker.initialize();
25
26const contextMenuBuilder = new ContextMenuBuilder(spellchecker.handler, null, isDevMode);
27
28new ContextMenuListener((info) => { // eslint-disable-line
29 contextMenuBuilder.showPopupMenu(info);
30});
31
32ipcRenderer.on('settings-update', (e, data) => {
33 console.log('settings-update', data);
34 spellchecker.toggleSpellchecker(data.enableSpellchecking);
35});
36
37// initSpellche
38
22document.addEventListener('DOMContentLoaded', () => { 39document.addEventListener('DOMContentLoaded', () => {
23 ipcRenderer.sendToHost('hello'); 40 ipcRenderer.sendToHost('hello');
24}, false); 41}, false);