Create a simple content macro for an editor instance with editor.macros.addSimpleMacro().
The simple replacement macro allows you to replace entered text when that text is surrounded by a startString and endString. The callback function can then operate on the matched string, including the startString and endString.
Example
editor.macros.addSimpleMacro(startString, endString, callback)
// Create a macro that replaces text surrounded in double-brackets with a string
var key = editor.macros.addSimpleMacro('[[', ']]', function(str) {
var newValue = "Macro Triggered!";
return newValue;
});
Parameters
| startString | String | A string pattern to search for signifying the beginning of the macro replacement. |
| endString | String | A string pattern to search for signifying the end of the macro replacement. |
| callback | Function | A function that receives the complete matching string (including start and end) and returns the string to insert instead. |
Returns
key | String | A key that identifies this macro in this editor instance. |