mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Fix a daft mistake, blank out whitelisted words, rather than remove
This had caused an issue whereby spelling-mistakes would be highlighted on the wrong word in the client. This was a function of how many whitelisted words had already occured in the sequence. An off-by-n error.
This commit is contained in:
@@ -23,8 +23,12 @@ module.exports = SpellingAPIManager =
|
||||
ASpell.checkWords lang, words, (error, misspellings) ->
|
||||
callback error, misspellings: misspellings
|
||||
|
||||
wordsToCheck = (request.words || []).filter (word) ->
|
||||
SpellingAPIManager.wordWhitelist.indexOf(word) == -1
|
||||
wordsToCheck = (request.words || []).map (word) ->
|
||||
# blank out whitelisted words
|
||||
if SpellingAPIManager.wordWhitelist.indexOf(word) == -1
|
||||
word
|
||||
else
|
||||
'...'
|
||||
|
||||
if token?
|
||||
LearnedWordsManager.getLearnedWords token, (error, learnedWords) ->
|
||||
|
||||
@@ -89,7 +89,7 @@ describe "SpellingAPIManager", ->
|
||||
@SpellingAPIManager.runRequest @token, words: @words, (error, @result) => done()
|
||||
|
||||
it 'should ignore the white-listed word', ->
|
||||
expect(@ASpell.checkWords.lastCall.args[1]).to.deep.equal ["One", "Two"]
|
||||
expect(@ASpell.checkWords.lastCall.args[1]).to.deep.equal ["One", "...", "Two"]
|
||||
|
||||
describe "learnWord", ->
|
||||
describe "without a token", ->
|
||||
|
||||
Reference in New Issue
Block a user