@ckeditor/ckeditor5-list 48.1.0 → 48.2.0-alpha.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/ckeditor5-metadata.json +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +351 -48
- package/dist/index.js.map +1 -1
- package/dist/list/converters.d.ts +19 -1
- package/dist/list/utils/model.d.ts +33 -3
- package/dist/listconfig.d.ts +20 -2
- package/package.json +10 -10
|
@@ -9,6 +9,23 @@ import { type DowncastAttributeEvent, type ViewDowncastWriter, type EditingContr
|
|
|
9
9
|
import type { GetCallback } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import { type ListElement } from './utils/model.js';
|
|
11
11
|
import type { ListEditing, ListDowncastStrategy } from './listediting.js';
|
|
12
|
+
/**
|
|
13
|
+
* Returns a consuming upcast converter for skip-level list item wrappers. It detects intermediate `<li>` elements
|
|
14
|
+
* with `list-style-type:none` (generated by the skip-level downcast or by external sources) and consumes them
|
|
15
|
+
* without producing a model element, so they don't end up as empty list items in the model.
|
|
16
|
+
*
|
|
17
|
+
* The wrapper `<li>` is consumed, but its children (nested lists) are converted normally. Because `getIndent()`
|
|
18
|
+
* counts all ancestor `<li>` elements (including the consumed wrapper), nested items receive the correct indent
|
|
19
|
+
* values that reflect the skip-level gap.
|
|
20
|
+
*
|
|
21
|
+
* Only `<li>` elements whose sole meaningful content is a nested `<ul>`/`<ol>` are treated as intermediate wrappers.
|
|
22
|
+
* Anything else (text, paragraphs, custom elements, even an empty `<li>` with `list-style-type:none` carrying only
|
|
23
|
+
* attributes) falls through to the regular list item upcast, so its data and attributes can be preserved by GHS
|
|
24
|
+
* or other plugins.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function listItemSkipLevelConsumer(): GetCallback<UpcastElementEvent>;
|
|
12
29
|
/**
|
|
13
30
|
* Returns the upcast converter for list items. It's supposed to work after the block converters (content inside list items) are converted.
|
|
14
31
|
*
|
|
@@ -33,8 +50,9 @@ export declare function reconvertItemsOnDataChange(model: Model, editing: Editin
|
|
|
33
50
|
* @param strategies The strategies.
|
|
34
51
|
* @param model The model.
|
|
35
52
|
*/
|
|
36
|
-
export declare function listItemDowncastConverter(attributeNames: Array<string>, strategies: Array<ListDowncastStrategy>, model: Model, { dataPipeline }
|
|
53
|
+
export declare function listItemDowncastConverter(attributeNames: Array<string>, strategies: Array<ListDowncastStrategy>, model: Model, { dataPipeline, enableSkipLevelLists }: {
|
|
37
54
|
dataPipeline?: boolean;
|
|
55
|
+
enableSkipLevelLists?: boolean;
|
|
38
56
|
}): GetCallback<DowncastAttributeEvent<ListElement>>;
|
|
39
57
|
/**
|
|
40
58
|
* The 'remove' downcast converter for custom markers.
|
|
@@ -219,9 +219,39 @@ export declare function canBecomeSimpleListItem(block: ModelElement, schema: Mod
|
|
|
219
219
|
*/
|
|
220
220
|
export declare function isNumberedListType(listType: ListType): boolean;
|
|
221
221
|
/**
|
|
222
|
-
* Checks if the given list item is the first item in the
|
|
222
|
+
* Checks if the given list item block is the first block of the first item in its list at the given indent.
|
|
223
223
|
*
|
|
224
|
-
*
|
|
225
|
-
* at
|
|
224
|
+
* Walks back over previous siblings and returns:
|
|
225
|
+
* - `true` if it reaches a non-list block or a list block at a lower indent (a new list begins here),
|
|
226
|
+
* - `false` if it finds a same-indent block of the same `listItemId` (a continuation of the current item) or of the same
|
|
227
|
+
* `listType` (the visible list already has earlier items),
|
|
228
|
+
* - `true` if it finds a same-indent block of a different `listType` and a different `listItemId` (a different list ends; ours
|
|
229
|
+
* starts here),
|
|
230
|
+
* - `false` if the loop ends (it reaches the first non-list-item block, or no more previous siblings) while passing only
|
|
231
|
+
* higher-indent blocks (those blocks live inside an intermediate skip-level `<li style="list-style-type:none">` wrapper
|
|
232
|
+
* at our indent).
|
|
233
|
+
*
|
|
234
|
+
* For example, in the model:
|
|
235
|
+
*
|
|
236
|
+
* ```
|
|
237
|
+
* ' # aaa'
|
|
238
|
+
* '# bbb'
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* `bbb` is preceded by a higher-indent block `aaa`, which in the view is rendered inside an intermediate
|
|
242
|
+
* skip-level wrapper at indent 0:
|
|
243
|
+
*
|
|
244
|
+
* ```html
|
|
245
|
+
* <ol>
|
|
246
|
+
* <li style="list-style-type:none">
|
|
247
|
+
* <ol>
|
|
248
|
+
* <li>aaa</li>
|
|
249
|
+
* </ol>
|
|
250
|
+
* </li>
|
|
251
|
+
* <li>bbb</li>
|
|
252
|
+
* </ol>
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* So `bbb` is the second visible item in the outer list and the function returns `false`.
|
|
226
256
|
*/
|
|
227
257
|
export declare function isFirstListItemInList(listItem: ModelElement): boolean;
|
package/dist/listconfig.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { type ArrayOrItem } from '@ckeditor/ckeditor5-utils';
|
|
|
12
12
|
*
|
|
13
13
|
* ```ts
|
|
14
14
|
* ClassicEditor
|
|
15
|
-
* .create(
|
|
15
|
+
* .create( {
|
|
16
16
|
* list: ... // The list feature configuration.
|
|
17
17
|
* } )
|
|
18
18
|
* .then( ... )
|
|
@@ -54,6 +54,24 @@ export interface ListConfig {
|
|
|
54
54
|
* @default true
|
|
55
55
|
*/
|
|
56
56
|
enableListItemMarkerFormatting?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* When set to `true`, list items can be indented by more than one level relative to their parent.
|
|
59
|
+
* By default, the editor enforces that each nested list item is only one level deeper than its parent.
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* ClassicEditor
|
|
63
|
+
* .create( editorElement, {
|
|
64
|
+
* list: {
|
|
65
|
+
* enableSkipLevelLists: true
|
|
66
|
+
* }
|
|
67
|
+
* } )
|
|
68
|
+
* .then( ... )
|
|
69
|
+
* .catch( ... );
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
enableSkipLevelLists?: boolean;
|
|
57
75
|
}
|
|
58
76
|
/**
|
|
59
77
|
* The configuration of the {@link module:list/listproperties~ListProperties list properties} feature and the
|
|
@@ -70,7 +88,7 @@ export interface ListConfig {
|
|
|
70
88
|
*
|
|
71
89
|
* ```ts
|
|
72
90
|
* ClassicEditor
|
|
73
|
-
* .create(
|
|
91
|
+
* .create( {
|
|
74
92
|
* list: {
|
|
75
93
|
* properties: {
|
|
76
94
|
* styles: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-list",
|
|
3
|
-
"version": "48.
|
|
3
|
+
"version": "48.2.0-alpha.0",
|
|
4
4
|
"description": "Ordered and unordered lists feature to CKEditor 5.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ckeditor/ckeditor5-clipboard": "48.
|
|
30
|
-
"@ckeditor/ckeditor5-core": "48.
|
|
31
|
-
"@ckeditor/ckeditor5-engine": "48.
|
|
32
|
-
"@ckeditor/ckeditor5-enter": "48.
|
|
33
|
-
"@ckeditor/ckeditor5-font": "48.
|
|
34
|
-
"@ckeditor/ckeditor5-icons": "48.
|
|
35
|
-
"@ckeditor/ckeditor5-typing": "48.
|
|
36
|
-
"@ckeditor/ckeditor5-ui": "48.
|
|
37
|
-
"@ckeditor/ckeditor5-utils": "48.
|
|
29
|
+
"@ckeditor/ckeditor5-clipboard": "48.2.0-alpha.0",
|
|
30
|
+
"@ckeditor/ckeditor5-core": "48.2.0-alpha.0",
|
|
31
|
+
"@ckeditor/ckeditor5-engine": "48.2.0-alpha.0",
|
|
32
|
+
"@ckeditor/ckeditor5-enter": "48.2.0-alpha.0",
|
|
33
|
+
"@ckeditor/ckeditor5-font": "48.2.0-alpha.0",
|
|
34
|
+
"@ckeditor/ckeditor5-icons": "48.2.0-alpha.0",
|
|
35
|
+
"@ckeditor/ckeditor5-typing": "48.2.0-alpha.0",
|
|
36
|
+
"@ckeditor/ckeditor5-ui": "48.2.0-alpha.0",
|
|
37
|
+
"@ckeditor/ckeditor5-utils": "48.2.0-alpha.0",
|
|
38
38
|
"es-toolkit": "1.45.1"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|