List plugin for Plate rich-text editor providing indent-based list functionality with comprehensive transforms, queries, and React hooks.
—
Core plugin setup and configuration options for integrating list functionality into Plate editor.
Core list plugin that provides list functionality for Plate editor.
/**
* Core list plugin providing list functionality for Plate editor
* Handles list rendering, normalization, and operation behaviors
*/
export const BaseListPlugin: TSlatePlugin<BaseListConfig>;Usage Example:
import { createPlateEditor } from "@udecode/plate";
import { BaseListPlugin } from "@udecode/plate-list";
const editor = createPlateEditor({
plugins: [BaseListPlugin],
});React wrapper for BaseListPlugin with React-specific features.
/**
* React wrapper for BaseListPlugin with React-specific features
* Enables support for indented lists with React-specific features
*/
export const ListPlugin: PlatePlugin<ListConfig>;Usage Example:
import { createPlateEditor } from "@udecode/plate/react";
import { ListPlugin } from "@udecode/plate-list/react";
const editor = createPlateEditor({
plugins: [ListPlugin],
});Configuration options for the BaseListPlugin.
/**
* Configuration options for the BaseListPlugin
*/
export type BaseListConfig = PluginConfig<
'list',
{
/** Options for getting sibling lists */
getSiblingListOptions?: GetSiblingListOptions<TElement>;
/** Function to map HTML elements to list style type */
getListStyleType?: (element: HTMLElement) => ListStyleType;
}
>;React version of BaseListConfig.
/**
* React version of BaseListConfig
*/
export type ListConfig = BaseListConfig;Options for configuring how sibling list queries behave. This affects how the plugin finds and analyzes related list items.
interface GetSiblingListOptions<N extends ElementOf<E>, E extends Editor = Editor> {
/** Break on equal indent with different list style type */
breakOnEqIndentNeqListStyleType?: boolean;
/** Break when encountering list restart markers */
breakOnListRestart?: boolean;
/** Break when encountering lower indentation levels */
breakOnLowerIndent?: boolean;
/** Custom break condition function */
breakQuery?: (siblingNode: TNode, currentNode: TNode) => boolean | undefined;
/** Custom function to get next entry */
getNextEntry?: (entry: NodeEntry<ElementOrTextOf<E>>) => NodeEntry<N> | undefined;
/** Custom function to get previous entry */
getPreviousEntry?: (entry: NodeEntry<ElementOrTextOf<E>>) => NodeEntry<N> | undefined;
/** Only get siblings with equal indentation */
eqIndent?: boolean;
/** Custom query function for sibling matching */
query?: (siblingNode: TNode, currentNode: TNode) => boolean | undefined;
}Function to map HTML elements to list style types during HTML parsing. This is used when importing content from external sources.
/**
* Function to map HTML elements to list style types during HTML parsing
* @param element - HTML element to analyze
* @returns The corresponding ListStyleType
*/
type GetListStyleTypeFunction = (element: HTMLElement) => ListStyleType;Default Implementation:
// Default implementation extracts from CSS list-style-type property
getListStyleType: (element) => element.style.listStyleType as ListStyleTypeThe plugin includes built-in HTML parsing that:
<li> elements into flat list items with indent propertiesaria-level attributes for accessibility complianceThe plugin provides default rendering that:
<ol> or <ul> elements based on list style typestart attributes for numbered listsThe plugin automatically applies editor extensions:
withList: Core list functionality and transformswithNormalizeList: List structure normalizationThe plugin defines specific editor rules:
Install with Tessl CLI
npx tessl i tessl/npm-udecode--plate-list