@ckeditor/ckeditor5-list 45.2.1 → 46.0.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/build/list.js +1 -1
- package/dist/index-content.css +50 -8
- package/dist/index-editor.css +14 -8
- package/dist/index.css +62 -15
- package/dist/index.css.map +1 -1
- package/dist/index.js +736 -135
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
- package/src/augmentation.d.ts +8 -5
- package/src/index.d.ts +61 -37
- package/src/index.js +53 -25
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +28 -0
- package/src/legacylist/legacyconverters.d.ts +23 -7
- package/src/legacylist/legacyconverters.js +18 -2
- package/src/legacylist/legacyindentcommand.d.ts +1 -1
- package/src/legacylist/legacyindentcommand.js +1 -1
- package/src/legacylist/legacylistcommand.d.ts +1 -1
- package/src/legacylist/legacylistcommand.js +1 -1
- package/src/legacylist/legacylistediting.d.ts +2 -2
- package/src/legacylist/legacylistediting.js +4 -4
- package/src/legacylist/legacylistutils.d.ts +4 -4
- package/src/legacylist/legacylistutils.js +1 -1
- package/src/legacylist/legacyutils.d.ts +21 -10
- package/src/legacylist/legacyutils.js +14 -4
- package/src/legacylist.d.ts +3 -3
- package/src/legacylist.js +3 -3
- package/src/legacylistproperties/legacylistpropertiesediting.d.ts +2 -2
- package/src/legacylistproperties/legacylistpropertiesediting.js +5 -5
- package/src/legacylistproperties/legacylistreversedcommand.d.ts +1 -1
- package/src/legacylistproperties/legacylistreversedcommand.js +1 -1
- package/src/legacylistproperties/legacyliststartcommand.d.ts +1 -1
- package/src/legacylistproperties/legacyliststartcommand.js +1 -1
- package/src/legacylistproperties/legacyliststylecommand.d.ts +1 -1
- package/src/legacylistproperties/legacyliststylecommand.js +1 -1
- package/src/legacylistproperties.d.ts +3 -3
- package/src/legacylistproperties.js +3 -3
- package/src/legacytodolist/legacychecktodolistcommand.d.ts +6 -6
- package/src/legacytodolist/legacychecktodolistcommand.js +3 -3
- package/src/legacytodolist/legacytodolistconverters.d.ts +15 -8
- package/src/legacytodolist/legacytodolistconverters.js +10 -3
- package/src/legacytodolist/legacytodolistediting.d.ts +2 -2
- package/src/legacytodolist/legacytodolistediting.js +4 -4
- package/src/legacytodolist.d.ts +3 -3
- package/src/legacytodolist.js +3 -3
- package/src/list/adjacentlistssupport.d.ts +1 -1
- package/src/list/adjacentlistssupport.js +1 -1
- package/src/list/converters.d.ts +9 -5
- package/src/list/converters.js +12 -7
- package/src/list/listcommand.d.ts +3 -3
- package/src/list/listcommand.js +1 -1
- package/src/list/listediting.d.ts +21 -17
- package/src/list/listediting.js +28 -11
- package/src/list/listindentcommand.d.ts +3 -3
- package/src/list/listindentcommand.js +2 -2
- package/src/list/listmergecommand.d.ts +3 -3
- package/src/list/listmergecommand.js +2 -2
- package/src/list/listsplitcommand.d.ts +3 -3
- package/src/list/listsplitcommand.js +1 -1
- package/src/list/listui.d.ts +1 -1
- package/src/list/listui.js +1 -1
- package/src/list/listutils.d.ts +7 -7
- package/src/list/listutils.js +1 -1
- package/src/list/utils/listwalker.d.ts +12 -6
- package/src/list/utils/listwalker.js +5 -1
- package/src/list/utils/model.d.ts +25 -22
- package/src/list/utils/model.js +7 -2
- package/src/list/utils/postfixers.d.ts +4 -4
- package/src/list/utils/view.d.ts +3 -3
- package/src/list.d.ts +3 -3
- package/src/list.js +3 -3
- package/src/listconfig.d.ts +13 -0
- package/src/listformatting/listitemboldintegration.d.ts +34 -0
- package/src/listformatting/listitemboldintegration.js +83 -0
- package/src/listformatting/listitemfontcolorintegration.d.ts +34 -0
- package/src/listformatting/listitemfontcolorintegration.js +92 -0
- package/src/listformatting/listitemfontfamilyintegration.d.ts +34 -0
- package/src/listformatting/listitemfontfamilyintegration.js +93 -0
- package/src/listformatting/listitemfontsizeintegration.d.ts +34 -0
- package/src/listformatting/listitemfontsizeintegration.js +119 -0
- package/src/listformatting/listitemitalicintegration.d.ts +34 -0
- package/src/listformatting/listitemitalicintegration.js +83 -0
- package/src/listformatting.d.ts +71 -0
- package/src/listformatting.js +243 -0
- package/src/listproperties/listpropertiesediting.d.ts +7 -7
- package/src/listproperties/listpropertiesediting.js +6 -6
- package/src/listproperties/listpropertiesui.d.ts +1 -1
- package/src/listproperties/listpropertiesui.js +2 -2
- package/src/listproperties/listpropertiesutils.d.ts +1 -1
- package/src/listproperties/listpropertiesutils.js +1 -1
- package/src/listproperties/listreversedcommand.d.ts +1 -1
- package/src/listproperties/listreversedcommand.js +1 -1
- package/src/listproperties/liststartcommand.d.ts +1 -1
- package/src/listproperties/liststartcommand.js +1 -1
- package/src/listproperties/liststylecommand.d.ts +1 -1
- package/src/listproperties/liststylecommand.js +1 -1
- package/src/listproperties/ui/listpropertiesview.d.ts +6 -1
- package/src/listproperties/ui/listpropertiesview.js +1 -1
- package/src/listproperties/utils/config.d.ts +3 -0
- package/src/listproperties/utils/config.js +1 -0
- package/src/listproperties/utils/style.d.ts +9 -0
- package/src/listproperties/utils/style.js +9 -0
- package/src/listproperties.d.ts +3 -3
- package/src/listproperties.js +3 -3
- package/src/todolist/checktodolistcommand.d.ts +3 -3
- package/src/todolist/checktodolistcommand.js +2 -2
- package/src/todolist/todocheckboxchangeobserver.d.ts +8 -6
- package/src/todolist/todocheckboxchangeobserver.js +4 -2
- package/src/todolist/todolistediting.d.ts +2 -2
- package/src/todolist/todolistediting.js +5 -5
- package/src/todolist/todolistui.d.ts +1 -1
- package/src/todolist/todolistui.js +1 -1
- package/src/todolist.d.ts +3 -3
- package/src/todolist.js +3 -3
- package/theme/listformatting.css +48 -0
- package/theme/todolist.css +8 -8
- package/src/documentlist.d.ts +0 -32
- package/src/documentlist.js +0 -47
- package/src/documentlistproperties.d.ts +0 -32
- package/src/documentlistproperties.js +0 -47
- package/src/tododocumentlist.d.ts +0 -32
- package/src/tododocumentlist.js +0 -47
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module list/list/listsplitcommand
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ModelElement } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
10
10
|
/**
|
|
11
11
|
* The document list split command that splits the list item at the selection.
|
|
12
12
|
*
|
|
13
13
|
* It is used by the {@link module:list/list~List list feature}.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class ListSplitCommand extends Command {
|
|
16
16
|
/**
|
|
17
17
|
* Whether list item should be split before or after the selected block.
|
|
18
18
|
*/
|
|
@@ -63,5 +63,5 @@ export default class ListSplitCommand extends Command {
|
|
|
63
63
|
*/
|
|
64
64
|
export type ListSplitCommandAfterExecuteEvent = {
|
|
65
65
|
name: 'afterExecute';
|
|
66
|
-
args: [changedBlocks: Array<
|
|
66
|
+
args: [changedBlocks: Array<ModelElement>];
|
|
67
67
|
};
|
|
@@ -9,7 +9,7 @@ import { isFirstBlockOfListItem, isListItemBlock, sortBlocks, splitListItemBefor
|
|
|
9
9
|
*
|
|
10
10
|
* It is used by the {@link module:list/list~List list feature}.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export class ListSplitCommand extends Command {
|
|
13
13
|
/**
|
|
14
14
|
* Whether list item should be split before or after the selected block.
|
|
15
15
|
*/
|
package/src/list/listui.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
|
|
|
7
7
|
* The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
|
|
8
8
|
* allow to convert paragraphs to and from list items and indent or outdent them.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare class ListUI extends Plugin {
|
|
11
11
|
/**
|
|
12
12
|
* @inheritDoc
|
|
13
13
|
*/
|
package/src/list/listui.js
CHANGED
|
@@ -12,7 +12,7 @@ import { IconBulletedList, IconNumberedList } from 'ckeditor5/src/icons.js';
|
|
|
12
12
|
* The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
|
|
13
13
|
* allow to convert paragraphs to and from list items and indent or outdent them.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export class ListUI extends Plugin {
|
|
16
16
|
/**
|
|
17
17
|
* @inheritDoc
|
|
18
18
|
*/
|
package/src/list/listutils.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module list/list/listutils
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ModelElement, ModelNode } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
11
11
|
import { type ListElement } from './utils/model.js';
|
|
@@ -13,7 +13,7 @@ import type { ListType } from './listediting.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* A set of helpers related to document lists.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export declare class ListUtils extends Plugin {
|
|
17
17
|
/**
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
@@ -27,28 +27,28 @@ export default class ListUtils extends Plugin {
|
|
|
27
27
|
*
|
|
28
28
|
* @param blocks The list of selected blocks.
|
|
29
29
|
*/
|
|
30
|
-
expandListBlocksToCompleteList(blocks: ArrayOrItem<
|
|
30
|
+
expandListBlocksToCompleteList(blocks: ArrayOrItem<ModelElement>): Array<ModelElement>;
|
|
31
31
|
/**
|
|
32
32
|
* Check if the given block is the first in the list item.
|
|
33
33
|
*
|
|
34
34
|
* @param listBlock The list block element.
|
|
35
35
|
*/
|
|
36
|
-
isFirstBlockOfListItem(listBlock:
|
|
36
|
+
isFirstBlockOfListItem(listBlock: ModelElement): boolean;
|
|
37
37
|
/**
|
|
38
38
|
* Returns true if the given model node is a list item block.
|
|
39
39
|
*
|
|
40
40
|
* @param node A model node.
|
|
41
41
|
*/
|
|
42
|
-
isListItemBlock(node:
|
|
42
|
+
isListItemBlock(node: ModelNode | null): node is ListElement;
|
|
43
43
|
/**
|
|
44
44
|
* Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
|
|
45
45
|
*
|
|
46
46
|
* @param blocks The list of selected blocks.
|
|
47
47
|
* @param options.withNested Whether should include nested list items.
|
|
48
48
|
*/
|
|
49
|
-
expandListBlocksToCompleteItems(blocks: ArrayOrItem<
|
|
49
|
+
expandListBlocksToCompleteItems(blocks: ArrayOrItem<ModelElement>, options?: {
|
|
50
50
|
withNested?: boolean;
|
|
51
|
-
}): Array<
|
|
51
|
+
}): Array<ModelElement>;
|
|
52
52
|
/**
|
|
53
53
|
* Returns true if listType is of type `numbered` or `customNumbered`.
|
|
54
54
|
*/
|
package/src/list/listutils.js
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
9
9
|
import { type ListElement } from './model.js';
|
|
10
|
-
import type {
|
|
10
|
+
import type { ModelElement, ModelNode } from 'ckeditor5/src/engine.js';
|
|
11
11
|
/**
|
|
12
12
|
* Document list blocks iterator.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
13
15
|
*/
|
|
14
|
-
export
|
|
16
|
+
export declare class ListWalker {
|
|
15
17
|
/**
|
|
16
18
|
* The start list item block element.
|
|
17
19
|
*/
|
|
@@ -58,7 +60,7 @@ export default class ListWalker {
|
|
|
58
60
|
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
|
|
59
61
|
* in the result.
|
|
60
62
|
*/
|
|
61
|
-
constructor(startElement:
|
|
63
|
+
constructor(startElement: ModelNode, options: ListWalkerOptions);
|
|
62
64
|
/**
|
|
63
65
|
* Performs only first step of iteration and returns the result.
|
|
64
66
|
*
|
|
@@ -73,7 +75,7 @@ export default class ListWalker {
|
|
|
73
75
|
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
|
|
74
76
|
* in the result.
|
|
75
77
|
*/
|
|
76
|
-
static first(startElement:
|
|
78
|
+
static first(startElement: ModelNode, options: ListWalkerOptions): ListElement | null;
|
|
77
79
|
/**
|
|
78
80
|
* Iterable interface.
|
|
79
81
|
*/
|
|
@@ -85,6 +87,8 @@ export default class ListWalker {
|
|
|
85
87
|
}
|
|
86
88
|
/**
|
|
87
89
|
* Iterates sibling list blocks starting from the given node.
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
88
92
|
*/
|
|
89
93
|
export declare class SiblingListBlocksIterator implements IterableIterator<ListIteratorValue> {
|
|
90
94
|
private _node;
|
|
@@ -96,7 +100,7 @@ export declare class SiblingListBlocksIterator implements IterableIterator<ListI
|
|
|
96
100
|
* @param node The model node.
|
|
97
101
|
* @param direction Iteration direction.
|
|
98
102
|
*/
|
|
99
|
-
constructor(node:
|
|
103
|
+
constructor(node: ModelNode | null, direction?: 'forward' | 'backward');
|
|
100
104
|
[Symbol.iterator](): IterableIterator<ListIteratorValue>;
|
|
101
105
|
next(): IteratorResult<ListIteratorValue>;
|
|
102
106
|
}
|
|
@@ -110,7 +114,7 @@ export declare class ListBlocksIterable {
|
|
|
110
114
|
/**
|
|
111
115
|
* @param listHead The head element of a list.
|
|
112
116
|
*/
|
|
113
|
-
constructor(listHead:
|
|
117
|
+
constructor(listHead: ModelElement);
|
|
114
118
|
/**
|
|
115
119
|
* List blocks iterator.
|
|
116
120
|
*
|
|
@@ -139,6 +143,8 @@ export interface ListIteratorValue {
|
|
|
139
143
|
}
|
|
140
144
|
/**
|
|
141
145
|
* Document list blocks iterator options.
|
|
146
|
+
*
|
|
147
|
+
* @internal
|
|
142
148
|
*/
|
|
143
149
|
export type ListWalkerOptions = {
|
|
144
150
|
direction?: 'forward' | 'backward';
|
|
@@ -9,8 +9,10 @@ import { first, toArray } from 'ckeditor5/src/utils.js';
|
|
|
9
9
|
import { isListItemBlock } from './model.js';
|
|
10
10
|
/**
|
|
11
11
|
* Document list blocks iterator.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
12
14
|
*/
|
|
13
|
-
export
|
|
15
|
+
export class ListWalker {
|
|
14
16
|
/**
|
|
15
17
|
* The start list item block element.
|
|
16
18
|
*/
|
|
@@ -156,6 +158,8 @@ export default class ListWalker {
|
|
|
156
158
|
}
|
|
157
159
|
/**
|
|
158
160
|
* Iterates sibling list blocks starting from the given node.
|
|
161
|
+
*
|
|
162
|
+
* @internal
|
|
159
163
|
*/
|
|
160
164
|
export class SiblingListBlocksIterator {
|
|
161
165
|
_node;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module list/list/utils/model
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ModelDocumentFragment, ModelElement, Model, ModelNode, ModelWriter, ModelItem, ModelSchema } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
10
10
|
import { type ListWalkerOptions } from './listwalker.js';
|
|
11
11
|
import { type ListType } from '../listediting.js';
|
|
@@ -23,11 +23,11 @@ export declare class ListItemUid {
|
|
|
23
23
|
static next(): string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* An {@link module:engine/model/element~
|
|
26
|
+
* An {@link module:engine/model/element~ModelElement} that is known to be a list element.
|
|
27
27
|
*
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
|
-
export interface ListElement extends
|
|
30
|
+
export interface ListElement extends ModelElement {
|
|
31
31
|
getAttribute(key: 'listItemId'): string;
|
|
32
32
|
getAttribute(key: 'listIndent'): number;
|
|
33
33
|
getAttribute(key: 'listType'): ListType;
|
|
@@ -38,7 +38,7 @@ export interface ListElement extends Element {
|
|
|
38
38
|
*
|
|
39
39
|
* @internal
|
|
40
40
|
*/
|
|
41
|
-
export declare function isListItemBlock(node:
|
|
41
|
+
export declare function isListItemBlock(node: ModelItem | ModelDocumentFragment | null): node is ListElement;
|
|
42
42
|
/**
|
|
43
43
|
* Returns an array with all elements that represents the same list item.
|
|
44
44
|
*
|
|
@@ -49,7 +49,7 @@ export declare function isListItemBlock(node: Item | DocumentFragment | null): n
|
|
|
49
49
|
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
|
|
50
50
|
* in the result.
|
|
51
51
|
*/
|
|
52
|
-
export declare function getAllListItemBlocks(listItem:
|
|
52
|
+
export declare function getAllListItemBlocks(listItem: ModelNode, options?: {
|
|
53
53
|
higherIndent?: boolean;
|
|
54
54
|
}): Array<ListElement>;
|
|
55
55
|
/**
|
|
@@ -64,7 +64,7 @@ export declare function getAllListItemBlocks(listItem: Node, options?: {
|
|
|
64
64
|
* @param options.direction Walking direction.
|
|
65
65
|
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included in the result.
|
|
66
66
|
*/
|
|
67
|
-
export declare function getListItemBlocks(listItem:
|
|
67
|
+
export declare function getListItemBlocks(listItem: ModelNode, options?: {
|
|
68
68
|
direction?: 'forward' | 'backward';
|
|
69
69
|
higherIndent?: boolean;
|
|
70
70
|
}): Array<ListElement>;
|
|
@@ -73,7 +73,7 @@ export declare function getListItemBlocks(listItem: Node, options?: {
|
|
|
73
73
|
*
|
|
74
74
|
* @internal
|
|
75
75
|
*/
|
|
76
|
-
export declare function getNestedListBlocks(listItem:
|
|
76
|
+
export declare function getNestedListBlocks(listItem: ModelElement): Array<ListElement>;
|
|
77
77
|
/**
|
|
78
78
|
* Returns array of all blocks/items of the same list as given block (same indent, same type and properties).
|
|
79
79
|
*
|
|
@@ -81,20 +81,20 @@ export declare function getNestedListBlocks(listItem: Element): Array<ListElemen
|
|
|
81
81
|
* @param listItem Starting list item element.
|
|
82
82
|
* @param options Additional list walker options to modify the range of returned list items.
|
|
83
83
|
*/
|
|
84
|
-
export declare function getListItems(listItem:
|
|
84
|
+
export declare function getListItems(listItem: ModelElement, options?: ListWalkerOptions): Array<ListElement>;
|
|
85
85
|
/**
|
|
86
86
|
* Check if the given block is the first in the list item.
|
|
87
87
|
*
|
|
88
88
|
* @internal
|
|
89
89
|
* @param listBlock The list block element.
|
|
90
90
|
*/
|
|
91
|
-
export declare function isFirstBlockOfListItem(listBlock:
|
|
91
|
+
export declare function isFirstBlockOfListItem(listBlock: ModelNode): boolean;
|
|
92
92
|
/**
|
|
93
93
|
* Check if the given block is the last in the list item.
|
|
94
94
|
*
|
|
95
95
|
* @internal
|
|
96
96
|
*/
|
|
97
|
-
export declare function isLastBlockOfListItem(listBlock:
|
|
97
|
+
export declare function isLastBlockOfListItem(listBlock: ModelElement): boolean;
|
|
98
98
|
/**
|
|
99
99
|
* Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
|
|
100
100
|
*
|
|
@@ -102,7 +102,7 @@ export declare function isLastBlockOfListItem(listBlock: Element): boolean;
|
|
|
102
102
|
* @param blocks The list of selected blocks.
|
|
103
103
|
* @param options.withNested Whether should include nested list items.
|
|
104
104
|
*/
|
|
105
|
-
export declare function expandListBlocksToCompleteItems(blocks: ArrayOrItem<
|
|
105
|
+
export declare function expandListBlocksToCompleteItems(blocks: ArrayOrItem<ModelElement>, options?: {
|
|
106
106
|
withNested?: boolean;
|
|
107
107
|
}): Array<ListElement>;
|
|
108
108
|
/**
|
|
@@ -111,7 +111,7 @@ export declare function expandListBlocksToCompleteItems(blocks: ArrayOrItem<Elem
|
|
|
111
111
|
* @internal
|
|
112
112
|
* @param blocks The list of selected blocks.
|
|
113
113
|
*/
|
|
114
|
-
export declare function expandListBlocksToCompleteList(blocks: ArrayOrItem<
|
|
114
|
+
export declare function expandListBlocksToCompleteList(blocks: ArrayOrItem<ModelElement>): Array<ListElement>;
|
|
115
115
|
/**
|
|
116
116
|
* Splits the list item just before the provided list block.
|
|
117
117
|
*
|
|
@@ -120,7 +120,7 @@ export declare function expandListBlocksToCompleteList(blocks: ArrayOrItem<Eleme
|
|
|
120
120
|
* @param writer The model writer.
|
|
121
121
|
* @returns The array of updated blocks.
|
|
122
122
|
*/
|
|
123
|
-
export declare function splitListItemBefore(listBlock:
|
|
123
|
+
export declare function splitListItemBefore(listBlock: ModelElement, writer: ModelWriter): Array<ListElement>;
|
|
124
124
|
/**
|
|
125
125
|
* Merges the list item with the parent list item.
|
|
126
126
|
*
|
|
@@ -130,7 +130,7 @@ export declare function splitListItemBefore(listBlock: Element, writer: Writer):
|
|
|
130
130
|
* @param writer The model writer.
|
|
131
131
|
* @returns The array of updated blocks.
|
|
132
132
|
*/
|
|
133
|
-
export declare function mergeListItemBefore(listBlock:
|
|
133
|
+
export declare function mergeListItemBefore(listBlock: ModelNode, parentBlock: ModelElement, writer: ModelWriter): Array<ListElement>;
|
|
134
134
|
/**
|
|
135
135
|
* Increases indentation of given list blocks.
|
|
136
136
|
*
|
|
@@ -141,7 +141,7 @@ export declare function mergeListItemBefore(listBlock: Node, parentBlock: Elemen
|
|
|
141
141
|
* @param options.expand Whether should expand the list of blocks to include complete list items.
|
|
142
142
|
* @param options.indentBy The number of levels the indentation should change (could be negative).
|
|
143
143
|
*/
|
|
144
|
-
export declare function indentBlocks(blocks: ArrayOrItem<ListElement>, writer:
|
|
144
|
+
export declare function indentBlocks(blocks: ArrayOrItem<ListElement>, writer: ModelWriter, { expand, indentBy }?: {
|
|
145
145
|
expand?: boolean;
|
|
146
146
|
indentBy?: number;
|
|
147
147
|
}): Array<ListElement>;
|
|
@@ -153,7 +153,7 @@ export declare function indentBlocks(blocks: ArrayOrItem<ListElement>, writer: W
|
|
|
153
153
|
* @param blocks The block or iterable of blocks.
|
|
154
154
|
* @param writer The model writer.
|
|
155
155
|
*/
|
|
156
|
-
export declare function outdentBlocksWithMerge(blocks: ArrayOrItem<ListElement>, writer:
|
|
156
|
+
export declare function outdentBlocksWithMerge(blocks: ArrayOrItem<ListElement>, writer: ModelWriter): Array<ListElement>;
|
|
157
157
|
/**
|
|
158
158
|
* Removes all list attributes from the given blocks.
|
|
159
159
|
*
|
|
@@ -162,14 +162,14 @@ export declare function outdentBlocksWithMerge(blocks: ArrayOrItem<ListElement>,
|
|
|
162
162
|
* @param writer The model writer.
|
|
163
163
|
* @returns Array of altered blocks.
|
|
164
164
|
*/
|
|
165
|
-
export declare function removeListAttributes(blocks: ArrayOrItem<
|
|
165
|
+
export declare function removeListAttributes(blocks: ArrayOrItem<ModelElement>, writer: ModelWriter): Array<ModelElement>;
|
|
166
166
|
/**
|
|
167
167
|
* Checks whether the given blocks are related to a single list item.
|
|
168
168
|
*
|
|
169
169
|
* @internal
|
|
170
170
|
* @param blocks The list block elements.
|
|
171
171
|
*/
|
|
172
|
-
export declare function isSingleListItem(blocks: Array<
|
|
172
|
+
export declare function isSingleListItem(blocks: Array<ModelNode>): boolean;
|
|
173
173
|
/**
|
|
174
174
|
* Modifies the indents of list blocks following the given list block so the indentation is valid after
|
|
175
175
|
* the given block is no longer a list item.
|
|
@@ -179,13 +179,13 @@ export declare function isSingleListItem(blocks: Array<Node>): boolean;
|
|
|
179
179
|
* @param writer The model writer.
|
|
180
180
|
* @returns Array of altered blocks.
|
|
181
181
|
*/
|
|
182
|
-
export declare function outdentFollowingItems(lastBlock:
|
|
182
|
+
export declare function outdentFollowingItems(lastBlock: ModelElement, writer: ModelWriter): Array<ListElement>;
|
|
183
183
|
/**
|
|
184
184
|
* Returns the array of given blocks sorted by model indexes (document order).
|
|
185
185
|
*
|
|
186
186
|
* @internal
|
|
187
187
|
*/
|
|
188
|
-
export declare function sortBlocks<T extends
|
|
188
|
+
export declare function sortBlocks<T extends ModelElement>(blocks: Iterable<T>): Array<T>;
|
|
189
189
|
/**
|
|
190
190
|
* Returns a selected block object. If a selected object is inline or when there is no selected
|
|
191
191
|
* object, `null` is returned.
|
|
@@ -194,7 +194,7 @@ export declare function sortBlocks<T extends Element>(blocks: Iterable<T>): Arra
|
|
|
194
194
|
* @param model The instance of editor model.
|
|
195
195
|
* @returns Selected block object or `null`.
|
|
196
196
|
*/
|
|
197
|
-
export declare function getSelectedBlockObject(model: Model):
|
|
197
|
+
export declare function getSelectedBlockObject(model: Model): ModelElement | null;
|
|
198
198
|
/**
|
|
199
199
|
* Checks whether the given block can be replaced by a listItem.
|
|
200
200
|
*
|
|
@@ -202,9 +202,12 @@ export declare function getSelectedBlockObject(model: Model): Element | null;
|
|
|
202
202
|
*
|
|
203
203
|
* @param block A block to be tested.
|
|
204
204
|
* @param schema The schema of the document.
|
|
205
|
+
* @internal
|
|
205
206
|
*/
|
|
206
|
-
export declare function canBecomeSimpleListItem(block:
|
|
207
|
+
export declare function canBecomeSimpleListItem(block: ModelElement, schema: ModelSchema): boolean;
|
|
207
208
|
/**
|
|
208
209
|
* Returns true if listType is of type `numbered` or `customNumbered`.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
209
212
|
*/
|
|
210
213
|
export declare function isNumberedListType(listType: ListType): boolean;
|
package/src/list/utils/model.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { uid, toArray } from 'ckeditor5/src/utils.js';
|
|
6
|
-
import ListWalker,
|
|
6
|
+
import { ListWalker, SiblingListBlocksIterator } from './listwalker.js';
|
|
7
7
|
/**
|
|
8
8
|
* The list item ID generator.
|
|
9
9
|
*
|
|
@@ -434,12 +434,17 @@ export function getSelectedBlockObject(model) {
|
|
|
434
434
|
*
|
|
435
435
|
* @param block A block to be tested.
|
|
436
436
|
* @param schema The schema of the document.
|
|
437
|
+
* @internal
|
|
437
438
|
*/
|
|
438
439
|
export function canBecomeSimpleListItem(block, schema) {
|
|
439
|
-
return schema.checkChild(block.parent, 'listItem') &&
|
|
440
|
+
return schema.checkChild(block.parent, 'listItem') &&
|
|
441
|
+
schema.checkChild(block, '$text') &&
|
|
442
|
+
!schema.isObject(block);
|
|
440
443
|
}
|
|
441
444
|
/**
|
|
442
445
|
* Returns true if listType is of type `numbered` or `customNumbered`.
|
|
446
|
+
*
|
|
447
|
+
* @internal
|
|
443
448
|
*/
|
|
444
449
|
export function isNumberedListType(listType) {
|
|
445
450
|
return listType == 'numbered' || listType == 'customNumbered';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module list/list/utils/postfixers
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ModelElement, ModelPosition, ModelWriter } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import { type ListIteratorValue } from './listwalker.js';
|
|
10
10
|
import { type ListElement } from './model.js';
|
|
11
11
|
/**
|
|
@@ -16,7 +16,7 @@ import { type ListElement } from './model.js';
|
|
|
16
16
|
* @param itemToListHead The map from list item element to the list head element.
|
|
17
17
|
* @param visited A set of elements that were already visited.
|
|
18
18
|
*/
|
|
19
|
-
export declare function findAndAddListHeadToMap(position:
|
|
19
|
+
export declare function findAndAddListHeadToMap(position: ModelPosition, itemToListHead: Set<ListElement>, visited: Set<ModelElement>): void;
|
|
20
20
|
/**
|
|
21
21
|
* Scans the list starting from the given list head element and fixes items' indentation.
|
|
22
22
|
*
|
|
@@ -25,7 +25,7 @@ export declare function findAndAddListHeadToMap(position: Position, itemToListHe
|
|
|
25
25
|
* @param writer The model writer.
|
|
26
26
|
* @returns Whether the model was modified.
|
|
27
27
|
*/
|
|
28
|
-
export declare function fixListIndents(listNodes: Iterable<ListIteratorValue>, writer:
|
|
28
|
+
export declare function fixListIndents(listNodes: Iterable<ListIteratorValue>, writer: ModelWriter): boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Scans the list starting from the given list head element and fixes items' types.
|
|
31
31
|
*
|
|
@@ -35,4 +35,4 @@ export declare function fixListIndents(listNodes: Iterable<ListIteratorValue>, w
|
|
|
35
35
|
* @param writer The model writer.
|
|
36
36
|
* @returns Whether the model was modified.
|
|
37
37
|
*/
|
|
38
|
-
export declare function fixListItemIds(listNodes: Iterable<ListIteratorValue>, seenIds: Set<string>, writer:
|
|
38
|
+
export declare function fixListItemIds(listNodes: Iterable<ListIteratorValue>, seenIds: Set<string>, writer: ModelWriter): boolean;
|
package/src/list/utils/view.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module list/list/utils/view
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ViewDowncastWriter, ViewAttributeElement, ViewDocumentFragment, ViewElement, ViewNode } from 'ckeditor5/src/engine.js';
|
|
9
9
|
import { type ListType } from '../listediting.js';
|
|
10
10
|
/**
|
|
11
11
|
* Checks if view element is a list type (ul or ol).
|
|
@@ -61,13 +61,13 @@ export declare function getIndent(listItem: ViewElement): number;
|
|
|
61
61
|
*
|
|
62
62
|
* @internal
|
|
63
63
|
*/
|
|
64
|
-
export declare function createListElement(writer:
|
|
64
|
+
export declare function createListElement(writer: ViewDowncastWriter, indent: number, type: ListType, id?: string): ViewAttributeElement;
|
|
65
65
|
/**
|
|
66
66
|
* Creates a list item attribute element (li).
|
|
67
67
|
*
|
|
68
68
|
* @internal
|
|
69
69
|
*/
|
|
70
|
-
export declare function createListItemElement(writer:
|
|
70
|
+
export declare function createListItemElement(writer: ViewDowncastWriter, indent: number, id: string): ViewAttributeElement;
|
|
71
71
|
/**
|
|
72
72
|
* Returns a view element name for the given list type.
|
|
73
73
|
*
|
package/src/list.d.ts
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* @module list/list
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ListEditing from './list/listediting.js';
|
|
10
|
-
import ListUI from './list/listui.js';
|
|
9
|
+
import { ListEditing } from './list/listediting.js';
|
|
10
|
+
import { ListUI } from './list/listui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The list feature.
|
|
13
13
|
*
|
|
14
14
|
* This is a "glue" plugin that loads the {@link module:list/list/listediting~ListEditing list
|
|
15
15
|
* editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class List extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
package/src/list.js
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* @module list/list
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import ListEditing from './list/listediting.js';
|
|
10
|
-
import ListUI from './list/listui.js';
|
|
9
|
+
import { ListEditing } from './list/listediting.js';
|
|
10
|
+
import { ListUI } from './list/listui.js';
|
|
11
11
|
/**
|
|
12
12
|
* The list feature.
|
|
13
13
|
*
|
|
14
14
|
* This is a "glue" plugin that loads the {@link module:list/list/listediting~ListEditing list
|
|
15
15
|
* editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class List extends Plugin {
|
|
18
18
|
/**
|
|
19
19
|
* @inheritDoc
|
|
20
20
|
*/
|
package/src/listconfig.d.ts
CHANGED
|
@@ -41,6 +41,19 @@ export interface ListConfig {
|
|
|
41
41
|
* @default true
|
|
42
42
|
*/
|
|
43
43
|
multiBlock?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Enables list item marker formatting. Current list of integrated formatting plugins includes:
|
|
46
|
+
* * {@link module:list/listformatting/listitemfontfamilyintegration~ListItemFontFamilyIntegration Font family}
|
|
47
|
+
* * {@link module:list/listformatting/listitemfontsizeintegration~ListItemFontSizeIntegration Font size}
|
|
48
|
+
* * {@link module:list/listformatting/listitemfontcolorintegration~ListItemFontColorIntegration Font color}
|
|
49
|
+
* * {@link module:list/listformatting/listitemboldintegration~ListItemBoldIntegration Bold}
|
|
50
|
+
* * {@link module:list/listformatting/listitemitalicintegration~ListItemItalicIntegration Italic}
|
|
51
|
+
*
|
|
52
|
+
* **Note:** This is enabled by default.
|
|
53
|
+
*
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
enableListItemMarkerFormatting?: boolean;
|
|
44
57
|
}
|
|
45
58
|
/**
|
|
46
59
|
* The configuration of the {@link module:list/listproperties~ListProperties list properties} feature and the
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module list/listformatting/listitemboldintegration
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ListEditing } from '../list/listediting.js';
|
|
10
|
+
/**
|
|
11
|
+
* The list item bold integration plugin.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ListItemBoldIntegration extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get pluginName(): "ListItemBoldIntegration";
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get isOfficialPlugin(): true;
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get requires(): readonly [typeof ListEditing];
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
init(): void;
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
afterInit(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module list/listformatting/listitemboldintegration
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ListEditing } from '../list/listediting.js';
|
|
10
|
+
/**
|
|
11
|
+
* The list item bold integration plugin.
|
|
12
|
+
*/
|
|
13
|
+
export class ListItemBoldIntegration extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get pluginName() {
|
|
18
|
+
return 'ListItemBoldIntegration';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get isOfficialPlugin() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get requires() {
|
|
30
|
+
return [ListEditing];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
init() {
|
|
36
|
+
const editor = this.editor;
|
|
37
|
+
const ListFormatting = editor.plugins.get('ListFormatting');
|
|
38
|
+
const listEditing = editor.plugins.get(ListEditing);
|
|
39
|
+
if (!editor.plugins.has('BoldEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
ListFormatting.registerFormatAttribute('bold', 'listItemBold');
|
|
43
|
+
// Register the downcast strategy in init() so that the attribute name is registered before the list editing
|
|
44
|
+
// registers its converters.
|
|
45
|
+
// This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.
|
|
46
|
+
listEditing.registerDowncastStrategy({
|
|
47
|
+
scope: 'item',
|
|
48
|
+
attributeName: 'listItemBold',
|
|
49
|
+
setAttributeOnDowncast(writer, value, viewElement) {
|
|
50
|
+
if (value) {
|
|
51
|
+
writer.addClass('ck-list-marker-bold', viewElement);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
afterInit() {
|
|
60
|
+
const editor = this.editor;
|
|
61
|
+
const model = editor.model;
|
|
62
|
+
if (!editor.plugins.has('BoldEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
model.schema.extend('$listItem', { allowAttributes: 'listItemBold' });
|
|
66
|
+
model.schema.setAttributeProperties('listItemBold', {
|
|
67
|
+
isFormatting: true
|
|
68
|
+
});
|
|
69
|
+
model.schema.addAttributeCheck(context => {
|
|
70
|
+
const item = context.last;
|
|
71
|
+
if (!item.getAttribute('listItemId')) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}, 'listItemBold');
|
|
75
|
+
editor.conversion.for('upcast').attributeToAttribute({
|
|
76
|
+
model: 'listItemBold',
|
|
77
|
+
view: {
|
|
78
|
+
name: 'li',
|
|
79
|
+
classes: 'ck-list-marker-bold'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|