The Transaction object (interface) is passed as a first parameter to the callback function used in Element.transact(callback,name)
method.
Element.transact
provides a way to execute one or many editing actions as a single transaction that can be undone (Undo/Redo functionality) or rolled back.
All DOM modifications that are made by other methods are not transactable.
Add or remove elements attribute by name. To remove attribute use undefined value.
Changes text of the element or text node.
Change tag of the element. For example in some cases you may want to change <p>
to <li>
without recreating the element.
Split DOM elements at pos position until the element. Example, for the markup:
<p id=test>123<b>456</b>789</p>
This code:
var p = $(p#test); var b = p.$(b); var pos = [bookmark: b.nodes()[0], 1, false]; // start edge of character '5' in first text node of the <b> element. transact.split( pos, p );
will change the DOM to this state:
<p id=test>123<b>4</b><b>56</b>789</p>
The function returns bookmark set to position inside until element.
Wraps from..to range into the element.
Returns two bookmarks - start and end of content range that was wrapped.
Moves content of the element into its parent (P), removes the element.
Returns two bookmarks - start and end of content range that was merged into P element.
Insert Node or Element at at position in the DOM).
TBD (remove Node or Element from the DOM).
Inserts HTML fragment at the position. Returns array of inserted [top level] nodes.
Inserts text at the position. Returns bookmark of last character inserted.
TBD (removes range from the DOM).