mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Reset undo state when switching documents
This commit is contained in:
parent
d3fd161c25
commit
bb55d8f406
1 changed files with 7 additions and 0 deletions
|
@ -14,6 +14,7 @@ define [
|
|||
@nextUpdateIsRemote = false
|
||||
|
||||
@editor.on "changeSession", (e) =>
|
||||
@reset()
|
||||
e.session.setUndoManager(@)
|
||||
|
||||
showUndoConflictWarning: () ->
|
||||
|
@ -26,10 +27,16 @@ define [
|
|||
, 4000
|
||||
|
||||
reset: () ->
|
||||
@firstUpdate = true
|
||||
@undoStack = []
|
||||
@redoStack = []
|
||||
|
||||
execute: (options) ->
|
||||
if @firstUpdate
|
||||
# The first update we receive is Ace setting the document, which we should
|
||||
# ignore
|
||||
@firstUpdate = false
|
||||
return
|
||||
aceDeltaSets = options.args[0]
|
||||
@session = options.args[1]
|
||||
return if !aceDeltaSets?
|
||||
|
|
Loading…
Reference in a new issue