Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take care to not modify deltas in place when composing in undo-manager #387

Closed
wants to merge 1 commit into from

Conversation

thomsbg
Copy link
Contributor

@thomsbg thomsbg commented Jun 2, 2015

Fixes #296

@@ -51,8 +51,8 @@ class UndoManager
timestamp = new Date().getTime()
if @lastRecorded + @options.delay > timestamp and @stack.undo.length > 0
change = @stack.undo.pop()
undoDelta = undoDelta.compose(change.undo)
changeDelta = change.redo.compose(changeDelta)
undoDelta = new Delta().compose(undoDelta).compose(change.undo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works but might be more clear to use slice(). Passing no parameters will create a copy.

@thomsbg thomsbg closed this Jun 17, 2015
@thomsbg thomsbg deleted the fix-undo-manager branch December 28, 2016 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quill changes Delta after returning it in "text-change" event
2 participants