import VList from './VList'; import type { RegionBase } from 'roosterjs-editor-types'; /** * Represent a chain of list nodes. * A chain of lists is a virtual link of lists that have continuous numbers, when editor one of them, * all others should also be updated in order to main the list number to be continuous. */ export default class VListChain { private region; private name; private lastNumber; private lastNumberBeforeCursor; /** * Create an array of VListChain from current region in editor * @param region The region to create VListChain from * @param currentNode Optional current node, used for mark lists that are after this node * @param nameGenerator Used by test code only */ static createListChains(region: RegionBase | RegionBase[], currentNode?: Node, nameGenerator?: () => string): VListChain[]; /** * Check if a list with the given start number can be appended next to the last list before cursor * @param startNumber The start number of the new list */ canAppendAtCursor(startNumber: number): boolean; /** * Create a VList to wrap the block of the given node, and append to current chain * @param container The container node to create list at * @param startNumber Start number of the new list */ createVListAtBlock(container: Node, startNumber: number): VList | null; /** * After change the lists, commit the change to all lists in this chain to update the list number, * and clear the temporary dataset values added to list node * @param shouldReuseAllAncestorListElements Whether we can parent list item (OL/UL) even if its list type does not match the previous one. @default false * @param disableListChain Whether we want to disable list chain functionality, so splitted list will always restart its number from 1 @default false */ commit(shouldReuseAllAncestorListElements?: boolean, disableListChain?: boolean): void; /** * Construct a new instance of VListChain class * @param editor Editor object */ private constructor(); /** * Check if the given list node is can be appended into current list chain * @param list The list node to check */ private canAppendToTail; /** * Append the given list node into this VListChain * @param list The list node to append * @param isAfterCurrentNode Whether this list is after current node */ private append; private applyChainName; private getLists; }