Skip to main content
Version: Next

@editora/react

React integration package for Editora runtime and plugin composition.

Installation

npm i @editora/react @editora/core @editora/plugins @editora/themes react react-dom

Usage Example

import { useState } from "react";
import { EditoraEditor } from "@editora/react";
import { BoldPlugin, ItalicPlugin } from "@editora/plugins";
import "@editora/plugins/styles.css";
import "@editora/themes/themes/default.css";

export default function App() {
const [value, setValue] = useState("<p>Start writing...</p>");

return (
<EditoraEditor
value={value}
onChange={setValue}
plugins={[BoldPlugin(), ItalicPlugin()]}
floatingToolbar
/>
);
}

API Surface

SurfaceTypeNotes
EditoraEditor / RichTextEditorComponent exportMain editor component
ToolbarComponent exportMain toolbar renderer
EditorContentComponent exportContenteditable surface component
InlineMenuComponent exportInline menu component
useKeyboardShortcuts(options)Hook exportShortcut registration hook
UseKeyboardShortcutsOptionsType exportHook option typing
RichTextEditorPropsType exportMain component prop contract
EditorAPIType exportRuntime API typing exposed to consumers
EditorConfigType exportRuntime config typing
mergeConfigUtility exportConfig merge helper

Runtime Prop Groups

GroupPurpose
Content props (value, defaultValue, onChange)Controlled/uncontrolled content flow
Lifecycle props (onInit, onDestroy)Editor startup/teardown hooks
UI props (toolbar, statusbar, floatingToolbar)UI behavior and density
Runtime props (autosave, security, performance, accessibility)Operational controls

Best Practices

  • Keep plugin array stable with memoization.
  • Scope theme classes per editor container in mixed-theme pages.
  • Debounce persistence in controlled mode for larger documents.
  • In CRA and similar bundlers, import @editora/plugins/styles.css when using plugin UI features.
  • Use default.css as base theme CSS, then optional override themes like dark.css/acme.css.

Accessibility

Validate keyboard navigation and focus return behavior for toolbar, dialogs, and floating toolbar.

Performance Notes

Avoid parent rerenders on every keystroke and keep expensive transforms outside render paths.