mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-12 19:23:13 +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()) ->
|
setLanguage: (lang="", dict=@_getDictionaryPath()) ->
|
||||||
@languageAvailable = @isLanguageAvailable(lang)
|
@languageAvailable = @isLanguageAvailable(lang)
|
||||||
if @languageAvailable or process.platform is 'linux'
|
if @languageAvailable
|
||||||
spellCheck = @isSpelledCorrectly
|
spellCheck = @isSpelledCorrectly
|
||||||
else
|
else
|
||||||
spellCheck = -> true
|
spellCheck = -> true
|
||||||
|
@ -53,16 +53,22 @@ class NylasSpellchecker
|
||||||
add: spellchecker.add
|
add: spellchecker.add
|
||||||
|
|
||||||
isMisspelled: (text) =>
|
isMisspelled: (text) =>
|
||||||
if @languageAvailable or process.platform is 'linux'
|
if @languageAvailable
|
||||||
spellchecker.isMisspelled(text)
|
spellchecker.isMisspelled(text)
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
|
|
||||||
getAvailableDictionaries: ->
|
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...) =>
|
getCorrectionsForMisspelling: (args...) =>
|
||||||
if @languageAvailable or process.platform is 'linux'
|
if @languageAvailable
|
||||||
spellchecker.getCorrectionsForMisspelling(args...)
|
spellchecker.getCorrectionsForMisspelling(args...)
|
||||||
else return []
|
else return []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue