@ckeditor/ckeditor5-list 38.1.0 → 38.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/list.js +1 -1
- package/build/list.js.map +1 -0
- package/package.json +3 -3
- package/src/augmentation.d.ts +50 -50
- package/src/augmentation.js +5 -5
- package/src/documentlist/adjacentlistssupport.d.ts +15 -15
- package/src/documentlist/adjacentlistssupport.js +81 -81
- package/src/documentlist/converters.d.ts +63 -63
- package/src/documentlist/converters.js +354 -354
- package/src/documentlist/documentlistcommand.d.ts +80 -80
- package/src/documentlist/documentlistcommand.js +145 -145
- package/src/documentlist/documentlistediting.d.ts +154 -154
- package/src/documentlist/documentlistediting.js +565 -565
- package/src/documentlist/documentlistindentcommand.d.ts +62 -62
- package/src/documentlist/documentlistindentcommand.js +129 -129
- package/src/documentlist/documentlistmergecommand.d.ts +76 -76
- package/src/documentlist/documentlistmergecommand.js +174 -174
- package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
- package/src/documentlist/documentlistsplitcommand.js +70 -70
- package/src/documentlist/documentlistutils.d.ts +46 -46
- package/src/documentlist/documentlistutils.js +50 -50
- package/src/documentlist/utils/listwalker.d.ts +141 -141
- package/src/documentlist/utils/listwalker.js +162 -162
- package/src/documentlist/utils/model.d.ts +193 -193
- package/src/documentlist/utils/model.js +435 -435
- package/src/documentlist/utils/postfixers.d.ts +37 -37
- package/src/documentlist/utils/postfixers.js +118 -118
- package/src/documentlist/utils/view.d.ts +81 -81
- package/src/documentlist/utils/view.js +117 -117
- package/src/documentlist.d.ts +26 -26
- package/src/documentlist.js +30 -30
- package/src/documentlistproperties/converters.d.ts +19 -19
- package/src/documentlistproperties/converters.js +43 -43
- package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
- package/src/documentlistproperties/documentlistpropertiesediting.js +289 -289
- package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
- package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
- package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
- package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
- package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
- package/src/documentlistproperties/documentliststartcommand.js +57 -57
- package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
- package/src/documentlistproperties/documentliststylecommand.js +113 -113
- package/src/documentlistproperties/utils/style.d.ts +20 -20
- package/src/documentlistproperties/utils/style.js +54 -54
- package/src/documentlistproperties.d.ts +27 -27
- package/src/documentlistproperties.js +31 -31
- package/src/index.d.ts +40 -40
- package/src/index.js +27 -27
- package/src/list/converters.d.ts +196 -196
- package/src/list/converters.js +905 -905
- package/src/list/indentcommand.d.ts +37 -37
- package/src/list/indentcommand.js +107 -107
- package/src/list/listcommand.d.ts +55 -55
- package/src/list/listcommand.js +274 -274
- package/src/list/listediting.d.ts +32 -32
- package/src/list/listediting.js +161 -161
- package/src/list/listui.d.ts +19 -19
- package/src/list/listui.js +32 -32
- package/src/list/listutils.d.ts +41 -41
- package/src/list/listutils.js +46 -46
- package/src/list/utils.d.ts +112 -112
- package/src/list/utils.js +374 -374
- package/src/list.d.ts +26 -26
- package/src/list.js +30 -30
- package/src/listconfig.d.ts +122 -122
- package/src/listconfig.js +5 -5
- package/src/listproperties/listpropertiesediting.d.ts +72 -72
- package/src/listproperties/listpropertiesediting.js +696 -696
- package/src/listproperties/listpropertiesui.d.ts +23 -23
- package/src/listproperties/listpropertiesui.js +277 -277
- package/src/listproperties/listreversedcommand.d.ts +38 -38
- package/src/listproperties/listreversedcommand.js +52 -52
- package/src/listproperties/liststartcommand.d.ts +37 -37
- package/src/listproperties/liststartcommand.js +51 -51
- package/src/listproperties/liststylecommand.d.ts +67 -67
- package/src/listproperties/liststylecommand.js +99 -99
- package/src/listproperties/ui/collapsibleview.d.ts +63 -63
- package/src/listproperties/ui/collapsibleview.js +89 -89
- package/src/listproperties/ui/listpropertiesview.d.ts +157 -157
- package/src/listproperties/ui/listpropertiesview.js +299 -299
- package/src/listproperties.d.ts +26 -26
- package/src/listproperties.js +30 -30
- package/src/liststyle.d.ts +28 -28
- package/src/liststyle.js +36 -36
- package/src/todolist/checktodolistcommand.d.ts +52 -52
- package/src/todolist/checktodolistcommand.js +76 -76
- package/src/todolist/todolistconverters.d.ts +82 -82
- package/src/todolist/todolistconverters.js +260 -260
- package/src/todolist/todolistediting.d.ts +39 -39
- package/src/todolist/todolistediting.js +161 -161
- package/src/todolist/todolistui.d.ts +19 -19
- package/src/todolist/todolistui.js +29 -29
- package/src/todolist.d.ts +27 -27
- package/src/todolist.js +31 -31
package/src/list/utils.d.ts
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
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/list/utils
|
|
7
|
-
*/
|
|
8
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
9
|
-
import { type DowncastConversionApi, type DowncastWriter, type Element, type Item, type Model, type Position, type ViewContainerElement, type ViewElement, type ViewItem, type ViewPosition } from 'ckeditor5/src/engine';
|
|
10
|
-
/**
|
|
11
|
-
* Creates a list item {@link module:engine/view/containerelement~ContainerElement}.
|
|
12
|
-
*
|
|
13
|
-
* @param writer The writer instance.
|
|
14
|
-
*/
|
|
15
|
-
export declare function createViewListItemElement(writer: DowncastWriter): ViewContainerElement;
|
|
16
|
-
/**
|
|
17
|
-
* Helper function that creates a `<ul><li></li></ul>` or (`<ol>`) structure out of the given `modelItem` model `listItem` element.
|
|
18
|
-
* Then, it binds the created view list item (`<li>`) with the model `listItem` element.
|
|
19
|
-
* The function then returns the created view list item (`<li>`).
|
|
20
|
-
*
|
|
21
|
-
* @param modelItem Model list item.
|
|
22
|
-
* @param conversionApi Conversion interface.
|
|
23
|
-
* @returns View list element.
|
|
24
|
-
*/
|
|
25
|
-
export declare function generateLiInUl(modelItem: Item, conversionApi: DowncastConversionApi): ViewContainerElement;
|
|
26
|
-
/**
|
|
27
|
-
* Helper function that inserts a view list at a correct place and merges it with its siblings.
|
|
28
|
-
* It takes a model list item element (`modelItem`) and a corresponding view list item element (`injectedItem`). The view list item
|
|
29
|
-
* should be in a view list element (`<ul>` or `<ol>`) and should be its only child.
|
|
30
|
-
* See comments below to better understand the algorithm.
|
|
31
|
-
*
|
|
32
|
-
* @param modelItem Model list item.
|
|
33
|
-
* @param injectedItem
|
|
34
|
-
* @param conversionApi Conversion interface.
|
|
35
|
-
* @param model The model instance.
|
|
36
|
-
*/
|
|
37
|
-
export declare function injectViewList(modelItem: Element, injectedItem: ViewContainerElement, conversionApi: DowncastConversionApi, model: Model): void;
|
|
38
|
-
/**
|
|
39
|
-
* Helper function that takes two parameters that are expected to be view list elements, and merges them.
|
|
40
|
-
* The merge happens only if both parameters are list elements of the same type (the same element name and the same class attributes).
|
|
41
|
-
*
|
|
42
|
-
* @param viewWriter The writer instance.
|
|
43
|
-
* @param firstList The first element to compare.
|
|
44
|
-
* @param secondList The second element to compare.
|
|
45
|
-
* @returns The position after merge or `null` when there was no merge.
|
|
46
|
-
*/
|
|
47
|
-
export declare function mergeViewLists(viewWriter: DowncastWriter, firstList: ViewItem, secondList: ViewItem): ViewPosition | null;
|
|
48
|
-
/**
|
|
49
|
-
* Helper function that for a given `view.Position`, returns a `view.Position` that is after all `view.UIElement`s that
|
|
50
|
-
* are after the given position.
|
|
51
|
-
*
|
|
52
|
-
* For example:
|
|
53
|
-
* `<container:p>foo^<ui:span></ui:span><ui:span></ui:span>bar</container:p>`
|
|
54
|
-
* For position ^, the position before "bar" will be returned.
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
export declare function positionAfterUiElements(viewPosition: ViewPosition): ViewPosition;
|
|
58
|
-
/**
|
|
59
|
-
* Helper function that searches for a previous list item sibling of a given model item that meets the given criteria
|
|
60
|
-
* passed by the options object.
|
|
61
|
-
*
|
|
62
|
-
* @param options Search criteria.
|
|
63
|
-
* @param options.sameIndent Whether the sought sibling should have the same indentation.
|
|
64
|
-
* @param options.smallerIndent Whether the sought sibling should have a smaller indentation.
|
|
65
|
-
* @param options.listIndent The reference indentation.
|
|
66
|
-
* @param options.direction Walking direction.
|
|
67
|
-
*/
|
|
68
|
-
export declare function getSiblingListItem(modelItem: Item | null, options: {
|
|
69
|
-
sameIndent?: boolean;
|
|
70
|
-
smallerIndent?: boolean;
|
|
71
|
-
listIndent?: number;
|
|
72
|
-
direction?: 'forward' | 'backward';
|
|
73
|
-
}): Element | null;
|
|
74
|
-
/**
|
|
75
|
-
* Helper method for creating a UI button and linking it with an appropriate command.
|
|
76
|
-
*
|
|
77
|
-
* @internal
|
|
78
|
-
* @param editor The editor instance to which the UI component will be added.
|
|
79
|
-
* @param commandName The name of the command.
|
|
80
|
-
* @param label The button label.
|
|
81
|
-
* @param icon The source of the icon.
|
|
82
|
-
*/
|
|
83
|
-
export declare function createUIComponent(editor: Editor, commandName: 'bulletedList' | 'numberedList' | 'todoList', label: string, icon: string): void;
|
|
84
|
-
/**
|
|
85
|
-
* Returns a first list view element that is direct child of the given view element.
|
|
86
|
-
*/
|
|
87
|
-
export declare function findNestedList(viewElement: ViewElement): ViewElement | null;
|
|
88
|
-
/**
|
|
89
|
-
* Returns an array with all `listItem` elements that represent the same list.
|
|
90
|
-
*
|
|
91
|
-
* It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
|
|
92
|
-
*
|
|
93
|
-
* Additionally, if the `position` is inside a list item, that list item will be returned as well.
|
|
94
|
-
*
|
|
95
|
-
* @param position Starting position.
|
|
96
|
-
* @param direction Walking direction.
|
|
97
|
-
*/
|
|
98
|
-
export declare function getSiblingNodes(position: Position, direction: 'forward' | 'backward'): Array<Element>;
|
|
99
|
-
/**
|
|
100
|
-
* Returns an array with all `listItem` elements in the model selection.
|
|
101
|
-
*
|
|
102
|
-
* It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
|
|
103
|
-
* If no list is selected, it returns an empty array.
|
|
104
|
-
* The order of the elements is not specified.
|
|
105
|
-
*
|
|
106
|
-
* @internal
|
|
107
|
-
*/
|
|
108
|
-
export declare function getSelectedListItems(model: Model): Array<Element>;
|
|
109
|
-
/**
|
|
110
|
-
* Checks whether the given list-style-type is supported by numbered or bulleted list.
|
|
111
|
-
*/
|
|
112
|
-
export declare function getListTypeFromListStyleType(listStyleType: string): 'bulleted' | 'numbered' | null;
|
|
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/list/utils
|
|
7
|
+
*/
|
|
8
|
+
import type { Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import { type DowncastConversionApi, type DowncastWriter, type Element, type Item, type Model, type Position, type ViewContainerElement, type ViewElement, type ViewItem, type ViewPosition } from 'ckeditor5/src/engine';
|
|
10
|
+
/**
|
|
11
|
+
* Creates a list item {@link module:engine/view/containerelement~ContainerElement}.
|
|
12
|
+
*
|
|
13
|
+
* @param writer The writer instance.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createViewListItemElement(writer: DowncastWriter): ViewContainerElement;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function that creates a `<ul><li></li></ul>` or (`<ol>`) structure out of the given `modelItem` model `listItem` element.
|
|
18
|
+
* Then, it binds the created view list item (`<li>`) with the model `listItem` element.
|
|
19
|
+
* The function then returns the created view list item (`<li>`).
|
|
20
|
+
*
|
|
21
|
+
* @param modelItem Model list item.
|
|
22
|
+
* @param conversionApi Conversion interface.
|
|
23
|
+
* @returns View list element.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateLiInUl(modelItem: Item, conversionApi: DowncastConversionApi): ViewContainerElement;
|
|
26
|
+
/**
|
|
27
|
+
* Helper function that inserts a view list at a correct place and merges it with its siblings.
|
|
28
|
+
* It takes a model list item element (`modelItem`) and a corresponding view list item element (`injectedItem`). The view list item
|
|
29
|
+
* should be in a view list element (`<ul>` or `<ol>`) and should be its only child.
|
|
30
|
+
* See comments below to better understand the algorithm.
|
|
31
|
+
*
|
|
32
|
+
* @param modelItem Model list item.
|
|
33
|
+
* @param injectedItem
|
|
34
|
+
* @param conversionApi Conversion interface.
|
|
35
|
+
* @param model The model instance.
|
|
36
|
+
*/
|
|
37
|
+
export declare function injectViewList(modelItem: Element, injectedItem: ViewContainerElement, conversionApi: DowncastConversionApi, model: Model): void;
|
|
38
|
+
/**
|
|
39
|
+
* Helper function that takes two parameters that are expected to be view list elements, and merges them.
|
|
40
|
+
* The merge happens only if both parameters are list elements of the same type (the same element name and the same class attributes).
|
|
41
|
+
*
|
|
42
|
+
* @param viewWriter The writer instance.
|
|
43
|
+
* @param firstList The first element to compare.
|
|
44
|
+
* @param secondList The second element to compare.
|
|
45
|
+
* @returns The position after merge or `null` when there was no merge.
|
|
46
|
+
*/
|
|
47
|
+
export declare function mergeViewLists(viewWriter: DowncastWriter, firstList: ViewItem, secondList: ViewItem): ViewPosition | null;
|
|
48
|
+
/**
|
|
49
|
+
* Helper function that for a given `view.Position`, returns a `view.Position` that is after all `view.UIElement`s that
|
|
50
|
+
* are after the given position.
|
|
51
|
+
*
|
|
52
|
+
* For example:
|
|
53
|
+
* `<container:p>foo^<ui:span></ui:span><ui:span></ui:span>bar</container:p>`
|
|
54
|
+
* For position ^, the position before "bar" will be returned.
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
export declare function positionAfterUiElements(viewPosition: ViewPosition): ViewPosition;
|
|
58
|
+
/**
|
|
59
|
+
* Helper function that searches for a previous list item sibling of a given model item that meets the given criteria
|
|
60
|
+
* passed by the options object.
|
|
61
|
+
*
|
|
62
|
+
* @param options Search criteria.
|
|
63
|
+
* @param options.sameIndent Whether the sought sibling should have the same indentation.
|
|
64
|
+
* @param options.smallerIndent Whether the sought sibling should have a smaller indentation.
|
|
65
|
+
* @param options.listIndent The reference indentation.
|
|
66
|
+
* @param options.direction Walking direction.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getSiblingListItem(modelItem: Item | null, options: {
|
|
69
|
+
sameIndent?: boolean;
|
|
70
|
+
smallerIndent?: boolean;
|
|
71
|
+
listIndent?: number;
|
|
72
|
+
direction?: 'forward' | 'backward';
|
|
73
|
+
}): Element | null;
|
|
74
|
+
/**
|
|
75
|
+
* Helper method for creating a UI button and linking it with an appropriate command.
|
|
76
|
+
*
|
|
77
|
+
* @internal
|
|
78
|
+
* @param editor The editor instance to which the UI component will be added.
|
|
79
|
+
* @param commandName The name of the command.
|
|
80
|
+
* @param label The button label.
|
|
81
|
+
* @param icon The source of the icon.
|
|
82
|
+
*/
|
|
83
|
+
export declare function createUIComponent(editor: Editor, commandName: 'bulletedList' | 'numberedList' | 'todoList', label: string, icon: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Returns a first list view element that is direct child of the given view element.
|
|
86
|
+
*/
|
|
87
|
+
export declare function findNestedList(viewElement: ViewElement): ViewElement | null;
|
|
88
|
+
/**
|
|
89
|
+
* Returns an array with all `listItem` elements that represent the same list.
|
|
90
|
+
*
|
|
91
|
+
* It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
|
|
92
|
+
*
|
|
93
|
+
* Additionally, if the `position` is inside a list item, that list item will be returned as well.
|
|
94
|
+
*
|
|
95
|
+
* @param position Starting position.
|
|
96
|
+
* @param direction Walking direction.
|
|
97
|
+
*/
|
|
98
|
+
export declare function getSiblingNodes(position: Position, direction: 'forward' | 'backward'): Array<Element>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns an array with all `listItem` elements in the model selection.
|
|
101
|
+
*
|
|
102
|
+
* It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
|
|
103
|
+
* If no list is selected, it returns an empty array.
|
|
104
|
+
* The order of the elements is not specified.
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
export declare function getSelectedListItems(model: Model): Array<Element>;
|
|
109
|
+
/**
|
|
110
|
+
* Checks whether the given list-style-type is supported by numbered or bulleted list.
|
|
111
|
+
*/
|
|
112
|
+
export declare function getListTypeFromListStyleType(listStyleType: string): 'bulleted' | 'numbered' | null;
|