diff options
author | 2020-06-21 09:19:59 +0200 | |
---|---|---|
committer | 2020-06-21 12:49:59 +0530 | |
commit | 0d6d623d1e34cdbff2d46229165b49289a9a0619 (patch) | |
tree | 83f6a22a08e354da58adf3ed0393f4d39bca6124 /src/webview/recipe.js | |
parent | Prepare and Release/5.6.0 beta.1 (#820) (diff) | |
download | ferdium-app-0d6d623d1e34cdbff2d46229165b49289a9a0619.tar.gz ferdium-app-0d6d623d1e34cdbff2d46229165b49289a9a0619.tar.zst ferdium-app-0d6d623d1e34cdbff2d46229165b49289a9a0619.zip |
Add FAB to service dashboard (#824)
* Implement #387
* Fix lint
* Upgrade to Electron 9
* Remove dependency on electron-spellchecker
* Allow multiple languages to be selected
* Fix lint
* Don't show spellchecker language chooser for macOS
* Fix _requireAuthenticatedUser throwing error on startup
* Add FAB
Diffstat (limited to 'src/webview/recipe.js')
-rw-r--r-- | src/webview/recipe.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index b0aefd9c1..c6724e35a 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -65,7 +65,18 @@ class RecipeController { | |||
65 | } | 65 | } |
66 | 66 | ||
67 | @computed get spellcheckerLanguage() { | 67 | @computed get spellcheckerLanguage() { |
68 | return this.settings.service.spellcheckerLanguage || this.settings.app.spellcheckerLanguage; | 68 | let selected; |
69 | const langs = this.settings.service.spellcheckerLanguage || this.settings.app.spellcheckerLanguage; | ||
70 | if (typeof langs === 'string' && langs.substr(0, 1) === '[') { | ||
71 | // Value is JSON encoded | ||
72 | selected = JSON.parse(langs); | ||
73 | } else if (typeof langs === 'object') { | ||
74 | selected = langs; | ||
75 | } else { | ||
76 | selected = [langs]; | ||
77 | } | ||
78 | |||
79 | return selected; | ||
69 | } | 80 | } |
70 | 81 | ||
71 | cldIdentifier = null; | 82 | cldIdentifier = null; |
@@ -165,11 +176,11 @@ class RecipeController { | |||
165 | 176 | ||
166 | if (this.settings.app.enableSpellchecking) { | 177 | if (this.settings.app.enableSpellchecking) { |
167 | debug('Setting spellchecker language to', this.spellcheckerLanguage); | 178 | debug('Setting spellchecker language to', this.spellcheckerLanguage); |
168 | let { spellcheckerLanguage } = this; | 179 | const { spellcheckerLanguage } = this; |
169 | if (spellcheckerLanguage === 'automatic') { | 180 | if (spellcheckerLanguage.includes('automatic')) { |
170 | this.automaticLanguageDetection(); | 181 | this.automaticLanguageDetection(); |
171 | debug('Found `automatic` locale, falling back to user locale until detected', this.settings.app.locale); | 182 | debug('Found `automatic` locale, falling back to user locale until detected', this.settings.app.locale); |
172 | spellcheckerLanguage = this.settings.app.locale; | 183 | spellcheckerLanguage.push(this.settings.app.locale); |
173 | } else if (this.cldIdentifier) { | 184 | } else if (this.cldIdentifier) { |
174 | this.cldIdentifier.destroy(); | 185 | this.cldIdentifier.destroy(); |
175 | } | 186 | } |
@@ -318,7 +329,10 @@ class RecipeController { | |||
318 | const spellcheckerLocale = getSpellcheckerLocaleByFuzzyIdentifier(findResult.language); | 329 | const spellcheckerLocale = getSpellcheckerLocaleByFuzzyIdentifier(findResult.language); |
319 | debug('Language detected reliably, setting spellchecker language to', spellcheckerLocale); | 330 | debug('Language detected reliably, setting spellchecker language to', spellcheckerLocale); |
320 | if (spellcheckerLocale) { | 331 | if (spellcheckerLocale) { |
321 | switchDict(spellcheckerLocale); | 332 | switchDict([ |
333 | ...this.spellcheckerLanguage, | ||
334 | spellcheckerLocale, | ||
335 | ]); | ||
322 | } | 336 | } |
323 | } | 337 | } |
324 | }, 225)); | 338 | }, 225)); |