Core plugin system and editor functionality for the Plate rich text editor framework
—
Core functionality for creating and configuring Slate editors with Plate enhancements, plugin integration, and comprehensive type safety.
Creates a new Slate editor instance with Plate enhancements and plugin integration.
/**
* Creates a Slate editor with Plate enhancements
* @param options - Configuration options for the editor
* @returns Fully configured SlateEditor instance
*/
function createSlateEditor(options?: {
plugins?: any[];
value?: any[];
editor?: BaseEditor;
}): SlateEditor;Usage Examples:
import { createSlateEditor, getCorePlugins } from "@platejs/core";
// Create editor with core plugins
const editor = createSlateEditor({
plugins: getCorePlugins()
});
// Create editor with initial value
const editorWithValue = createSlateEditor({
plugins: getCorePlugins(),
value: [
{
type: 'p',
children: [{ text: 'Initial content' }]
}
]
});Applies Plate enhancements to an existing Slate editor instance.
/**
* Applies Plate enhancements to an existing editor
* @param editor - Base Slate editor instance
* @returns Enhanced SlateEditor with Plate features
*/
function withSlate(editor: BaseEditor): SlateEditor;Returns the default set of core plugins that provide essential editor functionality.
/**
* Get the default core plugins for basic editor functionality
* @returns Array of core plugin instances
*/
function getCorePlugins(): CorePlugin[];Usage Examples:
import { createSlateEditor, getCorePlugins, createSlatePlugin } from "@platejs/core";
// Use core plugins with custom additions
const CustomPlugin = createSlatePlugin({
key: 'custom',
node: { type: 'custom' }
});
const editor = createSlateEditor({
plugins: [
...getCorePlugins(),
CustomPlugin
]
});The created editor instances include:
editor.apieditor.transformsInstall with Tessl CLI
npx tessl i tessl/npm-platejs--core