@ckeditor/ckeditor5-list 39.0.2 → 40.0.0
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/build/translations/fi.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/ckeditor5-metadata.json +44 -0
- package/lang/translations/fi.po +1 -1
- package/lang/translations/pt-br.po +10 -10
- package/package.json +3 -3
- package/src/augmentation.d.ts +52 -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 +65 -63
- package/src/documentlist/converters.js +441 -354
- package/src/documentlist/documentlistcommand.d.ts +80 -80
- package/src/documentlist/documentlistcommand.js +150 -145
- package/src/documentlist/documentlistediting.d.ts +212 -154
- package/src/documentlist/documentlistediting.js +645 -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 +145 -141
- package/src/documentlist/utils/listwalker.js +182 -162
- package/src/documentlist/utils/model.d.ts +202 -193
- package/src/documentlist/utils/model.js +455 -435
- package/src/documentlist/utils/postfixers.d.ts +37 -37
- package/src/documentlist/utils/postfixers.js +126 -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 +266 -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 +43 -40
- package/src/index.js +29 -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 +132 -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/tododocumentlist/checktododocumentlistcommand.d.ts +49 -0
- package/src/tododocumentlist/checktododocumentlistcommand.js +82 -0
- package/src/tododocumentlist/todocheckboxchangeobserver.d.ts +41 -0
- package/src/tododocumentlist/todocheckboxchangeobserver.js +37 -0
- package/src/tododocumentlist/tododocumentlistediting.d.ts +38 -0
- package/src/tododocumentlist/tododocumentlistediting.js +399 -0
- package/src/tododocumentlist.d.ts +27 -0
- package/src/tododocumentlist.js +31 -0
- 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/theme/todolist.css +101 -70
|
@@ -1,37 +1,37 @@
|
|
|
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/utils/postfixers
|
|
7
|
-
*/
|
|
8
|
-
import type { Position, Writer } from 'ckeditor5/src/engine';
|
|
9
|
-
import { type ListIteratorValue } from './listwalker';
|
|
10
|
-
import { type ListElement } from './model';
|
|
11
|
-
/**
|
|
12
|
-
* Based on the provided positions looks for the list head and stores it in the provided map.
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
* @param position The search starting position.
|
|
16
|
-
* @param itemToListHead The map from list item element to the list head element.
|
|
17
|
-
*/
|
|
18
|
-
export declare function findAndAddListHeadToMap(position: Position, itemToListHead: Map<ListElement, ListElement>): void;
|
|
19
|
-
/**
|
|
20
|
-
* Scans the list starting from the given list head element and fixes items' indentation.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
* @param listNodes The iterable of list nodes.
|
|
24
|
-
* @param writer The model writer.
|
|
25
|
-
* @returns Whether the model was modified.
|
|
26
|
-
*/
|
|
27
|
-
export declare function fixListIndents(listNodes: Iterable<ListIteratorValue>, writer: Writer): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Scans the list starting from the given list head element and fixes items' types.
|
|
30
|
-
*
|
|
31
|
-
* @internal
|
|
32
|
-
* @param listNodes The iterable of list nodes.
|
|
33
|
-
* @param seenIds The set of already known IDs.
|
|
34
|
-
* @param writer The model writer.
|
|
35
|
-
* @returns Whether the model was modified.
|
|
36
|
-
*/
|
|
37
|
-
export declare function fixListItemIds(listNodes: Iterable<ListIteratorValue>, seenIds: Set<string>, writer: Writer): boolean;
|
|
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/utils/postfixers
|
|
7
|
+
*/
|
|
8
|
+
import type { Position, Writer } from 'ckeditor5/src/engine';
|
|
9
|
+
import { type ListIteratorValue } from './listwalker';
|
|
10
|
+
import { type ListElement } from './model';
|
|
11
|
+
/**
|
|
12
|
+
* Based on the provided positions looks for the list head and stores it in the provided map.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
* @param position The search starting position.
|
|
16
|
+
* @param itemToListHead The map from list item element to the list head element.
|
|
17
|
+
*/
|
|
18
|
+
export declare function findAndAddListHeadToMap(position: Position, itemToListHead: Map<ListElement, ListElement>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Scans the list starting from the given list head element and fixes items' indentation.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
* @param listNodes The iterable of list nodes.
|
|
24
|
+
* @param writer The model writer.
|
|
25
|
+
* @returns Whether the model was modified.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fixListIndents(listNodes: Iterable<ListIteratorValue>, writer: Writer): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Scans the list starting from the given list head element and fixes items' types.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
* @param listNodes The iterable of list nodes.
|
|
33
|
+
* @param seenIds The set of already known IDs.
|
|
34
|
+
* @param writer The model writer.
|
|
35
|
+
* @returns Whether the model was modified.
|
|
36
|
+
*/
|
|
37
|
+
export declare function fixListItemIds(listNodes: Iterable<ListIteratorValue>, seenIds: Set<string>, writer: Writer): boolean;
|
|
@@ -1,118 +1,126 @@
|
|
|
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
|
-
import { iterateSiblingListBlocks } from './listwalker';
|
|
6
|
-
import { getListItemBlocks, isListItemBlock, ListItemUid } from './model';
|
|
7
|
-
/**
|
|
8
|
-
* Based on the provided positions looks for the list head and stores it in the provided map.
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
* @param position The search starting position.
|
|
12
|
-
* @param itemToListHead The map from list item element to the list head element.
|
|
13
|
-
*/
|
|
14
|
-
export function findAndAddListHeadToMap(position, itemToListHead) {
|
|
15
|
-
const previousNode = position.nodeBefore;
|
|
16
|
-
if (!isListItemBlock(previousNode)) {
|
|
17
|
-
const item = position.nodeAfter;
|
|
18
|
-
if (isListItemBlock(item)) {
|
|
19
|
-
itemToListHead.set(item, item);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
let listHead = previousNode;
|
|
24
|
-
// Previously, the loop below was defined like this:
|
|
25
|
-
//
|
|
26
|
-
// for ( { node: listHead } of iterateSiblingListBlocks( listHead, 'backward' ) )
|
|
27
|
-
//
|
|
28
|
-
// Unfortunately, such a destructuring is incorrectly transpiled by Babel and the loop never ends.
|
|
29
|
-
// See: https://github.com/ckeditor/ckeditor5-react/issues/345.
|
|
30
|
-
for (const { node } of iterateSiblingListBlocks(listHead, 'backward')) {
|
|
31
|
-
listHead = node;
|
|
32
|
-
if (itemToListHead.has(listHead)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
itemToListHead.set(previousNode, listHead);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Scans the list starting from the given list head element and fixes items' indentation.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
* @param listNodes The iterable of list nodes.
|
|
44
|
-
* @param writer The model writer.
|
|
45
|
-
* @returns Whether the model was modified.
|
|
46
|
-
*/
|
|
47
|
-
export function fixListIndents(listNodes, writer) {
|
|
48
|
-
let maxIndent = 0; // Guards local sublist max indents that need fixing.
|
|
49
|
-
let prevIndent = -1; // Previous item indent.
|
|
50
|
-
let fixBy = null;
|
|
51
|
-
let applied = false;
|
|
52
|
-
for (const { node } of listNodes) {
|
|
53
|
-
const itemIndent = node.getAttribute('listIndent');
|
|
54
|
-
if (itemIndent > maxIndent) {
|
|
55
|
-
let newIndent;
|
|
56
|
-
if (fixBy === null) {
|
|
57
|
-
fixBy = itemIndent - maxIndent;
|
|
58
|
-
newIndent = maxIndent;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
if (fixBy > itemIndent) {
|
|
62
|
-
fixBy = itemIndent;
|
|
63
|
-
}
|
|
64
|
-
newIndent = itemIndent - fixBy;
|
|
65
|
-
}
|
|
66
|
-
if (newIndent > prevIndent + 1) {
|
|
67
|
-
newIndent = prevIndent + 1;
|
|
68
|
-
}
|
|
69
|
-
writer.setAttribute('listIndent', newIndent, node);
|
|
70
|
-
applied = true;
|
|
71
|
-
prevIndent = newIndent;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
fixBy = null;
|
|
75
|
-
maxIndent = itemIndent + 1;
|
|
76
|
-
prevIndent = itemIndent;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return applied;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Scans the list starting from the given list head element and fixes items' types.
|
|
83
|
-
*
|
|
84
|
-
* @internal
|
|
85
|
-
* @param listNodes The iterable of list nodes.
|
|
86
|
-
* @param seenIds The set of already known IDs.
|
|
87
|
-
* @param writer The model writer.
|
|
88
|
-
* @returns Whether the model was modified.
|
|
89
|
-
*/
|
|
90
|
-
export function fixListItemIds(listNodes, seenIds, writer) {
|
|
91
|
-
const visited = new Set();
|
|
92
|
-
let applied = false;
|
|
93
|
-
for (const { node } of listNodes) {
|
|
94
|
-
if (visited.has(node)) {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
let listType = node.getAttribute('listType');
|
|
98
|
-
let listItemId = node.getAttribute('listItemId');
|
|
99
|
-
// Use a new ID if this one was spot earlier (even in other list).
|
|
100
|
-
if (seenIds.has(listItemId)) {
|
|
101
|
-
listItemId = ListItemUid.next();
|
|
102
|
-
}
|
|
103
|
-
seenIds.add(listItemId);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
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
|
+
import { iterateSiblingListBlocks } from './listwalker';
|
|
6
|
+
import { getListItemBlocks, isListItemBlock, ListItemUid } from './model';
|
|
7
|
+
/**
|
|
8
|
+
* Based on the provided positions looks for the list head and stores it in the provided map.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
* @param position The search starting position.
|
|
12
|
+
* @param itemToListHead The map from list item element to the list head element.
|
|
13
|
+
*/
|
|
14
|
+
export function findAndAddListHeadToMap(position, itemToListHead) {
|
|
15
|
+
const previousNode = position.nodeBefore;
|
|
16
|
+
if (!isListItemBlock(previousNode)) {
|
|
17
|
+
const item = position.nodeAfter;
|
|
18
|
+
if (isListItemBlock(item)) {
|
|
19
|
+
itemToListHead.set(item, item);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
let listHead = previousNode;
|
|
24
|
+
// Previously, the loop below was defined like this:
|
|
25
|
+
//
|
|
26
|
+
// for ( { node: listHead } of iterateSiblingListBlocks( listHead, 'backward' ) )
|
|
27
|
+
//
|
|
28
|
+
// Unfortunately, such a destructuring is incorrectly transpiled by Babel and the loop never ends.
|
|
29
|
+
// See: https://github.com/ckeditor/ckeditor5-react/issues/345.
|
|
30
|
+
for (const { node } of iterateSiblingListBlocks(listHead, 'backward')) {
|
|
31
|
+
listHead = node;
|
|
32
|
+
if (itemToListHead.has(listHead)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
itemToListHead.set(previousNode, listHead);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Scans the list starting from the given list head element and fixes items' indentation.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
* @param listNodes The iterable of list nodes.
|
|
44
|
+
* @param writer The model writer.
|
|
45
|
+
* @returns Whether the model was modified.
|
|
46
|
+
*/
|
|
47
|
+
export function fixListIndents(listNodes, writer) {
|
|
48
|
+
let maxIndent = 0; // Guards local sublist max indents that need fixing.
|
|
49
|
+
let prevIndent = -1; // Previous item indent.
|
|
50
|
+
let fixBy = null;
|
|
51
|
+
let applied = false;
|
|
52
|
+
for (const { node } of listNodes) {
|
|
53
|
+
const itemIndent = node.getAttribute('listIndent');
|
|
54
|
+
if (itemIndent > maxIndent) {
|
|
55
|
+
let newIndent;
|
|
56
|
+
if (fixBy === null) {
|
|
57
|
+
fixBy = itemIndent - maxIndent;
|
|
58
|
+
newIndent = maxIndent;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (fixBy > itemIndent) {
|
|
62
|
+
fixBy = itemIndent;
|
|
63
|
+
}
|
|
64
|
+
newIndent = itemIndent - fixBy;
|
|
65
|
+
}
|
|
66
|
+
if (newIndent > prevIndent + 1) {
|
|
67
|
+
newIndent = prevIndent + 1;
|
|
68
|
+
}
|
|
69
|
+
writer.setAttribute('listIndent', newIndent, node);
|
|
70
|
+
applied = true;
|
|
71
|
+
prevIndent = newIndent;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
fixBy = null;
|
|
75
|
+
maxIndent = itemIndent + 1;
|
|
76
|
+
prevIndent = itemIndent;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return applied;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Scans the list starting from the given list head element and fixes items' types.
|
|
83
|
+
*
|
|
84
|
+
* @internal
|
|
85
|
+
* @param listNodes The iterable of list nodes.
|
|
86
|
+
* @param seenIds The set of already known IDs.
|
|
87
|
+
* @param writer The model writer.
|
|
88
|
+
* @returns Whether the model was modified.
|
|
89
|
+
*/
|
|
90
|
+
export function fixListItemIds(listNodes, seenIds, writer) {
|
|
91
|
+
const visited = new Set();
|
|
92
|
+
let applied = false;
|
|
93
|
+
for (const { node } of listNodes) {
|
|
94
|
+
if (visited.has(node)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
let listType = node.getAttribute('listType');
|
|
98
|
+
let listItemId = node.getAttribute('listItemId');
|
|
99
|
+
// Use a new ID if this one was spot earlier (even in other list).
|
|
100
|
+
if (seenIds.has(listItemId)) {
|
|
101
|
+
listItemId = ListItemUid.next();
|
|
102
|
+
}
|
|
103
|
+
seenIds.add(listItemId);
|
|
104
|
+
// Make sure that all items in a simple list have unique IDs.
|
|
105
|
+
if (node.is('element', 'listItem')) {
|
|
106
|
+
if (node.getAttribute('listItemId') != listItemId) {
|
|
107
|
+
writer.setAttribute('listItemId', listItemId, node);
|
|
108
|
+
applied = true;
|
|
109
|
+
}
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
for (const block of getListItemBlocks(node, { direction: 'forward' })) {
|
|
113
|
+
visited.add(block);
|
|
114
|
+
// Use a new ID if a block of a bigger list item has different type.
|
|
115
|
+
if (block.getAttribute('listType') != listType) {
|
|
116
|
+
listItemId = ListItemUid.next();
|
|
117
|
+
listType = block.getAttribute('listType');
|
|
118
|
+
}
|
|
119
|
+
if (block.getAttribute('listItemId') != listItemId) {
|
|
120
|
+
writer.setAttribute('listItemId', listItemId, block);
|
|
121
|
+
applied = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return applied;
|
|
126
|
+
}
|
|
@@ -1,81 +1,81 @@
|
|
|
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/utils/view
|
|
7
|
-
*/
|
|
8
|
-
import type { DowncastWriter, ViewAttributeElement, ViewDocumentFragment, ViewElement, ViewNode } from 'ckeditor5/src/engine';
|
|
9
|
-
/**
|
|
10
|
-
* Checks if view element is a list type (ul or ol).
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function isListView(viewElement: ViewNode | ViewDocumentFragment): viewElement is ViewElement & {
|
|
15
|
-
name: 'ul' | 'ol';
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Checks if view element is a list item (li).
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export declare function isListItemView(viewElement: ViewNode | ViewDocumentFragment): viewElement is ViewElement & {
|
|
23
|
-
name: 'li';
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.
|
|
27
|
-
*
|
|
28
|
-
* Also, fixes non HTML compliant lists indents:
|
|
29
|
-
*
|
|
30
|
-
* ```
|
|
31
|
-
* before: fixed list:
|
|
32
|
-
* OL OL
|
|
33
|
-
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
34
|
-
* |-> OL |-> OL
|
|
35
|
-
* |-> OL |
|
|
36
|
-
* | |-> OL |
|
|
37
|
-
* | |-> OL |
|
|
38
|
-
* | |-> LI (parent LIs: 1) |-> LI (indent: 1)
|
|
39
|
-
* |-> LI (parent LIs: 1) |-> LI (indent: 1)
|
|
40
|
-
*
|
|
41
|
-
* before: fixed list:
|
|
42
|
-
* OL OL
|
|
43
|
-
* |-> OL |
|
|
44
|
-
* |-> OL |
|
|
45
|
-
* |-> OL |
|
|
46
|
-
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
47
|
-
*
|
|
48
|
-
* before: fixed list:
|
|
49
|
-
* OL OL
|
|
50
|
-
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
51
|
-
* |-> OL |-> OL
|
|
52
|
-
* |-> LI (parent LIs: 0) |-> LI (indent: 1)
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
export declare function getIndent(listItem: ViewElement): number;
|
|
58
|
-
/**
|
|
59
|
-
* Creates a list attribute element (ol or ul).
|
|
60
|
-
*
|
|
61
|
-
* @internal
|
|
62
|
-
*/
|
|
63
|
-
export declare function createListElement(writer: DowncastWriter, indent: number, type: 'bulleted' | 'numbered', id?: string): ViewAttributeElement;
|
|
64
|
-
/**
|
|
65
|
-
* Creates a list item attribute element (li).
|
|
66
|
-
*
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
export declare function createListItemElement(writer: DowncastWriter, indent: number, id: string): ViewAttributeElement;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a view element name for the given list type.
|
|
72
|
-
*
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
export declare function getViewElementNameForListType(type?: 'bulleted' | 'numbered'): 'ol' | 'ul';
|
|
76
|
-
/**
|
|
77
|
-
* Returns a view element ID for the given list type and indent.
|
|
78
|
-
*
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
|
-
export declare function getViewElementIdForListType(type?: 'bulleted' | 'numbered', indent?: number): string;
|
|
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/utils/view
|
|
7
|
+
*/
|
|
8
|
+
import type { DowncastWriter, ViewAttributeElement, ViewDocumentFragment, ViewElement, ViewNode } from 'ckeditor5/src/engine';
|
|
9
|
+
/**
|
|
10
|
+
* Checks if view element is a list type (ul or ol).
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function isListView(viewElement: ViewNode | ViewDocumentFragment): viewElement is ViewElement & {
|
|
15
|
+
name: 'ul' | 'ol';
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Checks if view element is a list item (li).
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function isListItemView(viewElement: ViewNode | ViewDocumentFragment): viewElement is ViewElement & {
|
|
23
|
+
name: 'li';
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.
|
|
27
|
+
*
|
|
28
|
+
* Also, fixes non HTML compliant lists indents:
|
|
29
|
+
*
|
|
30
|
+
* ```
|
|
31
|
+
* before: fixed list:
|
|
32
|
+
* OL OL
|
|
33
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
34
|
+
* |-> OL |-> OL
|
|
35
|
+
* |-> OL |
|
|
36
|
+
* | |-> OL |
|
|
37
|
+
* | |-> OL |
|
|
38
|
+
* | |-> LI (parent LIs: 1) |-> LI (indent: 1)
|
|
39
|
+
* |-> LI (parent LIs: 1) |-> LI (indent: 1)
|
|
40
|
+
*
|
|
41
|
+
* before: fixed list:
|
|
42
|
+
* OL OL
|
|
43
|
+
* |-> OL |
|
|
44
|
+
* |-> OL |
|
|
45
|
+
* |-> OL |
|
|
46
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
47
|
+
*
|
|
48
|
+
* before: fixed list:
|
|
49
|
+
* OL OL
|
|
50
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
51
|
+
* |-> OL |-> OL
|
|
52
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 1)
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export declare function getIndent(listItem: ViewElement): number;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a list attribute element (ol or ul).
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export declare function createListElement(writer: DowncastWriter, indent: number, type: 'bulleted' | 'numbered' | 'todo', id?: string): ViewAttributeElement;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a list item attribute element (li).
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
export declare function createListItemElement(writer: DowncastWriter, indent: number, id: string): ViewAttributeElement;
|
|
70
|
+
/**
|
|
71
|
+
* Returns a view element name for the given list type.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export declare function getViewElementNameForListType(type?: 'bulleted' | 'numbered' | 'todo'): 'ol' | 'ul';
|
|
76
|
+
/**
|
|
77
|
+
* Returns a view element ID for the given list type and indent.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare function getViewElementIdForListType(type?: 'bulleted' | 'numbered' | 'todo', indent?: number): string;
|