mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 02:51:57 +02:00
prevent spell check from running twice on doc load
This commit is contained in:
@@ -19,7 +19,7 @@ define [
|
||||
@runCheckOnChange(e)
|
||||
|
||||
@editor.on "changeSession", (e) =>
|
||||
@runFullCheck()
|
||||
@runSpellCheckSoon(200)
|
||||
|
||||
e.oldSession?.getDocument().off "change", onChange
|
||||
e.session.getDocument().on "change", onChange
|
||||
@@ -100,14 +100,14 @@ define [
|
||||
end: cursor
|
||||
return highlight
|
||||
|
||||
runSpellCheckSoon: () ->
|
||||
runSpellCheckSoon: (delay = 1000) ->
|
||||
run = () =>
|
||||
delete @timeoutId
|
||||
@runSpellCheck(@updatedLines)
|
||||
@updatedLines = []
|
||||
if @timeoutId?
|
||||
clearTimeout @timeoutId
|
||||
@timeoutId = setTimeout run, 1000
|
||||
@timeoutId = setTimeout run, delay
|
||||
|
||||
markLinesAsUpdated: (change) ->
|
||||
start = change.range.start
|
||||
|
||||
Reference in New Issue
Block a user