mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 01:54:40 +08:00
fix(spellchecker): confine the linux changes to only 3 methods
The "it provides options for misspelled words" still fails with "asdfk" supposed to supply no corrections, which I find unlikely in the real world, and Hunspell provides corrections.
This commit is contained in:
parent
3c647ef2be
commit
a9047542f2
1 changed files with 10 additions and 4 deletions
|
@ -18,7 +18,7 @@ class NylasSpellchecker
|
|||
|
||||
setLanguage: (lang="", dict=@_getDictionaryPath()) ->
|
||||
@languageAvailable = @isLanguageAvailable(lang)
|
||||
if @languageAvailable or process.platform is 'linux'
|
||||
if @languageAvailable
|
||||
spellCheck = @isSpelledCorrectly
|
||||
else
|
||||
spellCheck = -> true
|
||||
|
@ -53,16 +53,22 @@ class NylasSpellchecker
|
|||
add: spellchecker.add
|
||||
|
||||
isMisspelled: (text) =>
|
||||
if @languageAvailable or process.platform is 'linux'
|
||||
if @languageAvailable
|
||||
spellchecker.isMisspelled(text)
|
||||
else
|
||||
return false
|
||||
|
||||
getAvailableDictionaries: ->
|
||||
spellchecker.getAvailableDictionaries() ? []
|
||||
if process.platform is 'linux'
|
||||
arr = spellchecker.getAvailableDictionaries()
|
||||
if not "en_US" in arr
|
||||
arr.push('en_US') # Installed by default in node-spellchecker's vendor directory
|
||||
arr
|
||||
else
|
||||
spellchecker.getAvailableDictionaries() ? []
|
||||
|
||||
getCorrectionsForMisspelling: (args...) =>
|
||||
if @languageAvailable or process.platform is 'linux'
|
||||
if @languageAvailable
|
||||
spellchecker.getCorrectionsForMisspelling(args...)
|
||||
else return []
|
||||
|
||||
|
|
Loading…
Reference in a new issue