@udecode/plate-list
Version:
List plugin for Plate
105 lines (80 loc) • 5.52 kB
TypeScript
import { B as BaseListConfig, G as GetSiblingListOptions, L as ListStyleType } from './BaseListPlugin-C8rmwv_L.js';
export { a as BaseListPlugin, U as ULIST_STYLE_TYPES, g as getSiblingList } from './BaseListPlugin-C8rmwv_L.js';
import { OverrideEditor, Editor, NodeEntry, ElementOf, ElementEntryOf, EditorAboveOptions, SlateEditor, TElement, TLocation, Path } from '@udecode/plate';
import '@udecode/plate-core';
declare const withList: OverrideEditor<BaseListConfig>;
declare const withNormalizeList: OverrideEditor<BaseListConfig>;
/** Unset listStyle, listStart if KEYS.indent is not defined. */
declare const normalizeListNotIndented: (editor: Editor, [node, path]: NodeEntry) => true | undefined;
declare const getListExpectedListStart: (entry: NodeEntry, prevEntry?: NodeEntry) => number;
declare const normalizeListStart: <N extends ElementOf<E>, E extends Editor = Editor>(editor: E, entry: ElementEntryOf<E>, options?: Partial<GetSiblingListOptions<N, E>>) => boolean;
declare const withInsertBreakList: OverrideEditor<BaseListConfig>;
declare const areEqListStyleType: (editor: Editor, entries: NodeEntry[], { listStyleType, }: {
listStyleType?: string;
}) => boolean;
declare const getListAbove: <N extends ElementOf<E>, E extends Editor = Editor>(editor: E, options?: Omit<EditorAboveOptions, "match">) => NodeEntry<N> | undefined;
interface GetListSiblingsOptions<N extends ElementOf<E>, E extends Editor = Editor> extends Partial<GetSiblingListOptions<N, E>> {
current?: boolean;
next?: boolean;
previous?: boolean;
}
declare const getListSiblings: <N extends ElementOf<E>, E extends Editor = Editor>(editor: E, entry: ElementEntryOf<E>, { current, next, previous, ...options }?: GetListSiblingsOptions<N, E>) => NodeEntry[];
/** Get the next indent list. */
declare const getNextList: <N extends ElementOf<E>, E extends Editor = Editor>(editor: E, entry: ElementEntryOf<E>, options?: Partial<GetSiblingListOptions<N, E>>) => NodeEntry<N> | undefined;
/** Get the previous indent list node. */
declare const getPreviousList: <N extends ElementOf<E>, E extends Editor = Editor>(editor: E, entry: ElementEntryOf<E>, options?: Partial<GetSiblingListOptions<N, E>>) => NodeEntry<N> | undefined;
/**
* Get the first sibling list style type at the given indent. If none, return
* the entry list style type.
*/
declare const getSiblingListStyleType: <E extends SlateEditor>(editor: E, { entry, indent, ...options }: {
entry: NodeEntry<TElement>;
indent: number;
} & GetListSiblingsOptions<ElementOf<E>, E>) => ListStyleType;
declare function isOrderedList(element: TElement): boolean;
declare const someList: (editor: SlateEditor, type: string[] | string) => boolean;
declare const someTodoList: (editor: SlateEditor) => boolean;
interface ListOptions {
at?: TLocation;
listRestart?: number;
listRestartPolite?: number;
listStyleType?: ListStyleType | string;
}
/** Increase the indentation of the selected blocks. */
declare const indentList: (editor: SlateEditor, { listStyleType, ...options }?: ListOptions) => void;
declare const indentTodo: (editor: SlateEditor, { listStyleType, ...options }?: ListOptions) => void;
/** Decrease the indentation of the selected blocks. */
declare const outdentList: (editor: SlateEditor, options?: ListOptions) => void;
declare const setListNode: (editor: Editor, { at, indent, listStyleType, }: {
at: Path;
indent?: number;
listStyleType?: string;
}) => void;
declare const setIndentTodoNode: (editor: Editor, { at, indent, listStyleType, }: {
at: Path;
indent?: number;
listStyleType?: string;
}) => void;
/**
* Set indent list to the given entries. Add indent if listStyleType was not
* defined.
*/
declare const setListNodes: (editor: Editor, entries: NodeEntry[], { listStyleType, }: {
listStyleType?: string;
}) => void;
/** Set indent list to entry + siblings. */
declare const setListSiblingNodes: <N extends ElementOf<E>, E extends Editor = Editor>(editor: E, entry: ElementEntryOf<E>, { getSiblingListOptions, listStyleType, }: {
getSiblingListOptions?: GetSiblingListOptions<N, E>;
listStyleType?: string;
}) => void;
/** Toggle indent list. */
declare const toggleList: <N extends ElementOf<E>, E extends SlateEditor = SlateEditor>(editor: E, options: ListOptions, getSiblingListOptions?: GetSiblingListOptions<N, E>) => void;
declare const toggleListByPath: (editor: SlateEditor, [node, path]: NodeEntry, listStyleType: string) => void;
declare const toggleListByPathUnSet: (editor: SlateEditor, [, path]: NodeEntry) => void;
/** Set indent list if not set. */
declare const toggleListSet: (editor: Editor, [node, _path]: NodeEntry, { listStyleType, ...options }: ListOptions) => true | undefined;
/** Unset list style type if already set. */
declare const toggleListUnset: (editor: Editor, [node, path]: NodeEntry, { listStyleType, }: {
listStyleType?: string;
}) => true | undefined;
export { BaseListConfig, type GetListSiblingsOptions, GetSiblingListOptions, type ListOptions, ListStyleType, areEqListStyleType, getListAbove, getListExpectedListStart, getListSiblings, getNextList, getPreviousList, getSiblingListStyleType, indentList, indentTodo, isOrderedList, normalizeListNotIndented, normalizeListStart, outdentList, setIndentTodoNode, setListNode, setListNodes, setListSiblingNodes, someList, someTodoList, toggleList, toggleListByPath, toggleListByPathUnSet, toggleListSet, toggleListUnset, withInsertBreakList, withList, withNormalizeList };