UNPKG

1.69 kBJavaScriptView Raw
1/**
2 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5import { Plugin } from 'ckeditor5/src/core';
6import { expandListBlocksToCompleteItems, expandListBlocksToCompleteList, isFirstBlockOfListItem, isListItemBlock } from './utils/model';
7/**
8 * A set of helpers related to document lists.
9 */
10export default class DocumentListUtils extends Plugin {
11 /**
12 * @inheritDoc
13 */
14 static get pluginName() {
15 return 'DocumentListUtils';
16 }
17 /**
18 * Expands the given list of selected blocks to include all the items of the lists they're in.
19 *
20 * @param blocks The list of selected blocks.
21 */
22 expandListBlocksToCompleteList(blocks) {
23 return expandListBlocksToCompleteList(blocks);
24 }
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) {
31 return isFirstBlockOfListItem(listBlock);
32 }
33 /**
34 * Returns true if the given model node is a list item block.
35 *
36 * @param node A model node.
37 */
38 isListItemBlock(node) {
39 return isListItemBlock(node);
40 }
41 /**
42 * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
43 *
44 * @param blocks The list of selected blocks.
45 * @param options.withNested Whether should include nested list items.
46 */
47 expandListBlocksToCompleteItems(blocks, options = {}) {
48 return expandListBlocksToCompleteItems(blocks, options);
49 }
50}