We use cookies to make our website more effective. By using our website you agree to our privacy policy.

Namespace: undo

undo

undo.js is part of Aloha Editor project http://www.alohaeditor.org

Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html

Methods

capture(context, opts, given){Frame}

Enter/leave a frame before/after calling the given function.
Name Type Description
context Undo
opts Object.<string, *> given as the opts argument to enter()
given function as the result argument to leave()
Returns:
captured frame

close()

This function is missing documentation.
TODO
  • Complete documentation.

Context(elem, opts){Undo}

Creates a new undo context.

The undo context holds an assortment of data items used across
many of the undo functions.

Should be treated as a black box.
Name Type Description
elem Element The element whose mutations are to be observed and made undoable/redoable.
opts Object.<string, *> A map of options: noMutationObserver - whether or not to use the MutationObserver API to observe changes, maxCombineChars - how many character to combine to a single change (default 20). maxHistory - how many items to keep in the history (default 1000).

enter(context, opts){void}

Enters a new frame in the given undo context.
Name Type Description
context Undo
opts Object.<string, *> A map of options: noObserve - whether to observe changes. If true, changes must be supplied via the result argument of leave(). Applies recursively to all nested frames. partitionRecords - whether to split up changes happening inside this frame and frames direcly below this frame (but not deeper). oldRange - a range to record that reflects the range before any changes in this frame happen.

leave(context, result){Frame}

Leave a frame in the given undo context.
Name Type Description
context Undo
result Object.<...string>

redo(context, range, ranges){void}

Redoes a previously undone changeSet in the history and
increments the history index.
Name Type Description
context Undo
range Range will be set to the recorded range after the changes in the changeSet occurred.
ranges Array.<Range> will be preserved.

undo(context, range, ranges){void}

Undoes the last changeSet in the history and decreases the
history index.
Name Type Description
context Undo
range Range will be set to the recorded range before the changes in the changeSet occurred.
ranges Array.<Range> will be preserved.
comments powered by Disqus