UNPKG

3.14 kBTypeScriptView 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 */
5/**
6 * @module list/documentlist/converters
7 */
8import { type DowncastAttributeEvent, type EditingController, type Element, type ElementCreatorFunction, type Mapper, type Model, type UpcastElementEvent, type ViewElement } from 'ckeditor5/src/engine';
9import type { GetCallback } from 'ckeditor5/src/utils';
10import { type ListElement } from './utils/model';
11import type { default as DocumentListEditing, DowncastStrategy } from './documentlistediting';
12/**
13 * Returns the upcast converter for list items. It's supposed to work after the block converters (content inside list items) are converted.
14 *
15 * @internal
16 */
17export declare function listItemUpcastConverter(): GetCallback<UpcastElementEvent>;
18/**
19 * Returns the upcast converter for the `<ul>` and `<ol>` view elements that cleans the input view of garbage.
20 * This is mostly to clean whitespaces from between the `<li>` view elements inside the view list element. However,
21 * incorrect data can also be cleared if the view was incorrect.
22 *
23 * @internal
24 */
25export declare function listUpcastCleanList(): GetCallback<UpcastElementEvent>;
26/**
27 * Returns a model document change:data event listener that triggers conversion of related items if needed.
28 *
29 * @internal
30 * @param model The editor model.
31 * @param editing The editing controller.
32 * @param attributeNames The list of all model list attributes (including registered strategies).
33 * @param documentListEditing The document list editing plugin.
34 */
35export declare function reconvertItemsOnDataChange(model: Model, editing: EditingController, attributeNames: Array<string>, documentListEditing: DocumentListEditing): () => void;
36/**
37 * Returns the list item downcast converter.
38 *
39 * @internal
40 * @param attributeNames A list of attribute names that should be converted if they are set.
41 * @param strategies The strategies.
42 * @param model The model.
43 */
44export declare function listItemDowncastConverter(attributeNames: Array<string>, strategies: Array<DowncastStrategy>, model: Model): GetCallback<DowncastAttributeEvent<ListElement>>;
45/**
46 * Returns the bogus paragraph view element creator. A bogus paragraph is used if a list item contains only a single block or nested list.
47 *
48 * @internal
49 * @param attributeNames The list of all model list attributes (including registered strategies).
50 */
51export declare function bogusParagraphCreator(attributeNames: Array<string>, { dataPipeline }?: {
52 dataPipeline?: boolean;
53}): ElementCreatorFunction;
54/**
55 * Helper for mapping mode to view elements. It's using positions mapping instead of mapper.toViewElement( element )
56 * to find outermost view element. This is for cases when mapping is using inner view element like in the code blocks (pre > code).
57 *
58 * @internal
59 * @param element The model element.
60 * @param mapper The mapper instance.
61 * @param model The model.
62 */
63export declare function findMappedViewElement(element: Element, mapper: Mapper, model: Model): ViewElement | null;