aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/spellchecker.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-12-08 22:33:58 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-12-08 22:33:58 +0100
commite5c1751c3dc691458ba9e870d4849e4872db2ff1 (patch)
tree6a1f94eaaf4b2a43e92b58b73eb651ce1fa5f1f9 /src/webview/spellchecker.js
parentOnly show loader on initial service load (diff)
downloadferdium-app-e5c1751c3dc691458ba9e870d4849e4872db2ff1.tar.gz
ferdium-app-e5c1751c3dc691458ba9e870d4849e4872db2ff1.tar.zst
ferdium-app-e5c1751c3dc691458ba9e870d4849e4872db2ff1.zip
Minor recipe plugin polishing
Diffstat (limited to 'src/webview/spellchecker.js')
-rw-r--r--src/webview/spellchecker.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js
index f1bae1cd7..becaed449 100644
--- a/src/webview/spellchecker.js
+++ b/src/webview/spellchecker.js
@@ -4,7 +4,6 @@ import path from 'path';
4 4
5import { DICTIONARY_PATH } from '../config'; 5import { DICTIONARY_PATH } from '../config';
6 6
7
8const debug = require('debug')('Franz:spellchecker'); 7const debug = require('debug')('Franz:spellchecker');
9 8
10let provider; 9let provider;
@@ -15,6 +14,7 @@ async function loadDictionary(locale) {
15 try { 14 try {
16 const fileLocation = path.join(DICTIONARY_PATH, `hunspell-dict-${locale}/${locale}`); 15 const fileLocation = path.join(DICTIONARY_PATH, `hunspell-dict-${locale}/${locale}`);
17 await provider.loadDictionary(locale, `${fileLocation}.dic`, `${fileLocation}.aff`); 16 await provider.loadDictionary(locale, `${fileLocation}.dic`, `${fileLocation}.aff`);
17 debug('Loaded dictionary', locale, 'from', fileLocation);
18 } catch (err) { 18 } catch (err) {
19 console.error('Could not load dictionary', err); 19 console.error('Could not load dictionary', err);
20 } 20 }
@@ -36,7 +36,9 @@ export async function switchDict(locale) {
36 return; 36 return;
37 } 37 }
38 38
39 provider.unloadDictionary(locale); 39 if (currentDict) {
40 provider.unloadDictionary(locale);
41 }
40 loadDictionary(locale); 42 loadDictionary(locale);
41 provider.switchDictionary(locale); 43 provider.switchDictionary(locale);
42 44