execCommand
에디터 내부에 정의된 액션을 실행합니다.
매개변수
| 이름 | 타입 | 설명 |
|---|---|---|
actionName | string | 액션 이름 |
...args | any | 액션의 매개변수 |
반환값
| 타입 | 설명 |
|---|---|
| Object | { isSuccess, errorType, errorMessage } — isSuccess는 성공 여부를 나타냅니다. 실패 시 errorType과 errorMessage가 채워집니다. |
예시
var result = editor.execCommand('insertText', 'Hello SynapEditor');
if (!result.isSuccess) {
console.error(result.errorMessage);
}
사용 가능한 액션 이름은 Actions를 참고합니다.