@ckeditor/ckeditor5-list 40.2.0 → 41.0.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 (196) hide show
  1. package/CHANGELOG.md +25 -25
  2. package/LICENSE.md +1 -1
  3. package/build/list.js +2 -2
  4. package/build/translations/ug.js +1 -1
  5. package/ckeditor5-metadata.json +34 -34
  6. package/lang/translations/ar.po +1 -1
  7. package/lang/translations/ast.po +1 -1
  8. package/lang/translations/az.po +1 -1
  9. package/lang/translations/bg.po +1 -1
  10. package/lang/translations/bn.po +1 -1
  11. package/lang/translations/ca.po +1 -1
  12. package/lang/translations/cs.po +1 -1
  13. package/lang/translations/da.po +1 -1
  14. package/lang/translations/de-ch.po +1 -1
  15. package/lang/translations/de.po +1 -1
  16. package/lang/translations/el.po +1 -1
  17. package/lang/translations/en-au.po +1 -1
  18. package/lang/translations/en-gb.po +1 -1
  19. package/lang/translations/en.po +1 -1
  20. package/lang/translations/eo.po +1 -1
  21. package/lang/translations/es.po +1 -1
  22. package/lang/translations/et.po +1 -1
  23. package/lang/translations/eu.po +1 -1
  24. package/lang/translations/fa.po +1 -1
  25. package/lang/translations/fi.po +1 -1
  26. package/lang/translations/fr.po +1 -1
  27. package/lang/translations/gl.po +1 -1
  28. package/lang/translations/he.po +1 -1
  29. package/lang/translations/hi.po +1 -1
  30. package/lang/translations/hr.po +1 -1
  31. package/lang/translations/hu.po +1 -1
  32. package/lang/translations/id.po +1 -1
  33. package/lang/translations/it.po +1 -1
  34. package/lang/translations/ja.po +1 -1
  35. package/lang/translations/jv.po +1 -1
  36. package/lang/translations/km.po +1 -1
  37. package/lang/translations/kn.po +1 -1
  38. package/lang/translations/ko.po +1 -1
  39. package/lang/translations/ku.po +1 -1
  40. package/lang/translations/lt.po +1 -1
  41. package/lang/translations/lv.po +1 -1
  42. package/lang/translations/ms.po +1 -1
  43. package/lang/translations/nb.po +1 -1
  44. package/lang/translations/ne.po +1 -1
  45. package/lang/translations/nl.po +1 -1
  46. package/lang/translations/no.po +1 -1
  47. package/lang/translations/pl.po +1 -1
  48. package/lang/translations/pt-br.po +1 -1
  49. package/lang/translations/pt.po +1 -1
  50. package/lang/translations/ro.po +1 -1
  51. package/lang/translations/ru.po +1 -1
  52. package/lang/translations/si.po +1 -1
  53. package/lang/translations/sk.po +1 -1
  54. package/lang/translations/sq.po +1 -1
  55. package/lang/translations/sr-latn.po +1 -1
  56. package/lang/translations/sr.po +1 -1
  57. package/lang/translations/sv.po +1 -1
  58. package/lang/translations/th.po +1 -1
  59. package/lang/translations/tk.po +1 -1
  60. package/lang/translations/tr.po +1 -1
  61. package/lang/translations/tt.po +1 -1
  62. package/lang/translations/ug.po +8 -8
  63. package/lang/translations/uk.po +1 -1
  64. package/lang/translations/ur.po +1 -1
  65. package/lang/translations/uz.po +1 -1
  66. package/lang/translations/vi.po +1 -1
  67. package/lang/translations/zh-cn.po +1 -1
  68. package/lang/translations/zh.po +1 -1
  69. package/package.json +3 -2
  70. package/src/augmentation.d.ts +29 -28
  71. package/src/augmentation.js +1 -1
  72. package/src/documentlist.d.ts +9 -7
  73. package/src/documentlist.js +18 -7
  74. package/src/documentlistproperties.d.ts +9 -8
  75. package/src/documentlistproperties.js +18 -8
  76. package/src/index.d.ts +39 -37
  77. package/src/index.js +32 -23
  78. package/src/legacylist/legacyconverters.d.ts +196 -0
  79. package/src/legacylist/legacyconverters.js +905 -0
  80. package/src/{list/indentcommand.d.ts → legacylist/legacyindentcommand.d.ts} +4 -4
  81. package/src/{list/indentcommand.js → legacylist/legacyindentcommand.js} +5 -5
  82. package/src/{documentlist/documentlistcommand.d.ts → legacylist/legacylistcommand.d.ts} +5 -30
  83. package/src/legacylist/legacylistcommand.js +274 -0
  84. package/src/legacylist/legacylistediting.d.ts +32 -0
  85. package/src/legacylist/legacylistediting.js +161 -0
  86. package/src/legacylist/legacylistutils.d.ts +41 -0
  87. package/src/legacylist/legacylistutils.js +46 -0
  88. package/src/legacylist/legacyutils.d.ts +101 -0
  89. package/src/legacylist/legacyutils.js +347 -0
  90. package/src/legacylist.d.ts +26 -0
  91. package/src/legacylist.js +30 -0
  92. package/src/legacylistproperties/legacylistpropertiesediting.d.ts +72 -0
  93. package/src/legacylistproperties/legacylistpropertiesediting.js +696 -0
  94. package/src/legacylistproperties/legacylistreversedcommand.d.ts +38 -0
  95. package/src/legacylistproperties/legacylistreversedcommand.js +52 -0
  96. package/src/{documentlistproperties/documentliststartcommand.d.ts → legacylistproperties/legacyliststartcommand.d.ts} +6 -7
  97. package/src/legacylistproperties/legacyliststartcommand.js +51 -0
  98. package/src/{documentlistproperties/documentliststylecommand.d.ts → legacylistproperties/legacyliststylecommand.d.ts} +14 -19
  99. package/src/{documentlistproperties/documentliststylecommand.js → legacylistproperties/legacyliststylecommand.js} +22 -36
  100. package/src/legacylistproperties.d.ts +27 -0
  101. package/src/legacylistproperties.js +31 -0
  102. package/src/{tododocumentlist/checktododocumentlistcommand.d.ts → legacytodolist/legacychecktodolistcommand.d.ts} +17 -14
  103. package/src/{tododocumentlist/checktododocumentlistcommand.js → legacytodolist/legacychecktodolistcommand.js} +34 -40
  104. package/src/{todolist/todolistconverters.d.ts → legacytodolist/legacytodolistconverters.d.ts} +9 -8
  105. package/src/{todolist/todolistconverters.js → legacytodolist/legacytodolistconverters.js} +6 -5
  106. package/src/{tododocumentlist/tododocumentlistediting.d.ts → legacytodolist/legacytodolistediting.d.ts} +9 -8
  107. package/src/legacytodolist/legacytodolistediting.js +161 -0
  108. package/src/legacytodolist.d.ts +27 -0
  109. package/src/legacytodolist.js +31 -0
  110. package/src/{documentlist → list}/adjacentlistssupport.d.ts +2 -2
  111. package/src/{documentlist → list}/adjacentlistssupport.js +9 -9
  112. package/src/list/converters.d.ts +41 -172
  113. package/src/list/converters.js +357 -821
  114. package/src/list/listcommand.d.ts +28 -3
  115. package/src/list/listcommand.js +81 -205
  116. package/src/list/listediting.d.ts +189 -9
  117. package/src/list/listediting.js +592 -107
  118. package/src/{documentlist/documentlistindentcommand.d.ts → list/listindentcommand.d.ts} +10 -10
  119. package/src/{documentlist/documentlistindentcommand.js → list/listindentcommand.js} +7 -7
  120. package/src/{documentlist/documentlistmergecommand.d.ts → list/listmergecommand.d.ts} +10 -10
  121. package/src/{documentlist/documentlistmergecommand.js → list/listmergecommand.js} +7 -7
  122. package/src/{documentlist/documentlistsplitcommand.d.ts → list/listsplitcommand.d.ts} +10 -10
  123. package/src/{documentlist/documentlistsplitcommand.js → list/listsplitcommand.js} +5 -5
  124. package/src/list/listui.d.ts +2 -2
  125. package/src/list/listui.js +5 -7
  126. package/src/list/listutils.d.ts +22 -17
  127. package/src/list/listutils.js +24 -20
  128. package/src/{documentlist → list}/utils/listwalker.d.ts +5 -5
  129. package/src/{documentlist → list}/utils/listwalker.js +4 -4
  130. package/src/{documentlist → list}/utils/model.d.ts +4 -4
  131. package/src/{documentlist → list}/utils/model.js +3 -3
  132. package/src/{documentlist → list}/utils/postfixers.d.ts +5 -5
  133. package/src/{documentlist → list}/utils/postfixers.js +3 -3
  134. package/src/{documentlist → list}/utils/view.d.ts +3 -3
  135. package/src/{documentlist → list}/utils/view.js +1 -1
  136. package/src/list/utils.d.ts +2 -96
  137. package/src/list/utils.js +2 -342
  138. package/src/list.d.ts +6 -6
  139. package/src/list.js +6 -6
  140. package/src/listconfig.d.ts +10 -10
  141. package/src/listconfig.js +1 -1
  142. package/src/{documentlistproperties → listproperties}/converters.d.ts +5 -5
  143. package/src/{documentlistproperties → listproperties}/converters.js +1 -1
  144. package/src/listproperties/listpropertiesediting.d.ts +56 -40
  145. package/src/listproperties/listpropertiesediting.js +145 -575
  146. package/src/listproperties/listpropertiesui.d.ts +2 -2
  147. package/src/listproperties/listpropertiesui.js +6 -8
  148. package/src/{documentlistproperties/documentlistpropertiesutils.d.ts → listproperties/listpropertiesutils.d.ts} +5 -5
  149. package/src/{documentlistproperties/documentlistpropertiesutils.js → listproperties/listpropertiesutils.js} +6 -6
  150. package/src/listproperties/listreversedcommand.d.ts +4 -6
  151. package/src/listproperties/listreversedcommand.js +17 -14
  152. package/src/listproperties/liststartcommand.d.ts +4 -3
  153. package/src/listproperties/liststartcommand.js +17 -11
  154. package/src/listproperties/liststylecommand.d.ts +16 -11
  155. package/src/listproperties/liststylecommand.js +33 -19
  156. package/src/listproperties/ui/listpropertiesview.d.ts +5 -5
  157. package/src/listproperties/ui/listpropertiesview.js +3 -3
  158. package/src/{documentlistproperties → listproperties}/utils/style.d.ts +1 -1
  159. package/src/{documentlistproperties → listproperties}/utils/style.js +2 -2
  160. package/src/listproperties.d.ts +6 -5
  161. package/src/listproperties.js +6 -5
  162. package/src/tododocumentlist.d.ts +9 -8
  163. package/src/tododocumentlist.js +18 -8
  164. package/src/todolist/checktodolistcommand.d.ts +11 -14
  165. package/src/todolist/checktodolistcommand.js +37 -31
  166. package/src/{tododocumentlist → todolist}/todocheckboxchangeobserver.d.ts +6 -6
  167. package/src/{tododocumentlist → todolist}/todocheckboxchangeobserver.js +3 -3
  168. package/src/todolist/todolistediting.d.ts +5 -6
  169. package/src/todolist/todolistediting.js +314 -76
  170. package/src/todolist/todolistui.d.ts +2 -2
  171. package/src/todolist/todolistui.js +4 -5
  172. package/src/todolist.d.ts +6 -6
  173. package/src/todolist.js +6 -6
  174. package/theme/documentlist.css +1 -1
  175. package/theme/list.css +1 -1
  176. package/theme/listproperties.css +1 -1
  177. package/theme/liststyles.css +1 -1
  178. package/theme/todolist.css +1 -1
  179. package/src/documentlist/converters.d.ts +0 -65
  180. package/src/documentlist/converters.js +0 -441
  181. package/src/documentlist/documentlistcommand.js +0 -150
  182. package/src/documentlist/documentlistediting.d.ts +0 -212
  183. package/src/documentlist/documentlistediting.js +0 -646
  184. package/src/documentlist/documentlistutils.d.ts +0 -46
  185. package/src/documentlist/documentlistutils.js +0 -50
  186. package/src/documentlistproperties/documentlistpropertiesediting.d.ts +0 -88
  187. package/src/documentlistproperties/documentlistpropertiesediting.js +0 -266
  188. package/src/documentlistproperties/documentlistreversedcommand.d.ts +0 -36
  189. package/src/documentlistproperties/documentlistreversedcommand.js +0 -55
  190. package/src/documentlistproperties/documentliststartcommand.js +0 -57
  191. package/src/liststyle.d.ts +0 -28
  192. package/src/liststyle.js +0 -36
  193. package/src/tododocumentlist/tododocumentlistediting.js +0 -399
  194. package/theme/icons/bulletedlist.svg +0 -1
  195. package/theme/icons/numberedlist.svg +0 -1
  196. package/theme/icons/todolist.svg +0 -1
@@ -1,17 +1,16 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module list/todolist/checktodolistcommand
7
7
  */
8
- import { Command, type Editor } from 'ckeditor5/src/core';
9
- import type { Element } from 'ckeditor5/src/engine';
8
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
10
9
  /**
11
10
  * The check to-do command.
12
11
  *
13
12
  * The command is registered by the {@link module:list/todolist/todolistediting~TodoListEditing} as
14
- * the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
13
+ * the `checkTodoList` editor command.
15
14
  */
16
15
  export default class CheckTodoListCommand extends Command {
17
16
  /**
@@ -21,12 +20,6 @@ export default class CheckTodoListCommand extends Command {
21
20
  * @readonly
22
21
  */
23
22
  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
23
  /**
31
24
  * @inheritDoc
32
25
  */
@@ -35,10 +28,6 @@ export default class CheckTodoListCommand extends Command {
35
28
  * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
36
29
  */
37
30
  refresh(): void;
38
- /**
39
- * Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
40
- */
41
- private _getSelectedItems;
42
31
  /**
43
32
  * Executes the command.
44
33
  *
@@ -49,4 +38,12 @@ export default class CheckTodoListCommand extends Command {
49
38
  execute(options?: {
50
39
  forceValue?: boolean;
51
40
  }): void;
41
+ /**
42
+ * Returns a value for the command.
43
+ */
44
+ private _getValue;
45
+ /**
46
+ * Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
47
+ */
48
+ private _getSelectedItems;
52
49
  }
@@ -1,17 +1,17 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module list/todolist/checktodolistcommand
7
7
  */
8
- import { Command } from 'ckeditor5/src/core';
9
- const attributeKey = 'todoListChecked';
8
+ import { Command } from 'ckeditor5/src/core.js';
9
+ import { getAllListItemBlocks } from '../list/utils/model.js';
10
10
  /**
11
11
  * The check to-do command.
12
12
  *
13
13
  * The command is registered by the {@link module:list/todolist/todolistediting~TodoListEditing} as
14
- * the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
14
+ * the `checkTodoList` editor command.
15
15
  */
16
16
  export default class CheckTodoListCommand extends Command {
17
17
  /**
@@ -19,7 +19,6 @@ export default class CheckTodoListCommand extends Command {
19
19
  */
20
20
  constructor(editor) {
21
21
  super(editor);
22
- this._selectedElements = [];
23
22
  // Refresh command before executing to be sure all values are up to date.
24
23
  // It is needed when selection has changed before command execution, in the same change block.
25
24
  this.on('execute', () => {
@@ -30,28 +29,9 @@ export default class CheckTodoListCommand extends Command {
30
29
  * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
31
30
  */
32
31
  refresh() {
33
- this._selectedElements = this._getSelectedItems();
34
- this.value = this._selectedElements.every(element => !!element.getAttribute(attributeKey));
35
- this.isEnabled = !!this._selectedElements.length;
36
- }
37
- /**
38
- * Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
39
- */
40
- _getSelectedItems() {
41
- const model = this.editor.model;
42
- const schema = model.schema;
43
- const selectionRange = model.document.selection.getFirstRange();
44
- const startElement = selectionRange.start.parent;
45
- const elements = [];
46
- if (schema.checkAttribute(startElement, attributeKey)) {
47
- elements.push(startElement);
48
- }
49
- for (const item of selectionRange.getItems()) {
50
- if (schema.checkAttribute(item, attributeKey) && !elements.includes(item)) {
51
- elements.push(item);
52
- }
53
- }
54
- return elements;
32
+ const selectedElements = this._getSelectedItems();
33
+ this.value = this._getValue(selectedElements);
34
+ this.isEnabled = !!selectedElements.length;
55
35
  }
56
36
  /**
57
37
  * Executes the command.
@@ -62,15 +42,41 @@ export default class CheckTodoListCommand extends Command {
62
42
  */
63
43
  execute(options = {}) {
64
44
  this.editor.model.change(writer => {
65
- for (const element of this._selectedElements) {
66
- const value = (options.forceValue === undefined) ? !this.value : options.forceValue;
45
+ const selectedElements = this._getSelectedItems();
46
+ const value = (options.forceValue === undefined) ? !this._getValue(selectedElements) : options.forceValue;
47
+ for (const element of selectedElements) {
67
48
  if (value) {
68
- writer.setAttribute(attributeKey, true, element);
49
+ writer.setAttribute('todoListChecked', true, element);
69
50
  }
70
51
  else {
71
- writer.removeAttribute(attributeKey, element);
52
+ writer.removeAttribute('todoListChecked', element);
72
53
  }
73
54
  }
74
55
  });
75
56
  }
57
+ /**
58
+ * Returns a value for the command.
59
+ */
60
+ _getValue(selectedElements) {
61
+ return selectedElements.every(element => element.getAttribute('todoListChecked'));
62
+ }
63
+ /**
64
+ * Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
65
+ */
66
+ _getSelectedItems() {
67
+ const model = this.editor.model;
68
+ const schema = model.schema;
69
+ const selectionRange = model.document.selection.getFirstRange();
70
+ const startElement = selectionRange.start.parent;
71
+ const elements = [];
72
+ if (schema.checkAttribute(startElement, 'todoListChecked')) {
73
+ elements.push(...getAllListItemBlocks(startElement));
74
+ }
75
+ for (const item of selectionRange.getItems({ shallow: true })) {
76
+ if (schema.checkAttribute(item, 'todoListChecked') && !elements.includes(item)) {
77
+ elements.push(...getAllListItemBlocks(item));
78
+ }
79
+ }
80
+ return elements;
81
+ }
76
82
  }
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
- * @module list/tododocumentlist/todocheckboxchangeobserver
6
+ * @module list/todolist/todocheckboxchangeobserver
7
7
  */
8
- import { DomEventObserver, type DomEventData } from 'ckeditor5/src/engine';
8
+ import { DomEventObserver, type DomEventData } from 'ckeditor5/src/engine.js';
9
9
  /**
10
10
  * Observes all to-do list checkboxes state changes.
11
11
  *
@@ -25,13 +25,13 @@ export default class TodoCheckboxChangeObserver extends DomEventObserver<'change
25
25
  /**
26
26
  * Fired when the to-do list checkbox is toggled.
27
27
  *
28
- * Introduced by {@link module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}.
28
+ * Introduced by {@link module:list/todolist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}.
29
29
  *
30
30
  * Note that this event is not available by default. To make it available,
31
- * {@link module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}
31
+ * {@link module:list/todolist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}
32
32
  * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
33
33
  *
34
- * @see module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver
34
+ * @see module:list/todolist/todocheckboxchangeobserver~TodoCheckboxChangeObserver
35
35
  * @eventName module:engine/view/document~Document#todoCheckboxChange
36
36
  * @param data The event data.
37
37
  */
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
- * @module list/tododocumentlist/todocheckboxchangeobserver
6
+ * @module list/todolist/todocheckboxchangeobserver
7
7
  */
8
- import { DomEventObserver } from 'ckeditor5/src/engine';
8
+ import { DomEventObserver } from 'ckeditor5/src/engine.js';
9
9
  /**
10
10
  * Observes all to-do list checkboxes state changes.
11
11
  *
@@ -1,18 +1,17 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- import { Plugin } from 'ckeditor5/src/core';
6
- import ListEditing from '../list/listediting';
5
+ import { Plugin } from 'ckeditor5/src/core.js';
6
+ import ListEditing from '../list/listediting.js';
7
7
  /**
8
8
  * The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
9
9
  *
10
- * It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin} and extends
11
- * it with the commands:
10
+ * It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin}
11
+ * and extends it with the commands:
12
12
  *
13
13
  * - `'todoList'`,
14
14
  * - `'checkTodoList'`,
15
- * - `'todoListCheck'` as an alias for `checkTodoList` command.
16
15
  */
17
16
  export default class TodoListEditing extends Plugin {
18
17
  /**