UNPKG

1.58 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module list/list/listutils
7 */
8import type { Element, Node } from 'ckeditor5/src/engine.js';
9import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
10import { Plugin } from 'ckeditor5/src/core.js';
11/**
12 * A set of helpers related to document lists.
13 */
14export default class ListUtils extends Plugin {
15 /**
16 * @inheritDoc
17 */
18 static get pluginName(): "ListUtils";
19 /**
20 * Expands the given list of selected blocks to include all the items of the lists they're in.
21 *
22 * @param blocks The list of selected blocks.
23 */
24 expandListBlocksToCompleteList(blocks: ArrayOrItem<Element>): Array<Element>;
25 /**
26 * Check if the given block is the first in the list item.
27 *
28 * @param listBlock The list block element.
29 */
30 isFirstBlockOfListItem(listBlock: Element): boolean;
31 /**
32 * Returns true if the given model node is a list item block.
33 *
34 * @param node A model node.
35 */
36 isListItemBlock(node: Node): boolean;
37 /**
38 * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
39 *
40 * @param blocks The list of selected blocks.
41 * @param options.withNested Whether should include nested list items.
42 */
43 expandListBlocksToCompleteItems(blocks: ArrayOrItem<Element>, options?: {
44 withNested?: boolean;
45 }): Array<Element>;
46}