# 에디터 만들기 {#use-editor}

Source: [에디터 만들기 | Yurich React 에디터 API 레퍼런스 · Yurich](https://leeyujoo.com/yurich/ko/api/use-editor/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

```ts
declare function useEditor(options: EditorOptions): EditorInstance;

type EditorOptions = {
  extensions: Extension[];
  initialValue?: string;
  onChange?: (html: string) => void;
  onChangeJSON?: (json: DocumentJSON) => void;
  sanitize?: boolean;
  historyLimit?: number;
};
```

`extensions`는 필수입니다. `initialValue`는 처음에 한 번 읽는 HTML입니다. `historyLimit` 기본값은 실행 취소 100단계입니다. `sanitize`는 기본값이 `true`이며 `getHTML()`과 `onChange`로 내보내는 HTML을 정리합니다.

`onChange`는 HTML을, `onChangeJSON`은 JSON을 전달합니다. 변경은 프레임당 최대 한 번 보고합니다. `{ history: false }`로 불러올 때는 HTML이 같아도 콜백이 호출될 수 있습니다.
