--- layout: compress --- TinyMCE | tinymce.UndoManager
0 results found

tinymce.UndoManager

Contribute to this page
Namespace tinymce
Class UndoManager

This class handles the undo/redo history levels for the editor. Since the build in undo/redo has major drawbacks a custom one was needed.

Public Methods

Method Defined By
add(l:Object):Object : Adds a new undo level/snapshot to the undo list. UndoManager
beforeChange():void : Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been mad... UndoManager
clear():void : Removes all undo levels. UndoManager
hasRedo():Boolean : Returns true/false if the undo manager has any redo levels. UndoManager
hasUndo():Boolean : Returns true/false if the undo manager has any undo levels. UndoManager
redo():Object : Redoes the last action. UndoManager
undo():Object : Undoes the last action. UndoManager

Public Events

Event Defined By
onAdd(sender:UndoManager, level:Object) : This event will fire each time a new undo level is added to the undo manager. UndoManager
onBeforeAdd(sender:UndoManager, level:Object) : This event will fire before a new undo level is added to the undo manager UndoManager
onRedo(sender:UndoManager, level:Object) : This event will fire when the user make an redo of a change. UndoManager
onUndo(sender:UndoManager, level:Object) : This event will fire when the user make an undo of a change. UndoManager

Method details

add

public function add(l:Object):Object
Adds a new undo level/snapshot to the undo list.

Parameters

Param Detail
l:Object Optional undo level object to add.

Returns
Object - Undo level that got added or null it a level wasn't needed.

beforeChange

public function beforeChange():void
Stores away a bookmark to be used when performing an undo action so that the selection is before the change has been made.

clear

public function clear():void
Removes all undo levels.

hasRedo

public function hasRedo():Boolean
Returns true/false if the undo manager has any redo levels.

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

hasUndo

public function hasUndo():Boolean
Returns true/false if the undo manager has any undo levels.

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

redo

public function redo():Object
Redoes the last action.

Returns
Object - Redo level or null if no redo was performed.

undo

public function undo():Object
Undoes the last action.

Returns
Object - Undo level or null if no undo was performed.

Event details

onAdd

public event onAdd(sender:UndoManager, level:Object)
This event will fire each time a new undo level is added to the undo manager.

Parameters

Param Detail
sender:UndoManager UndoManager instance that got the new level.
level:Object The new level object containing a bookmark and contents.

onBeforeAdd

public event onBeforeAdd(sender:UndoManager, level:Object)
This event will fire before a new undo level is added to the undo manager

Parameters

Param Detail
sender:UndoManager UndoManager instance that is going to add the new level
level:Object The new level object containing a bookmark and contents

onRedo

public event onRedo(sender:UndoManager, level:Object)
This event will fire when the user make an redo of a change.

Parameters

Param Detail
sender:UndoManager UndoManager instance that got the new level.
level:Object The old level object containing a bookmark and contents.

onUndo

public event onUndo(sender:UndoManager, level:Object)
This event will fire when the user make an undo of a change.

Parameters

Param Detail
sender:UndoManager UndoManager instance that got the new level.
level:Object The old level object containing a bookmark and contents.

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.