execCommand
Executes an action defined inside the editor.
Parameters
| Name | Type | Description |
|---|---|---|
actionName | string | Action name |
...args | any | Parameters for the action |
Returns
| Type | Description |
|---|---|
| Object | { isSuccess, errorType, errorMessage } — isSuccess indicates success; errorType and errorMessage are populated on failure |
Example
var result = editor.execCommand('insertText', 'Hello SynapEditor');
if (!result.isSuccess) {
console.error(result.errorMessage);
}
See Actions for available action names.