에디터의 모드(편집/ 미리보기 / 소스코드 보기)를 변경합니다.
Parameters:
Name | Type | Attribute | Description |
|---|---|---|---|
| mode | string |
| |
| [callback] | function | 릴리즈 2.12.0 이상 에디터 모드 변경이 완료된 후 실행할 콜백 함수 | |
| option | Object | { loadingProgress: true, useFocus: true } | 릴리즈 3.3.2603 이상
|
Example:
// 미리보기 / 편집 모드 토글하기
if (editor.isPreviewMode()) {
editor.setMode('edit');
} else {
editor.setMode('preview');
}
// 콜백함수 사용하기 (릴리즈 2.12.0 이상)
var callback = function () {
console.log('done');
}
editor.setMode('edit', callback);