mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-25 19:13:01 +00:00
destroy ace sessions when no longer in use
also set mode to "latex" when session is created, to avoid setting mode to "text" (default) and then to "latex" which causes the text worker to be unnecessarily created and destroyed.
This commit is contained in:
parent
0a350c8e3f
commit
d152095920
1 changed files with 4 additions and 2 deletions
|
@ -178,7 +178,6 @@ define [
|
|||
editor.setValue(text, -1)
|
||||
session = editor.getSession()
|
||||
session.setUseWrapMode(true)
|
||||
session.setMode("ace/mode/latex")
|
||||
|
||||
scope.$watch "annotations", (annotations) ->
|
||||
session = editor.getSession()
|
||||
|
@ -203,7 +202,10 @@ define [
|
|||
|
||||
attachToAce = (sharejs_doc) ->
|
||||
lines = sharejs_doc.getSnapshot().split("\n")
|
||||
editor.setSession(new EditSession(lines))
|
||||
session = editor.getSession()
|
||||
if session?
|
||||
session.destroy()
|
||||
editor.setSession(new EditSession(lines, "ace/mode/latex"))
|
||||
resetSession()
|
||||
session = editor.getSession()
|
||||
|
||||
|
|
Loading…
Reference in a new issue