mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
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:
commit
51b76d2cf9
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue