Skip to main content

Editor

Editor embeds the block-style Editor.js rich text editor as a Bootstrap form control. The editor saves its data into a hidden <input>, so it participates in native form submission.

Usage

Editor.js only runs in the browser, so render the component on the client:

import { Editor } from 'idea-react';

<form method="post">
<Editor name="content" required defaultValue={savedDocument} tools={customTools} />
<button className="btn-solid theme-primary">Save</button>
</form>;

The wrapper saves on blur and serializes the latest Editor.js OutputData as JSON into the hidden input named by name. All react-editor-js props, such as tools and onInitialize, pass through to the underlying editor.

Render saved documents with the Editor HTML component.