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.


The CETextSnippet constructor takes no arguments:

var recipe = new CETextRecipe();



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).


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

Set this to customize the undo name for the action.


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.


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