Merge pull request #413 from sharelatex/ja-abort-in-progress-spell-checks

Abort any inprogress spell checks when switching document
This commit is contained in:
James Allen 2017-02-08 11:38:05 +01:00 committed by GitHub
commit 51b76d2cf9

View file

@ -23,6 +23,8 @@ define [
@editor.on "changeSession", (e) =>
@highlightedWordManager.reset()
if @inProgressRequest?
@inProgressRequest.abort()
if @$scope.spellCheckEnabled and @$scope.spellCheckLanguage and @$scope.spellCheckLanguage != ""
@runSpellCheckSoon(200)
@ -185,7 +187,8 @@ define [
if not words.length
displayResult highlights
else
@apiRequest "/check", {language: language, words: words}, (error, result) =>
@inProgressRequest = @apiRequest "/check", {language: language, words: words}, (error, result) =>
delete @inProgressRequest
if error? or !result? or !result.misspellings?
return null
mispelled = []
@ -242,4 +245,4 @@ define [
callback null, data
error: (xhr, status, error) ->
callback error
$.ajax options
return $.ajax options