mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 04:05:25 -05:00
Unbind unload listener when destroying editor
This commit is contained in:
parent
e5ad2a8724
commit
6c7e942470
1 changed files with 5 additions and 2 deletions
|
@ -386,15 +386,18 @@ define [
|
|||
e.oldSession?.selection.off 'changeCursor', cursorPositionManager.onCursorChange
|
||||
e.session.selection.on 'changeCursor', cursorPositionManager.onCursorChange
|
||||
|
||||
onUnloadForCursorPosition = () ->
|
||||
cursorPositionManager.onUnload(editor.getSession())
|
||||
|
||||
initCursorPosition = () ->
|
||||
cursorPositionManager.init()
|
||||
editor.on 'changeSession', onSessionChangeForCursorPosition
|
||||
onSessionChangeForCursorPosition({ session: editor.getSession() }) # Force initial setup
|
||||
$(window).on "unload", () ->
|
||||
cursorPositionManager.onUnload(editor.getSession())
|
||||
$(window).on "unload", onUnloadForCursorPosition
|
||||
|
||||
tearDownCursorPosition = () ->
|
||||
editor.off 'changeSession', onSessionChangeForCursorPosition
|
||||
$(window).off "unload", onUnloadForCursorPosition
|
||||
|
||||
attachToAce = (sharejs_doc) ->
|
||||
lines = sharejs_doc.getSnapshot().split("\n")
|
||||
|
|
Loading…
Reference in a new issue