Documentação

Crie um editor

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 é obrigatório. initialValue define o HTML inicial e é lido uma vez. historyLimit tem padrão de 100 etapas. sanitize tem padrão true e controla a limpeza do HTML de saída.

onChange entrega HTML e onChangeJSON entrega JSON. Há no máximo uma notificação por quadro. Com { history: false }, até o mesmo HTML pode disparar o callback.