Overview
Plugins are the building blocks of Yoopta Editor. Each plugin represents a specific type of content block (paragraph, heading, image, etc.) and defines how that content is rendered and behaves. Every plugin in Yoopta Editor is built using theYooptaPlugin class, which provides a consistent API for defining block types, handling events, managing state, and extending functionality.
Plugin Architecture
YooptaPlugin Class
All plugins are created using theYooptaPlugin class constructor:
Plugin Structure
Each plugin configuration consists of:Unique identifier for the plugin (e.g., ‘Paragraph’, ‘Image’, ‘Code’)
Defines the structure and rendering of plugin elements. Can be an object or JSX syntax
Configuration options including display settings and shortcuts
Methods for manipulating plugin content programmatically
Event handlers for keyboard, mouse, and other DOM events
Hooks that run at specific points in the plugin lifecycle
Serialization and deserialization for HTML, Markdown, and Email
Slate editor extensions for custom behavior
Available Plugins
Yoopta Editor provides a rich set of built-in plugins:Text Plugins
- Paragraph - Basic text blocks
- Headings - H1, H2, H3 heading blocks
- Blockquote - Quote blocks
List Plugins
- BulletedList - Unordered lists
- NumberedList - Ordered lists
- TodoList - Checkable task lists
Media Plugins
- Image - Image blocks with upload support
- Video - Video blocks with upload support
- File - File attachment blocks
- Embed - Embed external content (YouTube, Twitter, etc.)
Layout Plugins
- Table - Tabular data
- Tabs - Tabbed content sections
- Steps - Step-by-step instructions
- Carousel - Image/content carousel
- Accordion - Collapsible content sections
- Divider - Horizontal separator
- Callout - Highlighted notice blocks
Code Plugins
Special Plugins
- Link - Link blocks
Using Plugins
Plugins are passed tocreateYooptaEditor, not to <YooptaEditor>. The component only receives the editor instance.
Basic Usage
Headings Plugin
The Headings plugin exports multiple heading types:Lists Plugin
The Lists plugin exports multiple list types:Plugin Configuration
Most plugins accept configuration options when you callplugin.extend({ options: { ... } }). Pass the resulting plugins array to createYooptaEditor({ plugins, marks }), not to <YooptaEditor>.
Image Plugin
Code Plugin
Video Plugin
Plugin Methods
extend()
Extend a plugin with custom options or elements (UI):Defining Elements
Elements can be defined in two ways: 1. Object Syntax:Element Properties
React component that renders the element
Default props for the element
Type of Slate node. Default is ‘block’
Placeholder text for empty elements
Custom elements (renders)
Override default rendering by extending with customelements:
Plugin Events
Handle plugin-specific events:Plugin shortcuts
Configure slash-menu shortcuts viaoptions.shortcuts (array of strings). Plugin-specific hotkeys are defined in the plugin’s events.onKeyDown or in options. Use Blocks.toggleBlock(editor, { type: 'Code' }) for programmatic block type change.
Common Plugin Options
Most plugins support these common options:Display configuration -
title - Display name in UI - description - Plugin description - icon- Custom icon component
Keyboard shortcuts to trigger the plugin
Slate-specific configuration
Plugin Loading Order
The order of plugins in the array affects:- Menu display order
- Transform priority
- Shortcut precedence
Conditional Plugin Loading
Load plugins based on conditions:Plugin Detection
Check if a plugin is loaded:Best Practices
Always include Paragraph plugin
Always include Paragraph plugin
The Paragraph plugin should always be included as it’s the default block type.
Define plugins outside component
Define plugins outside component
Define your plugins array outside the component to prevent recreation on every render.
Use extend() for customization
Use extend() for customization
Use the
extend() method instead of modifying plugin objects directly.Handle async operations properly
Handle async operations properly
For plugins with async operations (uploads, etc.), always handle errors and loading states.
Lifecycle Hooks
Lifecycle hooks allow you to run code at specific points in a block’s lifecycle:Available Lifecycle Hooks
Called before a block is created. Return the initial structure
Called after a block is created
Called before a block is destroyed

