Просмотр исходного кода

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

Alasdair Smith 8 лет назад
Родитель
Сommit
c2d7809e05

+ 6 - 0
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

+ 1 - 1
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)