@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
|
@@ -1,154 +1,154 @@
|
|
|
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/documentlistediting
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import type { DowncastWriter, Element, ViewElement, Writer } from 'ckeditor5/src/engine';
|
|
10
|
-
import { Delete } from 'ckeditor5/src/typing';
|
|
11
|
-
import { Enter } from 'ckeditor5/src/enter';
|
|
12
|
-
import DocumentListUtils from './documentlistutils';
|
|
13
|
-
import { ListBlocksIterable } from './utils/listwalker';
|
|
14
|
-
import '../../theme/documentlist.css';
|
|
15
|
-
import '../../theme/list.css';
|
|
16
|
-
/**
|
|
17
|
-
* Map of model attributes applicable to list blocks.
|
|
18
|
-
*/
|
|
19
|
-
export interface ListItemAttributesMap {
|
|
20
|
-
listType?: 'numbered' | 'bulleted';
|
|
21
|
-
listIndent?: number;
|
|
22
|
-
listItemId?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The editing part of the document-list feature. It handles creating, editing and removing lists and list items.
|
|
26
|
-
*/
|
|
27
|
-
export default class DocumentListEditing extends Plugin {
|
|
28
|
-
/**
|
|
29
|
-
* The list of registered downcast strategies.
|
|
30
|
-
*/
|
|
31
|
-
private readonly _downcastStrategies;
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get pluginName(): "DocumentListEditing";
|
|
36
|
-
/**
|
|
37
|
-
* @inheritDoc
|
|
38
|
-
*/
|
|
39
|
-
static get requires(): readonly [typeof Enter, typeof Delete, typeof DocumentListUtils];
|
|
40
|
-
/**
|
|
41
|
-
* @inheritDoc
|
|
42
|
-
*/
|
|
43
|
-
init(): void;
|
|
44
|
-
/**
|
|
45
|
-
* @inheritDoc
|
|
46
|
-
*/
|
|
47
|
-
afterInit(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Registers a downcast strategy.
|
|
50
|
-
*
|
|
51
|
-
* **Note**: Strategies must be registered in the `Plugin#init()` phase so that it can be applied
|
|
52
|
-
* in the `DocumentListEditing#afterInit()`.
|
|
53
|
-
*
|
|
54
|
-
* @param strategy The downcast strategy to register.
|
|
55
|
-
*/
|
|
56
|
-
registerDowncastStrategy(strategy: DowncastStrategy): void;
|
|
57
|
-
/**
|
|
58
|
-
* Returns list of model attribute names that should affect downcast conversion.
|
|
59
|
-
*/
|
|
60
|
-
private _getListAttributeNames;
|
|
61
|
-
/**
|
|
62
|
-
* Attaches the listener to the {@link module:engine/view/document~Document#event:delete} event and handles backspace/delete
|
|
63
|
-
* keys in and around document lists.
|
|
64
|
-
*/
|
|
65
|
-
private _setupDeleteIntegration;
|
|
66
|
-
/**
|
|
67
|
-
* Attaches a listener to the {@link module:engine/view/document~Document#event:enter} event and handles enter key press
|
|
68
|
-
* in document lists.
|
|
69
|
-
*/
|
|
70
|
-
private _setupEnterIntegration;
|
|
71
|
-
/**
|
|
72
|
-
* Attaches a listener to the {@link module:engine/view/document~Document#event:tab} event and handles tab key and tab+shift keys
|
|
73
|
-
* presses in document lists.
|
|
74
|
-
*/
|
|
75
|
-
private _setupTabIntegration;
|
|
76
|
-
/**
|
|
77
|
-
* Registers the conversion helpers for the document-list feature.
|
|
78
|
-
*/
|
|
79
|
-
private _setupConversion;
|
|
80
|
-
/**
|
|
81
|
-
* Registers model post-fixers.
|
|
82
|
-
*/
|
|
83
|
-
private _setupModelPostFixing;
|
|
84
|
-
/**
|
|
85
|
-
* Integrates the feature with the clipboard via {@link module:engine/model/model~Model#insertContent} and
|
|
86
|
-
* {@link module:engine/model/model~Model#getSelectedContent}.
|
|
87
|
-
*/
|
|
88
|
-
private _setupClipboardIntegration;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* The downcast strategy.
|
|
92
|
-
*/
|
|
93
|
-
export interface DowncastStrategy {
|
|
94
|
-
/**
|
|
95
|
-
* The scope of the downcast (whether it applies to LI or OL/UL).
|
|
96
|
-
*/
|
|
97
|
-
scope: 'list' | 'item';
|
|
98
|
-
/**
|
|
99
|
-
* The model attribute name.
|
|
100
|
-
*/
|
|
101
|
-
attributeName: string;
|
|
102
|
-
/**
|
|
103
|
-
* Sets the property on the view element.
|
|
104
|
-
*/
|
|
105
|
-
setAttributeOnDowncast(writer: DowncastWriter, value: unknown, element: ViewElement): void;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Event fired on changes detected on the model list element to verify if the view representation of a list element
|
|
109
|
-
* is representing those attributes.
|
|
110
|
-
*
|
|
111
|
-
* It allows triggering a re-wrapping of a list item.
|
|
112
|
-
*
|
|
113
|
-
* @internal
|
|
114
|
-
* @eventName ~DocumentListEditing#postFixer
|
|
115
|
-
* @param listHead The head element of a list.
|
|
116
|
-
* @param writer The writer to do changes with.
|
|
117
|
-
* @param seenIds The set of already known IDs.
|
|
118
|
-
* @returns If a post-fixer made a change of the model tree, it should return `true`.
|
|
119
|
-
*/
|
|
120
|
-
export type DocumentListEditingPostFixerEvent = {
|
|
121
|
-
name: 'postFixer';
|
|
122
|
-
args: [
|
|
123
|
-
{
|
|
124
|
-
listNodes: ListBlocksIterable;
|
|
125
|
-
listHead: Element;
|
|
126
|
-
writer: Writer;
|
|
127
|
-
seenIds: Set<string>;
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
return: boolean;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Event fired on changes detected on the model list element to verify if the view representation of a list element
|
|
134
|
-
* is representing those attributes.
|
|
135
|
-
*
|
|
136
|
-
* It allows triggering a re-wrapping of a list item.
|
|
137
|
-
*
|
|
138
|
-
* **Note**: For convenience this event is namespaced and could be captured as `checkAttributes:list` or `checkAttributes:item`.
|
|
139
|
-
*
|
|
140
|
-
* @internal
|
|
141
|
-
* @eventName ~DocumentListEditing#checkAttributes
|
|
142
|
-
*/
|
|
143
|
-
export type DocumentListEditingCheckAttributesEvent = {
|
|
144
|
-
name: 'checkAttributes' | 'checkAttributes:list' | 'checkAttributes:item';
|
|
145
|
-
args: [
|
|
146
|
-
{
|
|
147
|
-
viewElement: ViewElement & {
|
|
148
|
-
id?: string;
|
|
149
|
-
};
|
|
150
|
-
modelAttributes: ListItemAttributesMap;
|
|
151
|
-
}
|
|
152
|
-
];
|
|
153
|
-
return: boolean;
|
|
154
|
-
};
|
|
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/documentlistediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import type { DowncastWriter, Element, ViewElement, Writer } from 'ckeditor5/src/engine';
|
|
10
|
+
import { Delete } from 'ckeditor5/src/typing';
|
|
11
|
+
import { Enter } from 'ckeditor5/src/enter';
|
|
12
|
+
import DocumentListUtils from './documentlistutils';
|
|
13
|
+
import { ListBlocksIterable } from './utils/listwalker';
|
|
14
|
+
import '../../theme/documentlist.css';
|
|
15
|
+
import '../../theme/list.css';
|
|
16
|
+
/**
|
|
17
|
+
* Map of model attributes applicable to list blocks.
|
|
18
|
+
*/
|
|
19
|
+
export interface ListItemAttributesMap {
|
|
20
|
+
listType?: 'numbered' | 'bulleted';
|
|
21
|
+
listIndent?: number;
|
|
22
|
+
listItemId?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The editing part of the document-list feature. It handles creating, editing and removing lists and list items.
|
|
26
|
+
*/
|
|
27
|
+
export default class DocumentListEditing extends Plugin {
|
|
28
|
+
/**
|
|
29
|
+
* The list of registered downcast strategies.
|
|
30
|
+
*/
|
|
31
|
+
private readonly _downcastStrategies;
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get pluginName(): "DocumentListEditing";
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
static get requires(): readonly [typeof Enter, typeof Delete, typeof DocumentListUtils];
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
init(): void;
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
afterInit(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Registers a downcast strategy.
|
|
50
|
+
*
|
|
51
|
+
* **Note**: Strategies must be registered in the `Plugin#init()` phase so that it can be applied
|
|
52
|
+
* in the `DocumentListEditing#afterInit()`.
|
|
53
|
+
*
|
|
54
|
+
* @param strategy The downcast strategy to register.
|
|
55
|
+
*/
|
|
56
|
+
registerDowncastStrategy(strategy: DowncastStrategy): void;
|
|
57
|
+
/**
|
|
58
|
+
* Returns list of model attribute names that should affect downcast conversion.
|
|
59
|
+
*/
|
|
60
|
+
private _getListAttributeNames;
|
|
61
|
+
/**
|
|
62
|
+
* Attaches the listener to the {@link module:engine/view/document~Document#event:delete} event and handles backspace/delete
|
|
63
|
+
* keys in and around document lists.
|
|
64
|
+
*/
|
|
65
|
+
private _setupDeleteIntegration;
|
|
66
|
+
/**
|
|
67
|
+
* Attaches a listener to the {@link module:engine/view/document~Document#event:enter} event and handles enter key press
|
|
68
|
+
* in document lists.
|
|
69
|
+
*/
|
|
70
|
+
private _setupEnterIntegration;
|
|
71
|
+
/**
|
|
72
|
+
* Attaches a listener to the {@link module:engine/view/document~Document#event:tab} event and handles tab key and tab+shift keys
|
|
73
|
+
* presses in document lists.
|
|
74
|
+
*/
|
|
75
|
+
private _setupTabIntegration;
|
|
76
|
+
/**
|
|
77
|
+
* Registers the conversion helpers for the document-list feature.
|
|
78
|
+
*/
|
|
79
|
+
private _setupConversion;
|
|
80
|
+
/**
|
|
81
|
+
* Registers model post-fixers.
|
|
82
|
+
*/
|
|
83
|
+
private _setupModelPostFixing;
|
|
84
|
+
/**
|
|
85
|
+
* Integrates the feature with the clipboard via {@link module:engine/model/model~Model#insertContent} and
|
|
86
|
+
* {@link module:engine/model/model~Model#getSelectedContent}.
|
|
87
|
+
*/
|
|
88
|
+
private _setupClipboardIntegration;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The downcast strategy.
|
|
92
|
+
*/
|
|
93
|
+
export interface DowncastStrategy {
|
|
94
|
+
/**
|
|
95
|
+
* The scope of the downcast (whether it applies to LI or OL/UL).
|
|
96
|
+
*/
|
|
97
|
+
scope: 'list' | 'item';
|
|
98
|
+
/**
|
|
99
|
+
* The model attribute name.
|
|
100
|
+
*/
|
|
101
|
+
attributeName: string;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the property on the view element.
|
|
104
|
+
*/
|
|
105
|
+
setAttributeOnDowncast(writer: DowncastWriter, value: unknown, element: ViewElement): void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Event fired on changes detected on the model list element to verify if the view representation of a list element
|
|
109
|
+
* is representing those attributes.
|
|
110
|
+
*
|
|
111
|
+
* It allows triggering a re-wrapping of a list item.
|
|
112
|
+
*
|
|
113
|
+
* @internal
|
|
114
|
+
* @eventName ~DocumentListEditing#postFixer
|
|
115
|
+
* @param listHead The head element of a list.
|
|
116
|
+
* @param writer The writer to do changes with.
|
|
117
|
+
* @param seenIds The set of already known IDs.
|
|
118
|
+
* @returns If a post-fixer made a change of the model tree, it should return `true`.
|
|
119
|
+
*/
|
|
120
|
+
export type DocumentListEditingPostFixerEvent = {
|
|
121
|
+
name: 'postFixer';
|
|
122
|
+
args: [
|
|
123
|
+
{
|
|
124
|
+
listNodes: ListBlocksIterable;
|
|
125
|
+
listHead: Element;
|
|
126
|
+
writer: Writer;
|
|
127
|
+
seenIds: Set<string>;
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
return: boolean;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Event fired on changes detected on the model list element to verify if the view representation of a list element
|
|
134
|
+
* is representing those attributes.
|
|
135
|
+
*
|
|
136
|
+
* It allows triggering a re-wrapping of a list item.
|
|
137
|
+
*
|
|
138
|
+
* **Note**: For convenience this event is namespaced and could be captured as `checkAttributes:list` or `checkAttributes:item`.
|
|
139
|
+
*
|
|
140
|
+
* @internal
|
|
141
|
+
* @eventName ~DocumentListEditing#checkAttributes
|
|
142
|
+
*/
|
|
143
|
+
export type DocumentListEditingCheckAttributesEvent = {
|
|
144
|
+
name: 'checkAttributes' | 'checkAttributes:list' | 'checkAttributes:item';
|
|
145
|
+
args: [
|
|
146
|
+
{
|
|
147
|
+
viewElement: ViewElement & {
|
|
148
|
+
id?: string;
|
|
149
|
+
};
|
|
150
|
+
modelAttributes: ListItemAttributesMap;
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
return: boolean;
|
|
154
|
+
};
|