Skip to main content
Version: Next

@editora/react

Complete React wrapper reference for Editora including props, defaults, runtime API, and production patterns.

Installation

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

What this wrapper provides

  • Framework-native editor component: EditoraEditor.
  • Runtime API access via onInit(editorApi).
  • Controlled/uncontrolled content modes.
  • Plugin composition with instance-safe rendering.
  • Optional floating toolbar without removing main toolbar.
  • Runtime configuration for autosave, security, accessibility, and performance.

Quick Start

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

export function App() {
return (
<EditoraEditor
plugins={[BoldPlugin(), ItalicPlugin(), HistoryPlugin()]}
placeholder="Start writing..."
/>
);
}

CRA and bundler compatibility

  • If you load plugins from @editora/plugins, import @editora/plugins/styles.css.
  • Plugin entry options:
    • @editora/plugins (full)
    • @editora/plugins/lite (common/core)
    • @editora/plugins/enterprise (advanced/specialized)
    • @editora/plugins/<plugin-name> (per-plugin)
  • Keep theme imports layered as:
    1. @editora/themes/themes/default.css (base)
    2. @editora/themes/themes/dark.css or @editora/themes/themes/acme.css (overrides)
  • acme.css is an override theme and does not replace the default base styles.
  • All plugin entry paths are completely free and fully customizable.

Capabilities matrix

CapabilityReact surface
Controlled contentvalue, onChange
Uncontrolled contentdefaultValue
Readonly modereadonly
Plugin compositionplugins, pluginConfig
Toolbar behaviortoolbar.items, toolbar.floating, toolbar.sticky, toolbar.showMoreOptions
Status metricsstatusbar.enabled, statusbar.position
Spell-check strategyspellcheck.enabled, spellcheck.provider, spellcheck.apiUrl
Autosaveautosave.enabled, autosave.intervalMs, autosave.provider
Security hardeningsecurity.sanitizeOnPaste, security.sanitizeOnInput
Accessibility controlsaccessibility.enableARIA, accessibility.keyboardNavigation, accessibility.checker
Performance tuningperformance.debounceInputMs, performance.viewportOnlyScan
Language directionlanguage.locale, language.direction
Content constraintscontent.allowedTags, content.allowedAttributes, content.sanitize, content.autoHeight

Full props reference

Identity and lifecycle

PropTypeDefault
idstringundefined
classNamestringundefined
onInit(editor: EditorAPI) => voidundefined
onDestroy() => voidundefined

Content and mode

PropTypeDefault
valuestringundefined
defaultValuestringundefined
onChange(html: string) => voidundefined
readonlybooleanfalse
placeholderstring""

Plugin integration

PropTypeDefault
pluginsPlugin[] | string[][]
pluginConfigRecord<string, unknown>{}

Notes:

  • If plugins contains strings, the wrapper resolves them using pluginConfig.pluginFactories or window.EditoraReactPlugins.
  • If accessibility.checker=true, wrapper attempts to auto-add a11yChecker plugin if a factory exists.

Toolbar, statusbar, menus

PropTypeDefault
toolbar.itemsstring[] | any[][]
toolbar.floatingbooleanfalse
toolbar.stickybooleanfalse
toolbar.showMoreOptionsbooleantrue
statusbar.enabledbooleanfalse
statusbar.position'top' | 'bottom''bottom'
menubar.enabledbooleanfalse
menubar.itemsstring[][]
contextMenu.enabledbooleantrue
floatingToolbar (legacy)boolean | { enabled?: boolean }undefined

Media, paste, history, language

PropTypeDefault
media.uploadUrlstring""
media.libraryUrlstring""
media.maxFileSizenumber10485760
media.allowedTypesstring[]['image/jpeg','image/png','image/gif','image/webp']
media.headersRecord<string,string>{}
media.withCredentialsbooleanfalse
paste.cleanbooleantrue
paste.keepFormattingbooleanfalse
paste.convertWordbooleantrue
history.maxStepsnumber100
history.debounceMsnumber300
language.localestring'en'
language.direction'ltr' | 'rtl''ltr'

Spellcheck, autosave, security, accessibility, performance

PropTypeDefault
spellcheck.enabledbooleanfalse
spellcheck.provider'browser' | 'local' | 'api''browser'
spellcheck.apiUrlstring""
spellcheck.apiHeadersRecord<string,string>{}
autosave.enabledbooleanfalse
autosave.intervalMsnumber30000
autosave.storageKeystring'rte-autosave'
autosave.provider'localStorage' | 'api''localStorage'
autosave.apiUrlstring""
security.sanitizeOnPastebooleantrue
security.sanitizeOnInputbooleantrue
accessibility.enableARIAbooleantrue
accessibility.keyboardNavigationbooleantrue
accessibility.checkerbooleanfalse
performance.debounceInputMsnumber100
performance.viewportOnlyScanbooleantrue

Content policy

PropTypeDefault
content.allowedTagsstring[][]
content.allowedAttributesRecord<string,string[]>{}
content.sanitizebooleantrue
content.autoHeightbooleanfalse
content.minHeightnumber200
content.maxHeightnumber0

EditorAPI from onInit

MethodSignature
getHTML() => string
setHTML(html: string) => void
execCommand(name: string, value?: any) => void
registerCommand(name: string, fn: (params?: any) => void) => void
focus() => void
blur() => void
destroy() => void
onChange(fn: (html: string) => void) => () => void
getState() => any

Production configuration example

import { useMemo, useState } from "react";
import { EditoraEditor } from "@editora/react";
import {
BoldPlugin,
ItalicPlugin,
UnderlinePlugin,
StrikethroughPlugin,
TextColorPlugin,
BackgroundColorPlugin,
FontSizePlugin,
HistoryPlugin,
ChecklistPlugin,
} from "@editora/plugins";

export function ProductionEditor() {
const [value, setValue] = useState("<p>Draft...</p>");
const plugins = useMemo(
() => [
BoldPlugin(),
ItalicPlugin(),
UnderlinePlugin(),
StrikethroughPlugin(),
TextColorPlugin(),
BackgroundColorPlugin(),
FontSizePlugin(),
HistoryPlugin(),
ChecklistPlugin(),
],
[],
);

return (
<EditoraEditor
value={value}
onChange={setValue}
plugins={plugins}
toolbar={{
items: ["undo", "redo", "|", "bold", "italic", "underline", "strikethrough", "|", "textColor", "backgroundColor", "fontSize"],
sticky: true,
floating: true,
showMoreOptions: false,
}}
statusbar={{ enabled: true, position: "bottom" }}
autosave={{ enabled: true, intervalMs: 5000, storageKey: "doc-a", provider: "localStorage" }}
security={{ sanitizeOnPaste: true, sanitizeOnInput: true }}
accessibility={{ enableARIA: true, keyboardNavigation: true, checker: false }}
performance={{ debounceInputMs: 120, viewportOnlyScan: true }}
spellcheck={{ enabled: true, provider: "browser" }}
/>
);
}

Multi-instance pattern

  • Use distinct wrapper containers per editor.
  • Keep plugin arrays and toolbar configs local to each instance.
  • Scope theme classes per editor container.
  • Verify comments/spell-check sidebars and dialogs mount to the clicked editor only.
  • Web component capabilities: /docs/editor/web-component
  • Side-by-side capabilities playground: /docs/examples/capabilities-playground
  • Embedded live demos: /docs/examples/live-examples