Add removeWord so that learning word removes all highlights for given word

This commit is contained in:
Alasdair Smith 2018-05-18 14:23:36 +01:00
parent a719ac6e6e
commit c2d7809e05
2 changed files with 7 additions and 1 deletions

View file

@ -45,6 +45,12 @@ define [
@highlights = @highlights.filter (hl) ->
hl != highlight
removeWord: (word) ->
@highlights.filter (highlight) ->
highlight.word == word
.forEach (highlight) =>
@removeHighlight(highlight)
clearRow: (row) ->
@highlights.filter (highlight) ->
highlight.range.start.row == row

View file

@ -76,7 +76,7 @@ define [], () ->
learnWord: (highlight) =>
@apiRequest "/learn", word: highlight.word
@adapter.highlightedWordManager.removeHighlight highlight
@adapter.highlightedWordManager.removeWord highlight.word
language = @$scope.spellCheckLanguage
@cache?.put("#{language}:#{highlight.word}", true)