@ckeditor/ckeditor5-list 41.1.0 → 41.3.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.
Files changed (190) hide show
  1. package/build/list.js +2 -2
  2. package/build/translations/ar.js +1 -1
  3. package/build/translations/ast.js +1 -1
  4. package/build/translations/az.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/ca.js +1 -1
  8. package/build/translations/cs.js +1 -1
  9. package/build/translations/da.js +1 -1
  10. package/build/translations/de-ch.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/en-gb.js +1 -1
  15. package/build/translations/eo.js +1 -1
  16. package/build/translations/es.js +1 -1
  17. package/build/translations/et.js +1 -1
  18. package/build/translations/eu.js +1 -1
  19. package/build/translations/fa.js +1 -1
  20. package/build/translations/fi.js +1 -1
  21. package/build/translations/fr.js +1 -1
  22. package/build/translations/gl.js +1 -1
  23. package/build/translations/he.js +1 -1
  24. package/build/translations/hi.js +1 -1
  25. package/build/translations/hr.js +1 -1
  26. package/build/translations/hu.js +1 -1
  27. package/build/translations/id.js +1 -1
  28. package/build/translations/it.js +1 -1
  29. package/build/translations/ja.js +1 -1
  30. package/build/translations/jv.js +1 -1
  31. package/build/translations/km.js +1 -1
  32. package/build/translations/kn.js +1 -1
  33. package/build/translations/ko.js +1 -1
  34. package/build/translations/ku.js +1 -1
  35. package/build/translations/lt.js +1 -1
  36. package/build/translations/lv.js +1 -1
  37. package/build/translations/ms.js +1 -1
  38. package/build/translations/nb.js +1 -1
  39. package/build/translations/ne.js +1 -1
  40. package/build/translations/nl.js +1 -1
  41. package/build/translations/no.js +1 -1
  42. package/build/translations/pl.js +1 -1
  43. package/build/translations/pt-br.js +1 -1
  44. package/build/translations/pt.js +1 -1
  45. package/build/translations/ro.js +1 -1
  46. package/build/translations/ru.js +1 -1
  47. package/build/translations/si.js +1 -1
  48. package/build/translations/sk.js +1 -1
  49. package/build/translations/sq.js +1 -1
  50. package/build/translations/sr-latn.js +1 -1
  51. package/build/translations/sr.js +1 -1
  52. package/build/translations/sv.js +1 -1
  53. package/build/translations/th.js +1 -1
  54. package/build/translations/tk.js +1 -1
  55. package/build/translations/tr.js +1 -1
  56. package/build/translations/tt.js +1 -1
  57. package/build/translations/ug.js +1 -1
  58. package/build/translations/uk.js +1 -1
  59. package/build/translations/ur.js +1 -1
  60. package/build/translations/uz.js +1 -1
  61. package/build/translations/vi.js +1 -1
  62. package/build/translations/zh-cn.js +1 -1
  63. package/build/translations/zh.js +1 -1
  64. package/dist/content-index.css +102 -0
  65. package/dist/editor-index.css +74 -0
  66. package/dist/index.css +228 -0
  67. package/dist/index.css.map +1 -0
  68. package/dist/index.js +7925 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/types/augmentation.d.ts +53 -0
  71. package/dist/types/documentlist.d.ts +28 -0
  72. package/dist/types/documentlistproperties.d.ts +28 -0
  73. package/dist/types/index.d.ts +45 -0
  74. package/dist/types/legacylist/legacyconverters.d.ts +196 -0
  75. package/dist/types/legacylist/legacyindentcommand.d.ts +37 -0
  76. package/dist/types/legacylist/legacylistcommand.d.ts +55 -0
  77. package/dist/types/legacylist/legacylistediting.d.ts +32 -0
  78. package/dist/types/legacylist/legacylistutils.d.ts +41 -0
  79. package/dist/types/legacylist/legacyutils.d.ts +101 -0
  80. package/dist/types/legacylist.d.ts +26 -0
  81. package/dist/types/legacylistproperties/legacylistpropertiesediting.d.ts +72 -0
  82. package/dist/types/legacylistproperties/legacylistreversedcommand.d.ts +38 -0
  83. package/dist/types/legacylistproperties/legacyliststartcommand.d.ts +37 -0
  84. package/dist/types/legacylistproperties/legacyliststylecommand.d.ts +67 -0
  85. package/dist/types/legacylistproperties.d.ts +27 -0
  86. package/dist/types/legacytodolist/legacychecktodolistcommand.d.ts +52 -0
  87. package/dist/types/legacytodolist/legacytodolistconverters.d.ts +83 -0
  88. package/dist/types/legacytodolist/legacytodolistediting.d.ts +39 -0
  89. package/dist/types/legacytodolist.d.ts +27 -0
  90. package/dist/types/list/adjacentlistssupport.d.ts +15 -0
  91. package/dist/types/list/converters.d.ts +65 -0
  92. package/dist/types/list/listcommand.d.ts +80 -0
  93. package/dist/types/list/listediting.d.ts +216 -0
  94. package/dist/types/list/listindentcommand.d.ts +62 -0
  95. package/dist/types/list/listmergecommand.d.ts +76 -0
  96. package/dist/types/list/listsplitcommand.d.ts +67 -0
  97. package/dist/types/list/listui.d.ts +19 -0
  98. package/dist/types/list/listutils.d.ts +46 -0
  99. package/dist/types/list/utils/listwalker.d.ts +145 -0
  100. package/dist/types/list/utils/model.d.ts +202 -0
  101. package/dist/types/list/utils/postfixers.d.ts +37 -0
  102. package/dist/types/list/utils/view.d.ts +81 -0
  103. package/dist/types/list/utils.d.ts +18 -0
  104. package/dist/types/list.d.ts +26 -0
  105. package/dist/types/listconfig.d.ts +132 -0
  106. package/dist/types/listproperties/converters.d.ts +19 -0
  107. package/dist/types/listproperties/listpropertiesediting.d.ts +88 -0
  108. package/dist/types/listproperties/listpropertiesui.d.ts +23 -0
  109. package/dist/types/listproperties/listpropertiesutils.d.ts +33 -0
  110. package/dist/types/listproperties/listreversedcommand.d.ts +36 -0
  111. package/dist/types/listproperties/liststartcommand.d.ts +38 -0
  112. package/dist/types/listproperties/liststylecommand.d.ts +72 -0
  113. package/dist/types/listproperties/ui/listpropertiesview.d.ts +156 -0
  114. package/dist/types/listproperties/utils/style.d.ts +20 -0
  115. package/dist/types/listproperties.d.ts +27 -0
  116. package/dist/types/tododocumentlist.d.ts +28 -0
  117. package/dist/types/todolist/checktodolistcommand.d.ts +49 -0
  118. package/dist/types/todolist/todocheckboxchangeobserver.d.ts +41 -0
  119. package/dist/types/todolist/todolistediting.d.ts +38 -0
  120. package/dist/types/todolist/todolistui.d.ts +19 -0
  121. package/dist/types/todolist.d.ts +27 -0
  122. package/lang/contexts.json +5 -1
  123. package/lang/translations/ar.po +16 -0
  124. package/lang/translations/ast.po +16 -0
  125. package/lang/translations/az.po +16 -0
  126. package/lang/translations/bg.po +16 -0
  127. package/lang/translations/bn.po +16 -0
  128. package/lang/translations/ca.po +16 -0
  129. package/lang/translations/cs.po +16 -0
  130. package/lang/translations/da.po +16 -0
  131. package/lang/translations/de-ch.po +16 -0
  132. package/lang/translations/de.po +16 -0
  133. package/lang/translations/el.po +16 -0
  134. package/lang/translations/en-au.po +16 -0
  135. package/lang/translations/en-gb.po +16 -0
  136. package/lang/translations/en.po +16 -0
  137. package/lang/translations/eo.po +16 -0
  138. package/lang/translations/es.po +16 -0
  139. package/lang/translations/et.po +16 -0
  140. package/lang/translations/eu.po +16 -0
  141. package/lang/translations/fa.po +16 -0
  142. package/lang/translations/fi.po +16 -0
  143. package/lang/translations/fr.po +16 -0
  144. package/lang/translations/gl.po +16 -0
  145. package/lang/translations/he.po +17 -1
  146. package/lang/translations/hi.po +16 -0
  147. package/lang/translations/hr.po +16 -0
  148. package/lang/translations/hu.po +16 -0
  149. package/lang/translations/id.po +16 -0
  150. package/lang/translations/it.po +16 -0
  151. package/lang/translations/ja.po +16 -0
  152. package/lang/translations/jv.po +16 -0
  153. package/lang/translations/km.po +16 -0
  154. package/lang/translations/kn.po +16 -0
  155. package/lang/translations/ko.po +16 -0
  156. package/lang/translations/ku.po +16 -0
  157. package/lang/translations/lt.po +16 -0
  158. package/lang/translations/lv.po +16 -0
  159. package/lang/translations/ms.po +16 -0
  160. package/lang/translations/nb.po +16 -0
  161. package/lang/translations/ne.po +16 -0
  162. package/lang/translations/nl.po +16 -0
  163. package/lang/translations/no.po +16 -0
  164. package/lang/translations/pl.po +16 -0
  165. package/lang/translations/pt-br.po +16 -0
  166. package/lang/translations/pt.po +27 -11
  167. package/lang/translations/ro.po +16 -0
  168. package/lang/translations/ru.po +16 -0
  169. package/lang/translations/si.po +16 -0
  170. package/lang/translations/sk.po +16 -0
  171. package/lang/translations/sq.po +16 -0
  172. package/lang/translations/sr-latn.po +16 -0
  173. package/lang/translations/sr.po +16 -0
  174. package/lang/translations/sv.po +16 -0
  175. package/lang/translations/th.po +16 -0
  176. package/lang/translations/tk.po +16 -0
  177. package/lang/translations/tr.po +16 -0
  178. package/lang/translations/tt.po +16 -0
  179. package/lang/translations/ug.po +16 -0
  180. package/lang/translations/uk.po +16 -0
  181. package/lang/translations/ur.po +16 -0
  182. package/lang/translations/uz.po +16 -0
  183. package/lang/translations/vi.po +16 -0
  184. package/lang/translations/zh-cn.po +16 -0
  185. package/lang/translations/zh.po +16 -0
  186. package/package.json +3 -2
  187. package/src/augmentation.d.ts +1 -1
  188. package/src/list/listediting.d.ts +4 -0
  189. package/src/list/listediting.js +22 -0
  190. package/src/listproperties/ui/listpropertiesview.js +3 -0
@@ -0,0 +1,72 @@
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
+ * @module list/legacylistproperties/legacylistpropertiesediting
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
+ import LegacyListEditing from '../legacylist/legacylistediting.js';
10
+ /**
11
+ * The engine of the list properties feature.
12
+ *
13
+ * It sets the value for the `listItem` attribute of the {@link module:list/legacylist~LegacyList `<listItem>`} element that
14
+ * allows modifying the list style type.
15
+ *
16
+ * It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they are enabled in the configuration.
17
+ * Read more in {@link module:list/listconfig~ListPropertiesConfig}.
18
+ */
19
+ export default class LegacyListPropertiesEditing extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires(): readonly [typeof LegacyListEditing];
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "LegacyListPropertiesEditing";
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ constructor(editor: Editor);
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init(): void;
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ afterInit(): void;
40
+ /**
41
+ * Starts listening to {@link module:engine/model/model~Model#deleteContent} and checks whether two lists will be merged into a single
42
+ * one after deleting the content.
43
+ *
44
+ * The purpose of this action is to adjust the `listStyle`, `listReversed` and `listStart` values
45
+ * for the list that was merged.
46
+ *
47
+ * Consider the following model's content:
48
+ *
49
+ * ```xml
50
+ * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 1</listItem>
51
+ * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 2</listItem>
52
+ * <paragraph>[A paragraph.]</paragraph>
53
+ * <listItem listIndent="0" listType="bulleted" listStyle="circle">UL List item 1</listItem>
54
+ * <listItem listIndent="0" listType="bulleted" listStyle="circle">UL List item 2</listItem>
55
+ * ```
56
+ *
57
+ * After removing the paragraph element, the second list will be merged into the first one.
58
+ * We want to inherit the `listStyle` attribute for the second list from the first one.
59
+ *
60
+ * ```xml
61
+ * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 1</listItem>
62
+ * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 2</listItem>
63
+ * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 1</listItem>
64
+ * <listItem listIndent="0" listType="bulleted" listStyle="square">UL List item 2</listItem>
65
+ * ```
66
+ *
67
+ * See https://github.com/ckeditor/ckeditor5/issues/7879.
68
+ *
69
+ * @param attributeStrategies Strategies for the enabled attributes.
70
+ */
71
+ private _mergeListAttributesWhileMergingLists;
72
+ }
@@ -0,0 +1,38 @@
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
+ * @module list/legacylistproperties/legacylistreversedcommand
7
+ */
8
+ import { Command } from 'ckeditor5/src/core.js';
9
+ /**
10
+ * The reversed list command. It changes the `listReversed` attribute of the selected list items. As a result, the list order will be
11
+ * reversed.
12
+ * It is used by the {@link module:list/legacylistproperties~LegacyListProperties legacy list properties feature}.
13
+ */
14
+ export default class LegacyListReversedCommand extends Command {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ value: boolean | null;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ refresh(): void;
23
+ /**
24
+ * Executes the command.
25
+ *
26
+ * @fires execute
27
+ * @param options.reversed Whether the list should be reversed.
28
+ */
29
+ execute(options?: {
30
+ reversed?: boolean;
31
+ }): void;
32
+ /**
33
+ * Checks the command's {@link #value}.
34
+ *
35
+ * @returns The current value.
36
+ */
37
+ private _getValue;
38
+ }
@@ -0,0 +1,37 @@
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
+ * @module list/legacylistproperties/legacyliststartcommand
7
+ */
8
+ import { Command } from 'ckeditor5/src/core.js';
9
+ /**
10
+ * The list start index command. It changes the `listStart` attribute of the selected list items.
11
+ * It is used by the {@link module:list/legacylistproperties~LegacyListProperties legacy list properties feature}.
12
+ */
13
+ export default class LegacyListStartCommand extends Command {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ value: number | null;
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ refresh(): void;
22
+ /**
23
+ * Executes the command.
24
+ *
25
+ * @fires execute
26
+ * @param options.startIndex The list start index.
27
+ */
28
+ execute({ startIndex }?: {
29
+ startIndex?: number;
30
+ }): void;
31
+ /**
32
+ * Checks the command's {@link #value}.
33
+ *
34
+ * @returns The current value.
35
+ */
36
+ private _getValue;
37
+ }
@@ -0,0 +1,67 @@
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
+ * @module list/legacylistproperties/legacyliststylecommand
7
+ */
8
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
9
+ /**
10
+ * The list style command. It changes the `listStyle` attribute of the selected list items.
11
+ *
12
+ * If the list type (numbered or bulleted) can be inferred from the passed style type,
13
+ * the command tries to convert selected items to a list of that type.
14
+ * It is used by the {@link module:list/legacylistproperties~LegacyListProperties legacy list properties feature}.
15
+ */
16
+ export default class LegacyListStyleCommand extends Command {
17
+ isStyleTypeSupported: undefined;
18
+ /**
19
+ * @inheritDoc
20
+ * @readonly
21
+ */
22
+ value: string | null;
23
+ /**
24
+ * The default type of the list style.
25
+ */
26
+ readonly defaultType: string;
27
+ /**
28
+ * Creates an instance of the command.
29
+ *
30
+ * @param editor The editor instance.
31
+ * @param defaultType The list type that will be used by default if the value was not specified during
32
+ * the command execution.
33
+ */
34
+ constructor(editor: Editor, defaultType: string);
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ refresh(): void;
39
+ /**
40
+ * Executes the command.
41
+ *
42
+ * @fires execute
43
+ * @param options.type The type of the list style, e.g. `'disc'` or `'square'`. If `null` is specified, the default
44
+ * style will be applied.
45
+ */
46
+ execute(options?: {
47
+ type?: string | null;
48
+ }): void;
49
+ /**
50
+ * Checks the command's {@link #value}.
51
+ *
52
+ * @returns The current value.
53
+ */
54
+ private _getValue;
55
+ /**
56
+ * Checks whether the command can be enabled in the current context.
57
+ *
58
+ * @returns Whether the command should be enabled.
59
+ */
60
+ private _checkEnabled;
61
+ /**
62
+ * Checks if the provided list style is valid. Also changes the selection to a list if it's not set yet.
63
+ *
64
+ * @param The type of the list style. If `null` is specified, the function does nothing.
65
+ */
66
+ private _tryToConvertItemsToList;
67
+ }
@@ -0,0 +1,27 @@
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
+ * @module list/legacylistproperties
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import LegacyListPropertiesEditing from './legacylistproperties/legacylistpropertiesediting.js';
10
+ import ListPropertiesUI from './listproperties/listpropertiesui.js';
11
+ /**
12
+ * The legacy list properties feature.
13
+ *
14
+ * This is a "glue" plugin that loads the {@link module:list/legacylistproperties/legacylistpropertiesediting~LegacyListPropertiesEditing
15
+ * legacy list properties editing feature} and the
16
+ * {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
17
+ */
18
+ export default class LegacyListProperties extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof LegacyListPropertiesEditing, typeof ListPropertiesUI];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "LegacyListProperties";
27
+ }
@@ -0,0 +1,52 @@
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
+ * @module list/legacytodolist/legacychecktodolistcommand
7
+ */
8
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
9
+ import type { Element } from 'ckeditor5/src/engine.js';
10
+ /**
11
+ * The check to-do command.
12
+ *
13
+ * The command is registered by the {@link module:list/legacytodolist/legacytodolistediting~LegacyTodoListEditing} as
14
+ * the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
15
+ */
16
+ export default class LegacyCheckTodoListCommand extends Command {
17
+ /**
18
+ * A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
19
+ *
20
+ * @observable
21
+ * @readonly
22
+ */
23
+ value: boolean;
24
+ /**
25
+ * A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
26
+ *
27
+ * @internal
28
+ */
29
+ _selectedElements: Array<Element>;
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ constructor(editor: Editor);
34
+ /**
35
+ * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
36
+ */
37
+ refresh(): void;
38
+ /**
39
+ * Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
40
+ */
41
+ private _getSelectedItems;
42
+ /**
43
+ * Executes the command.
44
+ *
45
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
46
+ * the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
47
+ * value to decide what it should do.
48
+ */
49
+ execute(options?: {
50
+ forceValue?: boolean;
51
+ }): void;
52
+ }
@@ -0,0 +1,83 @@
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
+ * @module list/legacytodolist/legacytodolistconverters
7
+ */
8
+ import type { DowncastAttributeEvent, DowncastInsertEvent, Element, MapperModelToViewPositionEvent, Model, UpcastElementEvent, EditingView } from 'ckeditor5/src/engine.js';
9
+ import { type GetCallback } from 'ckeditor5/src/utils.js';
10
+ /**
11
+ * A model-to-view converter for the `listItem` model element insertion.
12
+ *
13
+ * It converts the `listItem` model element to an unordered list with a {@link module:engine/view/uielement~UIElement checkbox element}
14
+ * at the beginning of each list item. It also merges the list with surrounding lists (if available).
15
+ *
16
+ * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
17
+ *
18
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
19
+ * @param model Model instance.
20
+ * @param onCheckboxChecked Callback function.
21
+ * @returns Returns a conversion callback.
22
+ */
23
+ export declare function modelViewInsertion(model: Model, onCheckboxChecked: (element: Element) => void): GetCallback<DowncastInsertEvent<Element>>;
24
+ /**
25
+ * A model-to-view converter for the `listItem` model element insertion.
26
+ *
27
+ * It is used by {@link module:engine/controller/datacontroller~DataController}.
28
+ *
29
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
30
+ * @param model Model instance.
31
+ * @returns Returns a conversion callback.
32
+ */
33
+ export declare function dataModelViewInsertion(model: Model): GetCallback<DowncastInsertEvent<Element>>;
34
+ /**
35
+ * A view-to-model converter for the checkbox element inside a view list item.
36
+ *
37
+ * It changes the `listType` of the model `listItem` to a `todo` value.
38
+ * When a view checkbox element is marked as checked, an additional `todoListChecked="true"` attribute is added to the model item.
39
+ *
40
+ * It is used by {@link module:engine/controller/datacontroller~DataController}.
41
+ *
42
+ * @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
43
+ */
44
+ export declare const dataViewModelCheckmarkInsertion: GetCallback<UpcastElementEvent>;
45
+ /**
46
+ * A model-to-view converter for the `listType` attribute change on the `listItem` model element.
47
+ *
48
+ * This change means that the `<li>` element parent changes to `<ul class="todo-list">` and a
49
+ * {@link module:engine/view/uielement~UIElement checkbox UI element} is added at the beginning
50
+ * of the list item element (or vice versa).
51
+ *
52
+ * This converter is preceded by {@link module:list/legacylist/legacyconverters~modelViewChangeType} and followed by
53
+ * {@link module:list/legacylist/legacyconverters~modelViewMergeAfterChangeType} to handle splitting and merging surrounding lists
54
+ * of the same type.
55
+ *
56
+ * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
57
+ *
58
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
59
+ * @param onCheckedChange Callback fired after clicking the checkbox UI element.
60
+ * @param view Editing view controller.
61
+ * @returns Returns a conversion callback.
62
+ */
63
+ export declare function modelViewChangeType(onCheckedChange: (element: Element) => void, view: EditingView): GetCallback<DowncastAttributeEvent<Element>>;
64
+ /**
65
+ * A model-to-view converter for the `todoListChecked` attribute change on the `listItem` model element.
66
+ *
67
+ * It marks the {@link module:engine/view/uielement~UIElement checkbox UI element} as checked.
68
+ *
69
+ * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
70
+ *
71
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
72
+ * @param onCheckedChange Callback fired after clicking the checkbox UI element.
73
+ * @returns Returns a conversion callback.
74
+ */
75
+ export declare function modelViewChangeChecked(onCheckedChange: (element: Element) => void): GetCallback<DowncastAttributeEvent<Element>>;
76
+ /**
77
+ * A model-to-view position at zero offset mapper.
78
+ *
79
+ * This helper ensures that position inside todo-list in the view is mapped after the checkbox.
80
+ *
81
+ * It only handles the position at the beginning of a list item as other positions are properly mapped be the default mapper.
82
+ */
83
+ export declare function mapModelToViewPosition(view: EditingView): GetCallback<MapperModelToViewPositionEvent>;
@@ -0,0 +1,39 @@
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
+ import { Plugin } from 'ckeditor5/src/core.js';
6
+ import LegacyListEditing from '../legacylist/legacylistediting.js';
7
+ /**
8
+ * The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
9
+ *
10
+ * It registers the entire functionality of the {@link module:list/legacylist/legacylistediting~LegacyListEditing legacy list editing
11
+ * plugin} and extends it with the commands:
12
+ *
13
+ * - `'todoList'`,
14
+ * - `'checkTodoList'`,
15
+ * - `'todoListCheck'` as an alias for `checkTodoList` command.
16
+ */
17
+ export default class LegacyTodoListEditing extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "LegacyTodoListEditing";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): readonly [typeof LegacyListEditing];
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init(): void;
30
+ /**
31
+ * Handles the checkbox element change, moves the selection to the corresponding model item to make it possible
32
+ * to toggle the `todoListChecked` attribute using the command, and restores the selection position.
33
+ *
34
+ * Some say it's a hack :) Moving the selection only for executing the command on a certain node and restoring it after,
35
+ * is not a clear solution. We need to design an API for using commands beyond the selection range.
36
+ * See https://github.com/ckeditor/ckeditor5/issues/1954.
37
+ */
38
+ private _handleCheckmarkChange;
39
+ }
@@ -0,0 +1,27 @@
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
+ * @module list/legacytodolist
7
+ */
8
+ import LegacyTodoListEditing from './legacytodolist/legacytodolistediting.js';
9
+ import TodoListUI from './todolist/todolistui.js';
10
+ import { Plugin } from 'ckeditor5/src/core.js';
11
+ import '../theme/todolist.css';
12
+ /**
13
+ * The legacy to-do list feature.
14
+ *
15
+ * This is a "glue" plugin that loads the {@link module:list/legacytodolist/legacytodolistediting~LegacyTodoListEditing legacy to-do list
16
+ * editing feature} and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
17
+ */
18
+ export default class LegacyTodoList extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof LegacyTodoListEditing, typeof TodoListUI];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "LegacyTodoList";
27
+ }
@@ -0,0 +1,15 @@
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
+ import { Plugin } from 'ckeditor5/src/core.js';
6
+ export default class AdjacentListsSupport extends Plugin {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ static get pluginName(): "AdjacentListsSupport";
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ init(): void;
15
+ }
@@ -0,0 +1,65 @@
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
+ * @module list/list/converters
7
+ */
8
+ import { type DowncastAttributeEvent, type EditingController, type Element, type ElementCreatorFunction, type Mapper, type Model, type UpcastElementEvent, type ViewElement } from 'ckeditor5/src/engine.js';
9
+ import type { GetCallback } from 'ckeditor5/src/utils.js';
10
+ import { type ListElement } from './utils/model.js';
11
+ import type { default as ListEditing, DowncastStrategy } from './listediting.js';
12
+ /**
13
+ * Returns the upcast converter for list items. It's supposed to work after the block converters (content inside list items) are converted.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare function listItemUpcastConverter(): GetCallback<UpcastElementEvent>;
18
+ /**
19
+ * Returns the upcast converter for the `<ul>` and `<ol>` view elements that cleans the input view of garbage.
20
+ * This is mostly to clean whitespaces from between the `<li>` view elements inside the view list element. However,
21
+ * incorrect data can also be cleared if the view was incorrect.
22
+ *
23
+ * @internal
24
+ */
25
+ export declare function listUpcastCleanList(): GetCallback<UpcastElementEvent>;
26
+ /**
27
+ * Returns a model document change:data event listener that triggers conversion of related items if needed.
28
+ *
29
+ * @internal
30
+ * @param model The editor model.
31
+ * @param editing The editing controller.
32
+ * @param attributeNames The list of all model list attributes (including registered strategies).
33
+ * @param listEditing The document list editing plugin.
34
+ */
35
+ export declare function reconvertItemsOnDataChange(model: Model, editing: EditingController, attributeNames: Array<string>, listEditing: ListEditing): () => void;
36
+ /**
37
+ * Returns the list item downcast converter.
38
+ *
39
+ * @internal
40
+ * @param attributeNames A list of attribute names that should be converted if they are set.
41
+ * @param strategies The strategies.
42
+ * @param model The model.
43
+ */
44
+ export declare function listItemDowncastConverter(attributeNames: Array<string>, strategies: Array<DowncastStrategy>, model: Model, { dataPipeline }?: {
45
+ dataPipeline?: boolean;
46
+ }): GetCallback<DowncastAttributeEvent<ListElement>>;
47
+ /**
48
+ * Returns the bogus paragraph view element creator. A bogus paragraph is used if a list item contains only a single block or nested list.
49
+ *
50
+ * @internal
51
+ * @param attributeNames The list of all model list attributes (including registered strategies).
52
+ */
53
+ export declare function bogusParagraphCreator(attributeNames: Array<string>, { dataPipeline }?: {
54
+ dataPipeline?: boolean;
55
+ }): ElementCreatorFunction;
56
+ /**
57
+ * Helper for mapping mode to view elements. It's using positions mapping instead of mapper.toViewElement( element )
58
+ * to find outermost view element. This is for cases when mapping is using inner view element like in the code blocks (pre > code).
59
+ *
60
+ * @internal
61
+ * @param element The model element.
62
+ * @param mapper The mapper instance.
63
+ * @param model The model.
64
+ */
65
+ export declare function findMappedViewElement(element: Element, mapper: Mapper, model: Model): ViewElement | null;
@@ -0,0 +1,80 @@
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
+ * @module list/list/listcommand
7
+ */
8
+ import type { Element } from 'ckeditor5/src/engine.js';
9
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
10
+ /**
11
+ * The list command. It is used by the {@link module:list/list~List list feature}.
12
+ */
13
+ export default class ListCommand extends Command {
14
+ /**
15
+ * The type of the list created by the command.
16
+ */
17
+ readonly type: 'numbered' | 'bulleted' | 'todo';
18
+ /**
19
+ * A flag indicating whether the command is active, which means that the selection starts in a list of the same type.
20
+ *
21
+ * @observable
22
+ * @readonly
23
+ */
24
+ value: boolean;
25
+ /**
26
+ * Creates an instance of the command.
27
+ *
28
+ * @param editor The editor instance.
29
+ * @param type List type that will be handled by this command.
30
+ */
31
+ constructor(editor: Editor, type: 'numbered' | 'bulleted' | 'todo');
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ refresh(): void;
36
+ /**
37
+ * Executes the list command.
38
+ *
39
+ * @fires execute
40
+ * @fires afterExecute
41
+ * @param options Command options.
42
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will try to convert the
43
+ * selected items and potentially the neighbor elements to the proper list items. If set to `false` it will convert selected elements
44
+ * to paragraphs. If not set, the command will toggle selected elements to list items or paragraphs, depending on the selection.
45
+ */
46
+ execute(options?: {
47
+ forceValue?: boolean;
48
+ }): void;
49
+ /**
50
+ * Fires the `afterExecute` event.
51
+ *
52
+ * @param changedBlocks The changed list elements.
53
+ */
54
+ private _fireAfterExecute;
55
+ /**
56
+ * Checks the command's {@link #value}.
57
+ *
58
+ * @returns The current value.
59
+ */
60
+ private _getValue;
61
+ /**
62
+ * Checks whether the command can be enabled in the current context.
63
+ *
64
+ * @returns Whether the command should be enabled.
65
+ */
66
+ private _checkEnabled;
67
+ }
68
+ /**
69
+ * Event fired by the {@link ~ListCommand#execute} method.
70
+ *
71
+ * It allows to execute an action after executing the {@link ~ListCommand#execute} method,
72
+ * for example adjusting attributes of changed list items.
73
+ *
74
+ * @internal
75
+ * @eventName ~ListCommand#afterExecute
76
+ */
77
+ export type ListCommandAfterExecuteEvent = {
78
+ name: 'afterExecute';
79
+ args: [changedBlocks: Array<Element>];
80
+ };