mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 04:41:32 +02:00
Merge branch 'sk-safari-freeze-fix'
This commit is contained in:
@@ -112,4 +112,17 @@ define [
|
||||
|
||||
ide.localStorage = localStorage
|
||||
|
||||
ide.browserIsSafari = false
|
||||
try
|
||||
userAgent = navigator.userAgent
|
||||
ide.browserIsSafari = (
|
||||
userAgent &&
|
||||
userAgent.match(/.*Safari\/.*/) &&
|
||||
!userAgent.match(/.*Chrome\/.*/) &&
|
||||
!userAgent.match(/.*Chromium\/.*/)
|
||||
)
|
||||
catch err
|
||||
console.error err
|
||||
|
||||
|
||||
angular.bootstrap(document.body, ["SharelatexApp"])
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
define [], () ->
|
||||
|
||||
class Parser
|
||||
constructor: (@doc) ->
|
||||
|
||||
parse: () ->
|
||||
# Safari regex is super slow, freezes browser for minutes on end,
|
||||
# hacky solution: limit iterations
|
||||
limit = null
|
||||
if window?._ide?.browserIsSafari
|
||||
limit = 100
|
||||
|
||||
commands = []
|
||||
seen = {}
|
||||
iterations = 0
|
||||
while command = @nextCommand()
|
||||
iterations += 1
|
||||
if limit && iterations > limit
|
||||
return commands
|
||||
|
||||
docState = @doc
|
||||
|
||||
optionalArgs = 0
|
||||
|
||||
Reference in New Issue
Block a user