diff --git a/services/web/public/coffee/ide/editor/components/spellMenu.coffee b/services/web/public/coffee/ide/editor/components/spellMenu.coffee
index c3fd78efba..ff3462e03e 100644
--- a/services/web/public/coffee/ide/editor/components/spellMenu.coffee
+++ b/services/web/public/coffee/ide/editor/components/spellMenu.coffee
@@ -4,7 +4,7 @@ define ["base"], (App) ->
open: "<"
top: "<"
left: "<"
- suggestions: "<"
+ highlight: "<"
replaceWord: "&"
learnWord: "&"
}
@@ -16,12 +16,17 @@ define ["base"], (App) ->
ng-class="{open: $ctrl.open}"
>
diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee
index a30b93aaa0..34ffedcac8 100644
--- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee
+++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee
@@ -514,7 +514,9 @@ define [
open="spellMenu.open"
top="spellMenu.top"
left="spellMenu.left"
- suggestions="spellMenu.suggestions"
+ highlight="spellMenu.highlight"
+ replace-word="replaceWord(highlight, suggestion)"
+ learn-word="learnWord(highlight)"
>
+ @editor.getSession().replace(new Range(
+ highlight.row, highlight.column,
+ highlight.row, highlight.column + highlight.word.length
+ ), newWord)
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 c6b40c7b77..3d274abea4 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
@@ -14,6 +14,9 @@ define [], () ->
if language != oldLanguage and oldLanguage?
@runFullCheck()
+ @$scope.replaceWord = @adapter.replaceWord
+ @$scope.learnWord = @learnWord
+
init: () ->
@updatedLines = Array(@adapter.getLines().length).fill(true)
@runSpellCheckSoon(200) if @isSpellCheckEnabled()
@@ -53,7 +56,7 @@ define [], () ->
open: true
top: coords.y + 'px'
left: coords.x + 'px'
- suggestions: highlight.suggestions
+ highlight: highlight
}
@setUpClickOffContextMenuListener()
return false
@@ -70,6 +73,12 @@ define [], () ->
@$scope.$apply () =>
@$scope.spellMenu.open = false
+ learnWord: (highlight) =>
+ @apiRequest "/learn", word: highlight.word
+ @adapter.wordManager.removeHighlight highlight
+ language = @$scope.spellCheckLanguage
+ @cache?.put("#{language}:#{highlight.word}", true)
+
runFullCheck: () ->
@adapter.wordManager.reset()
@runSpellCheck() if @isSpellCheckEnabled()