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

Undo will always go back to empty document #24

Open
johngilden opened this issue Apr 27, 2018 · 1 comment
Open

Undo will always go back to empty document #24

johngilden opened this issue Apr 27, 2018 · 1 comment

Comments

@johngilden
Copy link

When I create an ember-ace instance bound to an existing value, ctrl-z will allow me to "undo" to the empty document, like that was the first state. This problem is known in other components of ace (react-ace). Additionally, it would be cool to have a manual reset of the undoState, i.e. if I change the content of the editor programmatically and would like to have that as a new "starting point".

@kliput
Copy link

kliput commented Apr 19, 2024

It passed 6 years since your message, but as we still use EmberAce 2.0.1 in our project, I found a simple solution: use ready hook of the component and launch this code:

aceEditor.getSession().getUndoManager().reset()

where aceEditor is the first argument of the callback.

You can additionally store reference to the session and use reset on the undoManager programmatically any time.

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

No branches or pull requests

2 participants