@ckeditor/ckeditor5-list 41.3.0-alpha.3 → 41.3.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.
Files changed (209) hide show
  1. package/build/list.js +1 -1
  2. package/package.json +2 -3
  3. package/src/index.d.ts +2 -2
  4. package/src/index.js +1 -0
  5. package/src/legacylist/legacylistcommand.d.ts +3 -2
  6. package/src/legacylistproperties/legacyliststylecommand.js +1 -0
  7. package/src/list/converters.d.ts +9 -1
  8. package/src/list/converters.js +87 -13
  9. package/src/list/listcommand.d.ts +14 -2
  10. package/src/list/listcommand.js +17 -4
  11. package/src/list/listediting.d.ts +7 -1
  12. package/src/list/listediting.js +7 -1
  13. package/src/list/listui.js +3 -3
  14. package/src/list/listutils.d.ts +7 -1
  15. package/src/list/listutils.js +7 -1
  16. package/src/list/utils/listwalker.d.ts +13 -16
  17. package/src/list/utils/model.d.ts +9 -2
  18. package/src/list/utils/model.js +12 -3
  19. package/src/list/utils/view.d.ts +4 -3
  20. package/src/list/utils/view.js +1 -1
  21. package/src/list/utils.d.ts +2 -2
  22. package/src/list/utils.js +25 -15
  23. package/src/listproperties/listpropertiesediting.js +2 -1
  24. package/src/listproperties/listpropertiesui.js +169 -82
  25. package/src/listproperties/liststartcommand.js +6 -3
  26. package/src/todolist/todolistediting.js +4 -12
  27. package/src/todolist/todolistui.js +2 -2
  28. package/dist/content-index.css +0 -102
  29. package/dist/editor-index.css +0 -74
  30. package/dist/index.css +0 -228
  31. package/dist/index.css.map +0 -1
  32. package/dist/translations/ar.d.ts +0 -8
  33. package/dist/translations/ar.js +0 -5
  34. package/dist/translations/ast.d.ts +0 -8
  35. package/dist/translations/ast.js +0 -5
  36. package/dist/translations/az.d.ts +0 -8
  37. package/dist/translations/az.js +0 -5
  38. package/dist/translations/bg.d.ts +0 -8
  39. package/dist/translations/bg.js +0 -5
  40. package/dist/translations/bn.d.ts +0 -8
  41. package/dist/translations/bn.js +0 -5
  42. package/dist/translations/ca.d.ts +0 -8
  43. package/dist/translations/ca.js +0 -5
  44. package/dist/translations/cs.d.ts +0 -8
  45. package/dist/translations/cs.js +0 -5
  46. package/dist/translations/da.d.ts +0 -8
  47. package/dist/translations/da.js +0 -5
  48. package/dist/translations/de-ch.d.ts +0 -8
  49. package/dist/translations/de-ch.js +0 -5
  50. package/dist/translations/de.d.ts +0 -8
  51. package/dist/translations/de.js +0 -5
  52. package/dist/translations/el.d.ts +0 -8
  53. package/dist/translations/el.js +0 -5
  54. package/dist/translations/en-au.d.ts +0 -8
  55. package/dist/translations/en-au.js +0 -5
  56. package/dist/translations/en-gb.d.ts +0 -8
  57. package/dist/translations/en-gb.js +0 -5
  58. package/dist/translations/en.d.ts +0 -8
  59. package/dist/translations/en.js +0 -5
  60. package/dist/translations/eo.d.ts +0 -8
  61. package/dist/translations/eo.js +0 -5
  62. package/dist/translations/es.d.ts +0 -8
  63. package/dist/translations/es.js +0 -5
  64. package/dist/translations/et.d.ts +0 -8
  65. package/dist/translations/et.js +0 -5
  66. package/dist/translations/eu.d.ts +0 -8
  67. package/dist/translations/eu.js +0 -5
  68. package/dist/translations/fa.d.ts +0 -8
  69. package/dist/translations/fa.js +0 -5
  70. package/dist/translations/fi.d.ts +0 -8
  71. package/dist/translations/fi.js +0 -5
  72. package/dist/translations/fr.d.ts +0 -8
  73. package/dist/translations/fr.js +0 -5
  74. package/dist/translations/gl.d.ts +0 -8
  75. package/dist/translations/gl.js +0 -5
  76. package/dist/translations/he.d.ts +0 -8
  77. package/dist/translations/he.js +0 -5
  78. package/dist/translations/hi.d.ts +0 -8
  79. package/dist/translations/hi.js +0 -5
  80. package/dist/translations/hr.d.ts +0 -8
  81. package/dist/translations/hr.js +0 -5
  82. package/dist/translations/hu.d.ts +0 -8
  83. package/dist/translations/hu.js +0 -5
  84. package/dist/translations/id.d.ts +0 -8
  85. package/dist/translations/id.js +0 -5
  86. package/dist/translations/it.d.ts +0 -8
  87. package/dist/translations/it.js +0 -5
  88. package/dist/translations/ja.d.ts +0 -8
  89. package/dist/translations/ja.js +0 -5
  90. package/dist/translations/jv.d.ts +0 -8
  91. package/dist/translations/jv.js +0 -5
  92. package/dist/translations/km.d.ts +0 -8
  93. package/dist/translations/km.js +0 -5
  94. package/dist/translations/kn.d.ts +0 -8
  95. package/dist/translations/kn.js +0 -5
  96. package/dist/translations/ko.d.ts +0 -8
  97. package/dist/translations/ko.js +0 -5
  98. package/dist/translations/ku.d.ts +0 -8
  99. package/dist/translations/ku.js +0 -5
  100. package/dist/translations/lt.d.ts +0 -8
  101. package/dist/translations/lt.js +0 -5
  102. package/dist/translations/lv.d.ts +0 -8
  103. package/dist/translations/lv.js +0 -5
  104. package/dist/translations/ms.d.ts +0 -8
  105. package/dist/translations/ms.js +0 -5
  106. package/dist/translations/nb.d.ts +0 -8
  107. package/dist/translations/nb.js +0 -5
  108. package/dist/translations/ne.d.ts +0 -8
  109. package/dist/translations/ne.js +0 -5
  110. package/dist/translations/nl.d.ts +0 -8
  111. package/dist/translations/nl.js +0 -5
  112. package/dist/translations/no.d.ts +0 -8
  113. package/dist/translations/no.js +0 -5
  114. package/dist/translations/pl.d.ts +0 -8
  115. package/dist/translations/pl.js +0 -5
  116. package/dist/translations/pt-br.d.ts +0 -8
  117. package/dist/translations/pt-br.js +0 -5
  118. package/dist/translations/pt.d.ts +0 -8
  119. package/dist/translations/pt.js +0 -5
  120. package/dist/translations/ro.d.ts +0 -8
  121. package/dist/translations/ro.js +0 -5
  122. package/dist/translations/ru.d.ts +0 -8
  123. package/dist/translations/ru.js +0 -5
  124. package/dist/translations/si.d.ts +0 -8
  125. package/dist/translations/si.js +0 -5
  126. package/dist/translations/sk.d.ts +0 -8
  127. package/dist/translations/sk.js +0 -5
  128. package/dist/translations/sq.d.ts +0 -8
  129. package/dist/translations/sq.js +0 -5
  130. package/dist/translations/sr-latn.d.ts +0 -8
  131. package/dist/translations/sr-latn.js +0 -5
  132. package/dist/translations/sr.d.ts +0 -8
  133. package/dist/translations/sr.js +0 -5
  134. package/dist/translations/sv.d.ts +0 -8
  135. package/dist/translations/sv.js +0 -5
  136. package/dist/translations/th.d.ts +0 -8
  137. package/dist/translations/th.js +0 -5
  138. package/dist/translations/tk.d.ts +0 -8
  139. package/dist/translations/tk.js +0 -5
  140. package/dist/translations/tr.d.ts +0 -8
  141. package/dist/translations/tr.js +0 -5
  142. package/dist/translations/tt.d.ts +0 -8
  143. package/dist/translations/tt.js +0 -5
  144. package/dist/translations/ug.d.ts +0 -8
  145. package/dist/translations/ug.js +0 -5
  146. package/dist/translations/uk.d.ts +0 -8
  147. package/dist/translations/uk.js +0 -5
  148. package/dist/translations/ur.d.ts +0 -8
  149. package/dist/translations/ur.js +0 -5
  150. package/dist/translations/uz.d.ts +0 -8
  151. package/dist/translations/uz.js +0 -5
  152. package/dist/translations/vi.d.ts +0 -8
  153. package/dist/translations/vi.js +0 -5
  154. package/dist/translations/zh-cn.d.ts +0 -8
  155. package/dist/translations/zh-cn.js +0 -5
  156. package/dist/translations/zh.d.ts +0 -8
  157. package/dist/translations/zh.js +0 -5
  158. package/dist/types/augmentation.d.ts +0 -57
  159. package/dist/types/documentlist.d.ts +0 -32
  160. package/dist/types/documentlistproperties.d.ts +0 -32
  161. package/dist/types/index.d.ts +0 -49
  162. package/dist/types/legacylist/legacyconverters.d.ts +0 -200
  163. package/dist/types/legacylist/legacyindentcommand.d.ts +0 -41
  164. package/dist/types/legacylist/legacylistcommand.d.ts +0 -59
  165. package/dist/types/legacylist/legacylistediting.d.ts +0 -36
  166. package/dist/types/legacylist/legacylistutils.d.ts +0 -45
  167. package/dist/types/legacylist/legacyutils.d.ts +0 -105
  168. package/dist/types/legacylist.d.ts +0 -30
  169. package/dist/types/legacylistproperties/legacylistpropertiesediting.d.ts +0 -76
  170. package/dist/types/legacylistproperties/legacylistreversedcommand.d.ts +0 -42
  171. package/dist/types/legacylistproperties/legacyliststartcommand.d.ts +0 -41
  172. package/dist/types/legacylistproperties/legacyliststylecommand.d.ts +0 -71
  173. package/dist/types/legacylistproperties.d.ts +0 -31
  174. package/dist/types/legacytodolist/legacychecktodolistcommand.d.ts +0 -56
  175. package/dist/types/legacytodolist/legacytodolistconverters.d.ts +0 -87
  176. package/dist/types/legacytodolist/legacytodolistediting.d.ts +0 -43
  177. package/dist/types/legacytodolist.d.ts +0 -31
  178. package/dist/types/list/adjacentlistssupport.d.ts +0 -19
  179. package/dist/types/list/converters.d.ts +0 -69
  180. package/dist/types/list/listcommand.d.ts +0 -84
  181. package/dist/types/list/listediting.d.ts +0 -220
  182. package/dist/types/list/listindentcommand.d.ts +0 -66
  183. package/dist/types/list/listmergecommand.d.ts +0 -80
  184. package/dist/types/list/listsplitcommand.d.ts +0 -71
  185. package/dist/types/list/listui.d.ts +0 -23
  186. package/dist/types/list/listutils.d.ts +0 -50
  187. package/dist/types/list/utils/listwalker.d.ts +0 -149
  188. package/dist/types/list/utils/model.d.ts +0 -206
  189. package/dist/types/list/utils/postfixers.d.ts +0 -41
  190. package/dist/types/list/utils/view.d.ts +0 -85
  191. package/dist/types/list/utils.d.ts +0 -22
  192. package/dist/types/list.d.ts +0 -30
  193. package/dist/types/listconfig.d.ts +0 -136
  194. package/dist/types/listproperties/converters.d.ts +0 -23
  195. package/dist/types/listproperties/listpropertiesediting.d.ts +0 -92
  196. package/dist/types/listproperties/listpropertiesui.d.ts +0 -27
  197. package/dist/types/listproperties/listpropertiesutils.d.ts +0 -37
  198. package/dist/types/listproperties/listreversedcommand.d.ts +0 -40
  199. package/dist/types/listproperties/liststartcommand.d.ts +0 -42
  200. package/dist/types/listproperties/liststylecommand.d.ts +0 -76
  201. package/dist/types/listproperties/ui/listpropertiesview.d.ts +0 -160
  202. package/dist/types/listproperties/utils/style.d.ts +0 -24
  203. package/dist/types/listproperties.d.ts +0 -31
  204. package/dist/types/tododocumentlist.d.ts +0 -32
  205. package/dist/types/todolist/checktodolistcommand.d.ts +0 -53
  206. package/dist/types/todolist/todocheckboxchangeobserver.d.ts +0 -45
  207. package/dist/types/todolist/todolistediting.d.ts +0 -42
  208. package/dist/types/todolist/todolistui.d.ts +0 -23
  209. package/dist/types/todolist.d.ts +0 -31
@@ -1,220 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module list/list/listediting
11
- */
12
- import { Plugin, type Editor } from 'ckeditor5/src/core.js';
13
- import type { DowncastWriter, Element, ViewElement, ViewAttributeElement, Writer } from 'ckeditor5/src/engine.js';
14
- import { Delete } from 'ckeditor5/src/typing.js';
15
- import { Enter } from 'ckeditor5/src/enter.js';
16
- import ListUtils from './listutils.js';
17
- import { ListBlocksIterable } from './utils/listwalker.js';
18
- import { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';
19
- import '../../theme/documentlist.css';
20
- import '../../theme/list.css';
21
- /**
22
- * Map of model attributes applicable to list blocks.
23
- */
24
- export interface ListItemAttributesMap {
25
- listType?: 'numbered' | 'bulleted' | 'todo';
26
- listIndent?: number;
27
- listItemId?: string;
28
- }
29
- /**
30
- * The editing part of the document-list feature. It handles creating, editing and removing lists and list items.
31
- */
32
- export default class ListEditing extends Plugin {
33
- /**
34
- * The list of registered downcast strategies.
35
- */
36
- private readonly _downcastStrategies;
37
- /**
38
- * @inheritDoc
39
- */
40
- static get pluginName(): "ListEditing";
41
- /**
42
- * @inheritDoc
43
- */
44
- static get requires(): readonly [typeof Enter, typeof Delete, typeof ListUtils, typeof ClipboardPipeline];
45
- /**
46
- * @inheritDoc
47
- */
48
- constructor(editor: Editor);
49
- /**
50
- * @inheritDoc
51
- */
52
- init(): void;
53
- /**
54
- * @inheritDoc
55
- */
56
- afterInit(): void;
57
- /**
58
- * Registers a downcast strategy.
59
- *
60
- * **Note**: Strategies must be registered in the `Plugin#init()` phase so that it can be applied
61
- * in the `ListEditing#afterInit()`.
62
- *
63
- * @param strategy The downcast strategy to register.
64
- */
65
- registerDowncastStrategy(strategy: DowncastStrategy): void;
66
- /**
67
- * Returns list of model attribute names that should affect downcast conversion.
68
- */
69
- getListAttributeNames(): Array<string>;
70
- /**
71
- * Attaches the listener to the {@link module:engine/view/document~Document#event:delete} event and handles backspace/delete
72
- * keys in and around document lists.
73
- */
74
- private _setupDeleteIntegration;
75
- /**
76
- * Attaches a listener to the {@link module:engine/view/document~Document#event:enter} event and handles enter key press
77
- * in document lists.
78
- */
79
- private _setupEnterIntegration;
80
- /**
81
- * Attaches a listener to the {@link module:engine/view/document~Document#event:tab} event and handles tab key and tab+shift keys
82
- * presses in document lists.
83
- */
84
- private _setupTabIntegration;
85
- /**
86
- * Registers the conversion helpers for the document-list feature.
87
- */
88
- private _setupConversion;
89
- /**
90
- * Registers model post-fixers.
91
- */
92
- private _setupModelPostFixing;
93
- /**
94
- * Integrates the feature with the clipboard via {@link module:engine/model/model~Model#insertContent} and
95
- * {@link module:engine/model/model~Model#getSelectedContent}.
96
- */
97
- private _setupClipboardIntegration;
98
- /**
99
- * Informs editor accessibility features about keystrokes brought by the plugin.
100
- */
101
- private _setupAccessibilityIntegration;
102
- }
103
- /**
104
- * The attribute to attribute downcast strategy for UL, OL, LI elements.
105
- */
106
- export interface AttributeDowncastStrategy {
107
- /**
108
- * The scope of the downcast (whether it applies to LI or OL/UL).
109
- */
110
- scope: 'list' | 'item';
111
- /**
112
- * The model attribute name.
113
- */
114
- attributeName: string;
115
- /**
116
- * Sets the property on the view element.
117
- */
118
- setAttributeOnDowncast(writer: DowncastWriter, value: unknown, element: ViewElement): void;
119
- }
120
- /**
121
- * The custom marker downcast strategy.
122
- */
123
- export interface ItemMarkerDowncastStrategy {
124
- /**
125
- * The scope of the downcast.
126
- */
127
- scope: 'itemMarker';
128
- /**
129
- * The model attribute name.
130
- */
131
- attributeName: string;
132
- /**
133
- * Creates a view element for a custom item marker.
134
- */
135
- createElement(writer: DowncastWriter, modelElement: Element, { dataPipeline }: {
136
- dataPipeline?: boolean;
137
- }): ViewElement | null;
138
- /**
139
- * Creates an AttributeElement to be used for wrapping a first block of a list item.
140
- */
141
- createWrapperElement?(writer: DowncastWriter, modelElement: Element, { dataPipeline }: {
142
- dataPipeline?: boolean;
143
- }): ViewAttributeElement;
144
- /**
145
- * Should return true if the given list block can be wrapped with the wrapper created by `createWrapperElement()`
146
- * or only the marker element should be wrapped.
147
- */
148
- canWrapElement?(modelElement: Element): boolean;
149
- }
150
- /**
151
- * The downcast strategy.
152
- */
153
- export type DowncastStrategy = AttributeDowncastStrategy | ItemMarkerDowncastStrategy;
154
- /**
155
- * Event fired on changes detected on the model list element to verify if the view representation of a list element
156
- * is representing those attributes.
157
- *
158
- * It allows triggering a re-wrapping of a list item.
159
- *
160
- * @internal
161
- * @eventName ~ListEditing#postFixer
162
- * @param listHead The head element of a list.
163
- * @param writer The writer to do changes with.
164
- * @param seenIds The set of already known IDs.
165
- * @returns If a post-fixer made a change of the model tree, it should return `true`.
166
- */
167
- export type ListEditingPostFixerEvent = {
168
- name: 'postFixer';
169
- args: [
170
- {
171
- listNodes: ListBlocksIterable;
172
- listHead: Element;
173
- writer: Writer;
174
- seenIds: Set<string>;
175
- }
176
- ];
177
- return: boolean;
178
- };
179
- /**
180
- * Event fired on changes detected on the model list element to verify if the view representation of a list element
181
- * is representing those attributes.
182
- *
183
- * It allows triggering a re-wrapping of a list item.
184
- *
185
- * **Note**: For convenience this event is namespaced and could be captured as `checkAttributes:list` or `checkAttributes:item`.
186
- *
187
- * @internal
188
- * @eventName ~ListEditing#checkAttributes
189
- */
190
- export type ListEditingCheckAttributesEvent = {
191
- name: 'checkAttributes' | 'checkAttributes:list' | 'checkAttributes:item';
192
- args: [
193
- {
194
- viewElement: ViewElement & {
195
- id?: string;
196
- };
197
- modelAttributes: ListItemAttributesMap;
198
- }
199
- ];
200
- return: boolean;
201
- };
202
- /**
203
- * Event fired on changes detected on the model list element to verify if the view representation of a list block element
204
- * is representing those attributes.
205
- *
206
- * It allows triggering a reconversion of a list item block.
207
- *
208
- * @internal
209
- * @eventName ~ListEditing#checkElement
210
- */
211
- export type ListEditingCheckElementEvent = {
212
- name: 'checkElement';
213
- args: [
214
- {
215
- viewElement: ViewElement;
216
- modelElement: Element;
217
- }
218
- ];
219
- return: boolean;
220
- };
@@ -1,66 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module list/list/listindentcommand
11
- */
12
- import { Command, type Editor } from 'ckeditor5/src/core.js';
13
- import type { Element } from 'ckeditor5/src/engine.js';
14
- /**
15
- * The document list indent command. It is used by the {@link module:list/list~List list feature}.
16
- */
17
- export default class ListIndentCommand extends Command {
18
- /**
19
- * Determines by how much the command will change the list item's indent attribute.
20
- */
21
- private readonly _direction;
22
- /**
23
- * Creates an instance of the command.
24
- *
25
- * @param editor The editor instance.
26
- * @param indentDirection The direction of indent. If it is equal to `backward`, the command
27
- * will outdent a list item.
28
- */
29
- constructor(editor: Editor, indentDirection: 'forward' | 'backward');
30
- /**
31
- * @inheritDoc
32
- */
33
- refresh(): void;
34
- /**
35
- * Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
36
- *
37
- * @fires execute
38
- * @fires afterExecute
39
- */
40
- execute(): void;
41
- /**
42
- * Fires the `afterExecute` event.
43
- *
44
- * @param changedBlocks The changed list elements.
45
- */
46
- private _fireAfterExecute;
47
- /**
48
- * Checks whether the command can be enabled in the current context.
49
- *
50
- * @returns Whether the command should be enabled.
51
- */
52
- private _checkEnabled;
53
- }
54
- /**
55
- * Event fired by the {@link ~ListIndentCommand#execute} method.
56
- *
57
- * It allows to execute an action after executing the {@link module:list/list/listcommand~ListCommand#execute}
58
- * method, for example adjusting attributes of changed list items.
59
- *
60
- * @internal
61
- * @eventName ~ListIndentCommand#afterExecute
62
- */
63
- export type ListIndentCommandAfterExecuteEvent = {
64
- name: 'afterExecute';
65
- args: [changedBlocks: Array<Element>];
66
- };
@@ -1,80 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module list/list/listmergecommand
11
- */
12
- import { Command, type Editor } from 'ckeditor5/src/core.js';
13
- import type { Element } from 'ckeditor5/src/engine.js';
14
- /**
15
- * The document list merge command. It is used by the {@link module:list/list~List list feature}.
16
- */
17
- export default class ListMergeCommand extends Command {
18
- /**
19
- * Whether list item should be merged before or after the selected block.
20
- */
21
- private readonly _direction;
22
- /**
23
- * Creates an instance of the command.
24
- *
25
- * @param editor The editor instance.
26
- * @param direction Whether list item should be merged before or after the selected block.
27
- */
28
- constructor(editor: Editor, direction: 'forward' | 'backward');
29
- /**
30
- * @inheritDoc
31
- */
32
- refresh(): void;
33
- /**
34
- * Merges list blocks together (depending on the {@link #constructor}'s `direction` parameter).
35
- *
36
- * @fires execute
37
- * @fires afterExecute
38
- * @param options Command options.
39
- * @param options.shouldMergeOnBlocksContentLevel When set `true`, merging will be performed together
40
- * with {@link module:engine/model/model~Model#deleteContent} to get rid of the inline content in the selection or take advantage
41
- * of the heuristics in `deleteContent()` that helps convert lists into paragraphs in certain cases.
42
- */
43
- execute({ shouldMergeOnBlocksContentLevel }?: {
44
- shouldMergeOnBlocksContentLevel?: boolean;
45
- }): void;
46
- /**
47
- * Fires the `afterExecute` event.
48
- *
49
- * @param changedBlocks The changed list elements.
50
- */
51
- private _fireAfterExecute;
52
- /**
53
- * Checks whether the command can be enabled in the current context.
54
- *
55
- * @returns Whether the command should be enabled.
56
- */
57
- private _checkEnabled;
58
- /**
59
- * Returns the boundary elements the merge should be executed for. These are not necessarily selection's first
60
- * and last position parents but sometimes sibling or even further blocks depending on the context.
61
- *
62
- * @param selection The selection the merge is executed for.
63
- * @param shouldMergeOnBlocksContentLevel When `true`, merge is performed together with
64
- * {@link module:engine/model/model~Model#deleteContent} to remove the inline content within the selection.
65
- */
66
- private _getMergeSubjectElements;
67
- }
68
- /**
69
- * Event fired by the {@link ~ListMergeCommand#execute} method.
70
- *
71
- * It allows to execute an action after executing the {@link module:list/list/listcommand~ListCommand#execute}
72
- * method, for example adjusting attributes of changed list items.
73
- *
74
- * @internal
75
- * @eventName ~ListMergeCommand#afterExecute
76
- */
77
- export type ListMergeCommandAfterExecuteEvent = {
78
- name: 'afterExecute';
79
- args: [changedBlocks: Array<Element>];
80
- };
@@ -1,71 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module list/list/listsplitcommand
11
- */
12
- import type { Element } from 'ckeditor5/src/engine.js';
13
- import { Command, type Editor } from 'ckeditor5/src/core.js';
14
- /**
15
- * The document list split command that splits the list item at the selection.
16
- *
17
- * It is used by the {@link module:list/list~List list feature}.
18
- */
19
- export default class ListSplitCommand extends Command {
20
- /**
21
- * Whether list item should be split before or after the selected block.
22
- */
23
- private readonly _direction;
24
- /**
25
- * Creates an instance of the command.
26
- *
27
- * @param editor The editor instance.
28
- * @param direction Whether list item should be split before or after the selected block.
29
- */
30
- constructor(editor: Editor, direction: 'before' | 'after');
31
- /**
32
- * @inheritDoc
33
- */
34
- refresh(): void;
35
- /**
36
- * Splits the list item at the selection.
37
- *
38
- * @fires execute
39
- * @fires afterExecute
40
- */
41
- execute(): void;
42
- /**
43
- * Fires the `afterExecute` event.
44
- *
45
- * @param changedBlocks The changed list elements.
46
- */
47
- private _fireAfterExecute;
48
- /**
49
- * Checks whether the command can be enabled in the current context.
50
- *
51
- * @returns Whether the command should be enabled.
52
- */
53
- private _checkEnabled;
54
- /**
55
- * Returns the model element that is the main focus of the command (according to the current selection and command direction).
56
- */
57
- private _getStartBlock;
58
- }
59
- /**
60
- * Event fired by the {@link ~ListSplitCommand#execute} method.
61
- *
62
- * It allows to execute an action after executing the {@link module:list/list/listcommand~ListCommand#execute}
63
- * method, for example adjusting attributes of changed list items.
64
- *
65
- * @internal
66
- * @eventName ~ListSplitCommand#afterExecute
67
- */
68
- export type ListSplitCommandAfterExecuteEvent = {
69
- name: 'afterExecute';
70
- args: [changedBlocks: Array<Element>];
71
- };
@@ -1,23 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- import { Plugin } from 'ckeditor5/src/core.js';
10
- /**
11
- * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
12
- * allow to convert paragraphs to and from list items and indent or outdent them.
13
- */
14
- export default class ListUI extends Plugin {
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName(): "ListUI";
19
- /**
20
- * @inheritDoc
21
- */
22
- init(): void;
23
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module list/list/listutils
11
- */
12
- import type { Element, Node } from 'ckeditor5/src/engine.js';
13
- import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
14
- import { Plugin } from 'ckeditor5/src/core.js';
15
- /**
16
- * A set of helpers related to document lists.
17
- */
18
- export default class ListUtils extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get pluginName(): "ListUtils";
23
- /**
24
- * Expands the given list of selected blocks to include all the items of the lists they're in.
25
- *
26
- * @param blocks The list of selected blocks.
27
- */
28
- expandListBlocksToCompleteList(blocks: ArrayOrItem<Element>): Array<Element>;
29
- /**
30
- * Check if the given block is the first in the list item.
31
- *
32
- * @param listBlock The list block element.
33
- */
34
- isFirstBlockOfListItem(listBlock: Element): boolean;
35
- /**
36
- * Returns true if the given model node is a list item block.
37
- *
38
- * @param node A model node.
39
- */
40
- isListItemBlock(node: Node): boolean;
41
- /**
42
- * Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
43
- *
44
- * @param blocks The list of selected blocks.
45
- * @param options.withNested Whether should include nested list items.
46
- */
47
- expandListBlocksToCompleteItems(blocks: ArrayOrItem<Element>, options?: {
48
- withNested?: boolean;
49
- }): Array<Element>;
50
- }
@@ -1,149 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module list/list/utils/listwalker
11
- */
12
- import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
13
- import { type ListElement } from './model.js';
14
- import type { Element, Node } from 'ckeditor5/src/engine.js';
15
- /**
16
- * Document list blocks iterator.
17
- */
18
- export default class ListWalker {
19
- /**
20
- * The start list item block element.
21
- */
22
- private _startElement;
23
- /**
24
- * The reference indent. Initialized by the indent of the start block.
25
- */
26
- private _referenceIndent;
27
- /**
28
- * The iterating direction.
29
- */
30
- private _isForward;
31
- /**
32
- * Whether start block should be included in the result (if it's matching other criteria).
33
- */
34
- private _includeSelf;
35
- /**
36
- * Additional attributes that must be the same for each block.
37
- */
38
- private _sameAttributes;
39
- /**
40
- * Whether blocks with the same indent level as the start block should be included in the result.
41
- */
42
- private _sameIndent;
43
- /**
44
- * Whether blocks with a lower indent level than the start block should be included in the result.
45
- */
46
- private _lowerIndent;
47
- /**
48
- * Whether blocks with a higher indent level than the start block should be included in the result.
49
- */
50
- private _higherIndent;
51
- /**
52
- * Creates a document list iterator.
53
- *
54
- * @param startElement The start list item block element.
55
- * @param options.direction The iterating direction.
56
- * @param options.includeSelf Whether start block should be included in the result (if it's matching other criteria).
57
- * @param options.sameAttributes Additional attributes that must be the same for each block.
58
- * @param options.sameIndent Whether blocks with the same indent level as the start block should be included
59
- * in the result.
60
- * @param options.lowerIndent Whether blocks with a lower indent level than the start block should be included
61
- * in the result.
62
- * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
63
- * in the result.
64
- */
65
- constructor(startElement: Node, options: {
66
- direction?: 'forward' | 'backward';
67
- includeSelf?: boolean;
68
- sameAttributes?: ArrayOrItem<string>;
69
- sameIndent?: boolean;
70
- lowerIndent?: boolean;
71
- higherIndent?: boolean;
72
- });
73
- /**
74
- * Performs only first step of iteration and returns the result.
75
- *
76
- * @param startElement The start list item block element.
77
- * @param options.direction The iterating direction.
78
- * @param options.includeSelf Whether start block should be included in the result (if it's matching other criteria).
79
- * @param options.sameAttributes Additional attributes that must be the same for each block.
80
- * @param options.sameIndent Whether blocks with the same indent level as the start block should be included
81
- * in the result.
82
- * @param options.lowerIndent Whether blocks with a lower indent level than the start block should be included
83
- * in the result.
84
- * @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
85
- * in the result.
86
- */
87
- static first(startElement: Node, options: {
88
- direction?: 'forward' | 'backward';
89
- includeSelf?: boolean;
90
- sameAttributes?: ArrayOrItem<string>;
91
- sameIndent?: boolean;
92
- lowerIndent?: boolean;
93
- higherIndent?: boolean;
94
- }): ListElement | null;
95
- /**
96
- * Iterable interface.
97
- */
98
- [Symbol.iterator](): Iterator<ListElement>;
99
- /**
100
- * Returns the model element to start iterating.
101
- */
102
- private _getStartNode;
103
- }
104
- /**
105
- * Iterates sibling list blocks starting from the given node.
106
- *
107
- * @internal
108
- * @param node The model node.
109
- * @param direction Iteration direction.
110
- * @returns The object with `node` and `previous` {@link module:engine/model/element~Element blocks}.
111
- */
112
- export declare function iterateSiblingListBlocks(node: Node | null, direction?: 'forward' | 'backward'): IterableIterator<ListIteratorValue>;
113
- /**
114
- * The iterable protocol over the list elements.
115
- *
116
- * @internal
117
- */
118
- export declare class ListBlocksIterable {
119
- private _listHead;
120
- /**
121
- * @param listHead The head element of a list.
122
- */
123
- constructor(listHead: Element);
124
- /**
125
- * List blocks iterator.
126
- *
127
- * Iterates over all blocks of a list.
128
- */
129
- [Symbol.iterator](): Iterator<ListIteratorValue>;
130
- }
131
- /**
132
- * Object returned by `iterateSiblingListBlocks()` when traversing a list.
133
- *
134
- * @internal
135
- */
136
- export interface ListIteratorValue {
137
- /**
138
- * The current list node.
139
- */
140
- node: ListElement;
141
- /**
142
- * The previous list node.
143
- */
144
- previous: ListElement | null;
145
- /**
146
- * The previous list node at the same indent as current node.
147
- */
148
- previousNodeInList: ListElement | null;
149
- }