editBegin method
The editBegin and editEnd methods provide a mechanism to bracket a series of document changes which may optionally be rolled back. Before beginning a series of changes, call editBegin for this document. At the end of the changes, call editEnd to either commit the changes or to roll them back by specifying false as the commit parameter.
Multiple calls may be made to editBegin before an editEnd call, for example if one top-level script calls another as part of its implementation. In this case, the changes are not committed or rolled back until the outermost editEnd call is made. All changes since the first editBegin call will be rolled back if any nested call to editEnd or the outermost editEnd call specifies false as the commit parameter.
For example, in JavaScript:
doc.undoBoundary("Big Changes");
doc.editBegin();
var commit = true;
try {
doBigChanges();
} catch (e) {
commit = false;
}
doc.editEnd(commit);
This example assumes doBigChanges or a method it calls throws an exception if it detects an error condition after making some document changes which should then be discarded.
|
Each call to editBegin must be matched with a call to editEnd. Failure to do so may cause unexpected behavior until Arbortext Editor or Arbortext Publishing Engine is restarted. For language bindings that support exceptions, DOM or AOM calls between editBegin and editEnd calls must be wrapped in a try/catch block so that editEnd is called if an exception is raised.
|
editBegin( )
|
Parameters
|
None
|
Returns
|
void
|