CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-platejs--core

Core plugin system and editor functionality for the Plate rich text editor framework

Pending
Overview
Eval results
Files

core-plugins.mddocs/

Core Plugins

Essential plugins that provide fundamental editor functionality including history, debugging, DOM management, and node handling.

Capabilities

HistoryPlugin

Provides undo/redo functionality for the editor with configurable history stack management.

/**
 * History plugin for undo/redo functionality
 */
const HistoryPlugin: SlatePlugin;

Usage Examples:

import { createSlateEditor, HistoryPlugin } from "@platejs/core";

const editor = createSlateEditor({
  plugins: [HistoryPlugin]
});

// Undo last operation
editor.undo();

// Redo last undone operation
editor.redo();

DebugPlugin

Development and debugging plugin with configurable logging and error handling.

/**
 * Debug plugin for development and error handling
 */
const DebugPlugin: SlatePlugin;

DOMPlugin

Manages DOM state including focus, composition, and read-only states.

/**
 * DOM plugin for state management
 */
const DOMPlugin: SlatePlugin;

Features:

  • Focus state management
  • Composition event handling
  • Read-only state control
  • Keyboard event tracking

ParserPlugin

Generic data format parsing system with extensible parser registration.

/**
 * Parser plugin for data format handling
 */
const ParserPlugin: SlatePlugin;

/**
 * Register a custom parser for a specific data format
 * @param format - Format identifier
 * @param parser - Parser function
 */
function registerParser(
  format: string,
  parser: (data: string) => any[]
): void;

NodeIdPlugin

Automatic node ID management for tracking and referencing editor nodes.

/**
 * Node ID plugin for automatic ID assignment
 */
const NodeIdPlugin: SlatePlugin;

AstPlugin

Handles Slate AST fragment serialization for clipboard and drag-and-drop operations.

/**
 * AST plugin for fragment handling
 */
const AstPlugin: SlatePlugin;

ChunkingPlugin

Performance optimization plugin that implements Slate's chunking for better typing performance.

/**
 * Chunking plugin for performance optimization
 */
const ChunkingPlugin: SlatePlugin;

LengthPlugin

Character count limitations and length tracking functionality.

/**
 * Length plugin for character counting
 */
const LengthPlugin: SlatePlugin;

AffinityPlugin

Controls mark and element boundary behavior for consistent selection handling.

/**
 * Affinity plugin for boundary behavior
 */
const AffinityPlugin: SlatePlugin;

OverridePlugin

Plugin override system for customizing and extending existing plugin behavior.

/**
 * Override plugin for plugin customization
 */
const OverridePlugin: SlatePlugin;

SlateExtensionPlugin

Opinionated extensions to Slate's default behavior for improved editor experience.

/**
 * Slate extension plugin for enhanced behavior
 */
const SlateExtensionPlugin: SlatePlugin;

BaseParagraphPlugin

Default paragraph handling and normalization functionality.

/**
 * Base paragraph plugin for default text blocks
 */
const BaseParagraphPlugin: SlatePlugin;

Plugin Configuration

Core plugins can be configured with options:

interface CorePluginOptions {
  /** History plugin options */
  history?: {
    maxSize?: number;
    delay?: number;
  };
  /** Debug plugin options */
  debug?: {
    logLevel?: 'error' | 'warn' | 'info' | 'debug';
    enabled?: boolean;
  };
  /** Length plugin options */
  length?: {
    maxLength?: number;
    units?: 'character' | 'word';
  };
}

Usage Examples:

import { createSlateEditor, getCorePlugins } from "@platejs/core";

// Configure core plugins with options
const editor = createSlateEditor({
  plugins: getCorePlugins().map(plugin => {
    if (plugin.key === 'history') {
      return {
        ...plugin,
        options: { maxSize: 100, delay: 500 }
      };
    }
    return plugin;
  })
});

Core Plugin Integration

All core plugins work together to provide:

  • Consistent Behavior: Unified approach to editor operations
  • Type Safety: Full TypeScript integration across all plugins
  • Performance: Optimized for large documents and complex operations
  • Extensibility: Easy to override or extend core functionality
  • Development Support: Rich debugging and error handling capabilities

Install with Tessl CLI

npx tessl i tessl/npm-platejs--core

docs

core-plugins.md

editor-creation.md

event-handling.md

html-serialization.md

index.md

multi-format-serialization.md

plugin-system.md

transform-functions.md

type-system.md

utility-functions.md

tile.json