@eventuras/scribo-react

React bindings for @eventuras/scribo-core. The core itself has no React; this package renders what it describes. Lexical is pinned to exactly the version Payload CMS uses (0.50.0 today).

bash
pnpm add @eventuras/scribo-core @eventuras/scribo-react @lexical/react@0.50.0 react react-dom

Use

Mount an editor built from the core's extensions with Lexical's LexicalExtensionComposer, and put the bindings inside it:

tsx
import {
BaseExtension,
ToolbarExtension,
defineExtension,
} from "@eventuras/scribo-core";
import { HeadingExtension } from "@eventuras/scribo-core/extensions/heading";
import { Placeholder, Toolbar } from "@eventuras/scribo-react";
import { LexicalExtensionComposer } from "@lexical/react/LexicalExtensionComposer";
const editor = defineExtension({
name: "my-editor",
dependencies: [BaseExtension, HeadingExtension, ToolbarExtension],
});
<LexicalExtensionComposer extension={editor}>
<Toolbar />
<Placeholder>Write something…</Placeholder>
</LexicalExtensionComposer>;
ExportWhat it is
ToolbarPlain buttons for the core's toolbar items, grouped, with a language select in a code block. scribo- class names and no CSS.
useToolbarThe items with their live state (active, enabled) and a run function, for your own markup. groupToolbarEntries groups them.
useCodeLanguageThe language picker for the selected code block, or null outside one or without a highlighter. Includes whether the editor is editable.
PlaceholderShows its children while the editor is empty. useCanShowPlaceholder gives the same as a boolean.

Disabled items cannot be run: Toolbar disables them, and the core's runToolbarItem refuses them too.