Просмотр исходного кода

prevent spell check from running twice on doc load

Henry Oswald 12 лет назад
Родитель
Сommit
a2f99bc04f

+ 3 - 3
services/web/public/coffee/ide/editor/directives/aceEditor/spell-check/SpellCheckManager.coffee

@@ -19,7 +19,7 @@ define [
 				@runCheckOnChange(e)
 				@runCheckOnChange(e)
 
 
 			@editor.on "changeSession", (e) =>
 			@editor.on "changeSession", (e) =>
-				@runFullCheck()
+				@runSpellCheckSoon(200)
 
 
 				e.oldSession?.getDocument().off "change", onChange
 				e.oldSession?.getDocument().off "change", onChange
 				e.session.getDocument().on "change", onChange
 				e.session.getDocument().on "change", onChange
@@ -100,14 +100,14 @@ define [
 				end: cursor
 				end: cursor
 			return highlight
 			return highlight
 
 
-		runSpellCheckSoon: () ->
+		runSpellCheckSoon: (delay = 1000) ->
 			run = () =>
 			run = () =>
 				delete @timeoutId
 				delete @timeoutId
 				@runSpellCheck(@updatedLines)
 				@runSpellCheck(@updatedLines)
 				@updatedLines = []
 				@updatedLines = []
 			if @timeoutId?
 			if @timeoutId?
 				clearTimeout @timeoutId
 				clearTimeout @timeoutId
-			@timeoutId = setTimeout run, 1000
+			@timeoutId = setTimeout run, delay
 
 
 		markLinesAsUpdated: (change) ->
 		markLinesAsUpdated: (change) ->
 			start = change.range.start
 			start = change.range.start