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

Transform the undo/redo stacks against non-user initiated changes #413

Merged
merged 4 commits into from Jul 17, 2015

Conversation

thomsbg
Copy link
Contributor

@thomsbg thomsbg commented Jul 13, 2015

This allows one to mark changes that should be "undoable" by specifying source = 'user', which is useful for a collaborative editing environment in which each client maintains their own undo / redo stack (instead of sharing a global one).

@jhchen
Copy link
Member

jhchen commented Jul 14, 2015

This is an excellent Pull Request. I've actually tried to add this myself in the past but didn't get a chance to nail down all the potential off by one errors. Just a couple of nit picks in the comments but otherwise looks great for merger.

@@ -33,7 +33,10 @@ class UndoManager
)
@quill.on(@quill.constructor.events.TEXT_CHANGE, (delta, origin) =>
Copy link
Member

Choose a reason for hiding this comment

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

Can you rename origin to source? That's the more common name in other parts of the codebase.

@thomsbg
Copy link
Contributor Author

thomsbg commented Jul 15, 2015

Nits addressed.

@benbro
Copy link
Contributor

benbro commented Jul 15, 2015

Is there a setting to configure undo to be global or per user?
I can see the benefit of undoing only your edits but in my use case I prefer that the user will be able to undo all changes.

@thomsbg
Copy link
Contributor Author

thomsbg commented Jul 15, 2015

Fair point @benbro. I'll make it configurable.

@thomsbg
Copy link
Contributor Author

thomsbg commented Jul 15, 2015

Updated to make this new behavior configurable via a userOnly: true option

@benbro
Copy link
Contributor

benbro commented Jul 15, 2015

Thank you for the userOnly option.

@jhchen
Copy link
Member

jhchen commented Jul 17, 2015

Since the default is userOnly: false can we change the tests back to what they were and just modify this in the new test?

@thomsbg
Copy link
Contributor Author

thomsbg commented Jul 17, 2015

Test updated.

@jhchen
Copy link
Member

jhchen commented Jul 17, 2015

Great thanks!

jhchen added a commit that referenced this pull request Jul 17, 2015
Transform the undo/redo stacks against non-user initiated changes
@jhchen jhchen merged commit b0b25c5 into quilljs:develop Jul 17, 2015
@thomsbg thomsbg deleted the transform-undo-manager branch October 7, 2015 13:35
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.

None yet

3 participants