mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge branch 'sk-safari-freeze-fix'
This commit is contained in:
commit
749d2aa013
2 changed files with 25 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue