execCommand

Executes an action defined inside the editor.

Parameters

NameTypeDescription
actionNamestringAction name
...argsanyParameters for the action

Returns

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