mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Abort any inprogress spell checks when switching document
This commit is contained in:
parent
123300cdfb
commit
87aea41bed
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