Open brichwin opened 3 years ago
Hi @brichwin,
The TinyMCE developers have better understanding of this. I'll transfer this ticket to tinymce/tinymce
so they can answer these questions and transfer the ticket back so I can document the explanation. I'll keep an eye on this ticket in case it gets closed by accident rather than transferred.
Tyler
Nothing ever came of this? I’m also trying to work with the UndoManager, but can’t seem to get the desired functionality out of it. In my case, I just need to clear the redo stack (as if the user made a change, but without adding anything to the undo stack). Is this possible?
Sadly no, the index (which indicates where in the data
array the split from undo to redo begins) is a private variable.
https://github.com/tinymce/tinymce/blob/02a9b5480ffd56b4ffda14e5b8d0afb75c76ad3d/modules/tinymce/src/core/main/ts/api/UndoManager.ts#L19
You could possibly monitor for undo events and try to mirror the index, so you can shave off unwanted redo events, but I don't know how well that would work so I can't really recommend it.
This issue is stale because it has been open 365 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 30 days.
This would still be very useful.
I've tried to understand how to use the undo manager when authoring a TinyMCE plugin. I don't understand the overall philosophy:
For example, my plugin provides an interface for selecting text and wrapping it with a so they can markup the human language changes in the text. It does that by applying a format. I've tried every combo I can imagine to make it work with undo to no avail.