tinymce.UndoManager
This class handles the undo/redo history levels for the editor. Since the built-in undo/redo has major drawbacks a custom one was needed.
Summary
Methods
Name | Summary | Defined by |
---|---|---|
Adds a new undo level/snapshot to the undo list. |
||
Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been made. |
||
Removes all undo levels. |
||
Adds an extra "hidden" undo level by first applying the first mutation and store that to the undo stack then roll back that change and do the second mutation on top of the stack. This will produce an extra undo level that the user doesn’t see until they undo. |
||
Returns true/false if the undo manager has any redo levels. |
||
Returns true/false if the undo manager has any undo levels. |
||
Executes the specified mutator function as an undo transaction. But without adding an undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent. |
||
Redoes the last action. |
||
Resets the undo manager levels by clearing all levels and then adding an initial level. |
||
Executes the specified mutator function as an undo transaction. The selection before the modification will be stored to the undo stack and if the DOM changes it will add a new undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent. |
||
Undoes the last action. |
Methods
add()
add(level: Object, event: DOMEvent): Object
Adds a new undo level/snapshot to the undo list.
beforeChange()
beforeChange()
Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been made.
extra()
extra(callback1: function, callback2: function)
Adds an extra "hidden" undo level by first applying the first mutation and store that to the undo stack then roll back that change and do the second mutation on top of the stack. This will produce an extra undo level that the user doesn’t see until they undo.
ignore()
ignore(callback: function)
Executes the specified mutator function as an undo transaction. But without adding an undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.
reset()
reset()
Resets the undo manager levels by clearing all levels and then adding an initial level.
transact()
transact(callback: function): Object
Executes the specified mutator function as an undo transaction. The selection before the modification will be stored to the undo stack and if the DOM changes it will add a new undo level. Any logic within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.