MacRabbit

CETextRecipe

JavaScriptAPI : CETextRecipe

CETextRecipe objects allow you to create recipes of changes to apply to a document via the TextActionContext object. By queuing up your changes in a recipe and applying them all at once, you do not have to worry about manually adjusting ranges to take into account previous insertions or deletions.

CETextRecipe()

The CETextSnippet constructor takes no arguments:

var recipe = new CETextRecipe(); 

Properties

coalescesChanges

Returns true or false; whether or not this recipe groups its changes. Defaults to true.

Set to false if you wish to have each change in the recipe applied individually (may decrease performance).

undoActionName

Returns the string that will be shown in the Edit menu’s Undo item.

Most actions are automatically assigned an undo name, but if for some reason you need to change it you can set this to customize the undo name for the action.

Methods

replaceRange(range, string)

Returns void; replace the Range range with the string string when the recipe is applied.

insertAtIndex(index, string)

Returns void; insert the string string at the numerical character index index when the recipe is applied.

deleteRange(range)

Returns void; delete the Range range when the recipe is applied.