diff options
Diffstat (limited to 'src/webview/plugin.js')
-rw-r--r-- | src/webview/plugin.js | 29 |
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 @@ | |||
1 | const { ipcRenderer } = require('electron'); | 1 | import { ipcRenderer } from 'electron'; |
2 | const path = require('path'); | 2 | import { ContextMenuListener, ContextMenuBuilder } from 'electron-spellchecker'; |
3 | import path from 'path'; | ||
3 | 4 | ||
4 | const RecipeWebview = require('./lib/RecipeWebview'); | 5 | import { isDevMode } from '../environment'; |
6 | import RecipeWebview from './lib/RecipeWebview'; | ||
5 | 7 | ||
6 | require('./notifications.js'); | 8 | import Spellchecker from './spellchecker.js'; |
7 | require('./spellchecker.js'); | 9 | import './notifications.js'; |
8 | require('./ime.js'); | ||
9 | 10 | ||
10 | ipcRenderer.on('initializeRecipe', (e, data) => { | 11 | ipcRenderer.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 | ||
23 | const spellchecker = new Spellchecker(); | ||
24 | spellchecker.initialize(); | ||
25 | |||
26 | const contextMenuBuilder = new ContextMenuBuilder(spellchecker.handler, null, isDevMode); | ||
27 | |||
28 | new ContextMenuListener((info) => { // eslint-disable-line | ||
29 | contextMenuBuilder.showPopupMenu(info); | ||
30 | }); | ||
31 | |||
32 | ipcRenderer.on('settings-update', (e, data) => { | ||
33 | console.log('settings-update', data); | ||
34 | spellchecker.toggleSpellchecker(data.enableSpellchecking); | ||
35 | }); | ||
36 | |||
37 | // initSpellche | ||
38 | |||
22 | document.addEventListener('DOMContentLoaded', () => { | 39 | document.addEventListener('DOMContentLoaded', () => { |
23 | ipcRenderer.sendToHost('hello'); | 40 | ipcRenderer.sendToHost('hello'); |
24 | }, false); | 41 | }, false); |