import { Plugin, ProseMirror, Schema } from '../../prosemirror'; import { BulletListNodeType, ListItemNodeType, OrderedListNodeType } from '../../schema'; export declare type ListType = 'bullet_list' | 'ordered_list' | null; export interface ListsOptions { type?: ListType; } export declare type StateChangeHandler = (state: ListsState) => any; export declare class ListsState { private changeHandlers; private pm; private wrapInBulletList; private wrapInOrderedList; bulletListActive: boolean; bulletListDisabled: boolean; bulletListHidden: boolean; orderedListActive: boolean; orderedListDisabled: boolean; orderedListHidden: boolean; active: boolean; enabled: boolean; type?: ListType; constructor(pm: PM); subscribe(cb: StateChangeHandler): void; unsubscribe(cb: StateChangeHandler): void; toggleOrderedList(): void; toggleBulletList(): void; private addKeymap(pm); /** * If the current selection is a list or part of a list, this method will untoggle * the list type for that selection. * In any other case it will try to apply the specified list type to the seletion, * either by converting existing lists to the new type or just apply the list type * if there's no list in the selection. */ private toggleList(nodeType); private toggleListAtSelection(nodeType, $from, $to, shouldUntoggle, shouldConvertToType); private update(); /** * Step through block-nodes between $from and $to and return true if a node is a * bullet_list or ordered_list */ private rangeContainsList(pm, $from, $to); /** * Sometimes a selection in the editor can be slightly offset, for example: * it's possible for a selection to start or end at an empty node at the very end of * a line. This isn't obvious by looking at the editor and it's likely not what the * user intended - so we need to adjust the seletion a bit in scenarios like that. */ private adjustSelection(selection); private resetSelection(); } declare var _default: Plugin; export default _default; export interface S extends Schema { nodes: { bullet_list?: BulletListNodeType; list_item: ListItemNodeType; ordered_list?: OrderedListNodeType; }; } export interface PM extends ProseMirror { schema: S; }