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.

Methods

name summary defined by
add() Adds a new undo level/snapshot to the undo list. tinymce.UndoManager
beforeChange() Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been made. tinymce.UndoManager
clear() Removes all undo levels. tinymce.UndoManager
extra() 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. tinymce.UndoManager
hasRedo() Returns true/false if the undo manager has any redo levels. tinymce.UndoManager
hasUndo() Returns true/false if the undo manager has any undo levels. tinymce.UndoManager
redo() Redoes the last action. tinymce.UndoManager
transact() 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 methods within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent. tinymce.UndoManager
undo() Undoes the last action. tinymce.UndoManager

Methods

add

add(level:Object, event:DOMEvent):Object

Adds a new undo level/snapshot to the undo list.

Parameters
Return value

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.

clear

clear()

Removes all undo levels.

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.

Parameters

hasRedo

hasRedo():Boolean

Returns true/false if the undo manager has any redo levels.

Return value

hasUndo

hasUndo():Boolean

Returns true/false if the undo manager has any undo levels.

Return value

redo

redo():Object

Redoes the last action.

Return value

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 methods within the translation that adds undo levels will be ignored. So a translation can include calls to execCommand or editor.insertContent.

Parameters
Return value

undo

undo():Object

Undoes the last action.

Return value

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.