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:
mbilker 2015-12-11 00:26:04 -05:00 committed by Evan Morikawa
parent 699d6369cc
commit 755f6024a3

View file

@ -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 []