mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 23:20:46 +00:00
Be more consistent with naming
This commit is contained in:
parent
846f27f0ad
commit
681e67ecea
3 changed files with 12 additions and 12 deletions
|
@ -6,7 +6,7 @@ define [
|
|||
|
||||
class SpellCheckAdapter
|
||||
constructor: (@editor) ->
|
||||
@wordManager = new HighlightedWordManager(@editor)
|
||||
@highlightedWordManager = new HighlightedWordManager(@editor)
|
||||
|
||||
getLines: () ->
|
||||
@editor.getValue().split('\n')
|
||||
|
@ -25,7 +25,7 @@ define [
|
|||
|
||||
getHighlightFromCoords: (coords) ->
|
||||
position = @editor.renderer.screenToTextCoordinates(coords.x, coords.y)
|
||||
@wordManager.findHighlightWithinRange({
|
||||
@highlightedWordManager.findHighlightWithinRange({
|
||||
start: position
|
||||
end: position
|
||||
})
|
||||
|
|
|
@ -36,12 +36,12 @@ define [], () ->
|
|||
if @isSpellCheckEnabled()
|
||||
@markLinesAsUpdated(@adapter.normalizeChangeEvent(e))
|
||||
|
||||
@adapter.wordManager.clearHighlightTouchingRange(e)
|
||||
@adapter.highlightedWordManager.clearHighlightTouchingRange(e)
|
||||
|
||||
@runSpellCheckSoon()
|
||||
|
||||
onSessionChange: () =>
|
||||
@adapter.wordManager.reset()
|
||||
@adapter.highlightedWordManager.reset()
|
||||
@inProgressRequest.abort() if @inProgressRequest?
|
||||
|
||||
@runSpellCheckSoon(200) if @isSpellCheckEnabled()
|
||||
|
@ -76,12 +76,12 @@ define [], () ->
|
|||
|
||||
learnWord: (highlight) =>
|
||||
@apiRequest "/learn", word: highlight.word
|
||||
@adapter.wordManager.removeHighlight highlight
|
||||
@adapter.highlightedWordManager.removeHighlight highlight
|
||||
language = @$scope.spellCheckLanguage
|
||||
@cache?.put("#{language}:#{highlight.word}", true)
|
||||
|
||||
runFullCheck: () ->
|
||||
@adapter.wordManager.reset()
|
||||
@adapter.highlightedWordManager.reset()
|
||||
@runSpellCheck() if @isSpellCheckEnabled()
|
||||
|
||||
markLinesAsUpdated: (change) ->
|
||||
|
@ -146,11 +146,11 @@ define [], () ->
|
|||
displayResult = (highlights) =>
|
||||
if linesToProcess?
|
||||
for shouldProcess, row in linesToProcess
|
||||
@adapter.wordManager.clearRow(row) if shouldProcess
|
||||
@adapter.highlightedWordManager.clearRow(row) if shouldProcess
|
||||
else
|
||||
@adapter.wordManager.reset()
|
||||
@adapter.highlightedWordManager.reset()
|
||||
for highlight in highlights
|
||||
@adapter.wordManager.addHighlight highlight
|
||||
@adapter.highlightedWordManager.addHighlight highlight
|
||||
|
||||
if not words.length
|
||||
displayResult highlights
|
||||
|
|
|
@ -12,14 +12,14 @@ define [
|
|||
spellCheck: true
|
||||
spellCheckLanguage: 'en'
|
||||
}
|
||||
@wordManager = {
|
||||
@highlightedWordManager = {
|
||||
reset: sinon.stub()
|
||||
clearRow: sinon.stub()
|
||||
addHighlight: sinon.stub()
|
||||
}
|
||||
@adapter = {
|
||||
getLines: sinon.stub()
|
||||
wordManager: @wordManager
|
||||
highlightedWordManager: @highlightedWordManager
|
||||
}
|
||||
inject ($q, $http, $httpBackend, $cacheFactory) =>
|
||||
@$http = $http
|
||||
|
@ -43,4 +43,4 @@ define [
|
|||
@spellCheckManager.init()
|
||||
@timelord.tick(200)
|
||||
@$httpBackend.flush()
|
||||
expect(@wordManager.addHighlight).to.have.been.called
|
||||
expect(@highlightedWordManager.addHighlight).to.have.been.called
|
||||
|
|
Loading…
Add table
Reference in a new issue