Skip to content

Overview & Quick Start

Payload Lexical configuration

@nexload-sdk/payload-editor

v1.1.0 Stable Released

Semantic, deterministic Payload Lexical editor configuration.

Payload CMSNode.jsESM

@nexload-sdk/payload-editor transforms an explicit semantic feature definition into the official Payload CMS Lexical editor provider. It provides teams with named presets, deterministic feature merge rules, and safe extension seams without cluttering collection configurations with verbose Lexical boilerplate.


import { createEditor } from "@nexload-sdk/payload-editor";
import type { CollectionConfig } from "payload";
// 1. Define explicit editor policy from preset
const blogEditor = createEditor({
preset: "article",
features: {
heading: { sizes: ["h2", "h3"] }, // Restrict heading sizes
upload: { allowedCollections: ["media"], maxDepth: 1 },
},
});
// 2. Attach directly to Payload RichText field
export const Posts: CollectionConfig = {
slug: "posts",
fields: [
{ name: "content", type: "richText", editor: blogEditor },
],
};

  • Ready-to-Use Presets: Built-in presets for common editorial workflows: compact, standard, structured-content, article, and product-description.
  • Deterministic Feature Merging: Clear override semantics: false disables, true enables with defaults, objects shallow-merge, and array options replace.
  • Custom Organization Presets: Define reusable corporate editor standards using defineEditorPreset().
  • Native Extension Seam: Seamlessly attach native Lexical features like BlocksFeature or custom AST nodes via extendFeatures.
  • Zero UI Bloat: The package runs in server/config code, has no client React runtime, and declares no side effects.

Terminal window
pnpm add @nexload-sdk/payload-editor @payloadcms/richtext-lexical payload

With alternative package managers:

Terminal window
# npm
npm install @nexload-sdk/payload-editor @payloadcms/richtext-lexical payload
# bun
bun add @nexload-sdk/payload-editor @payloadcms/richtext-lexical payload
Package / RuntimeSupported RangeNotes
Node.js>=20.9.0Server/config safe
Payload CMS>=3.85.0 <4.0.0Core headless CMS
@payloadcms/richtext-lexical>=3.85.0 <4.0.0Native Lexical editor provider
Module FormatESM onlyDeclarative config safe

In createEditor({ features: { ... } }):

  • Omitted key: Inherits configuration from the active preset (or disabled if no preset is used).
  • false: Completely disables and removes the feature from the editor toolbar.
  • true: Enables the feature with default recommended options.
  • { ...options }: Enables the feature and shallow-merges your specific options. Any provided arrays replace preset arrays rather than appending.