I'm using ace editor wrapped by react-ace for my project.
How can I destroy all undo/redo history in certain moment when I need it?
I've tried this.aceRef.editor.destroy();
(just react ref bound with editor), but unfortunately it doesn't play well in some circumstances. So, I just need to clean undo/redo session/history or something like that.
Any solution?
Ace editor actually has this reset
method with UndoManager
.
Then you need to assign temporary stored undomanager as base.
It could be done smth like that:
const { editor } = this.aceRef;
const session = editor.getSession();
const undoManager = session.getUndoManager();
undoManager.reset();
session.setUndoManager(undoManager);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.