From c2d7809e055053b583ee958c9b570705dd7688d0 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Fri, 18 May 2018 14:23:36 +0100 Subject: [PATCH] Add removeWord so that learning word removes all highlights for given word --- .../aceEditor/spell-check/HighlightedWordManager.coffee | 6 ++++++ .../aceEditor/spell-check/SpellCheckManager.coffee | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee index c36edb309c..daeb4cc034 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/HighlightedWordManager.coffee @@ -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 diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee index 89e3d1509d..cbe4fdbd64 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee @@ -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)