@ckeditor/ckeditor5-list 38.0.1 → 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.
Files changed (95) hide show
  1. package/build/list.js +1 -1
  2. package/build/list.js.map +1 -0
  3. package/package.json +3 -47
  4. package/src/augmentation.d.ts +50 -49
  5. package/src/augmentation.js +5 -5
  6. package/src/documentlist/adjacentlistssupport.d.ts +15 -0
  7. package/src/documentlist/adjacentlistssupport.js +81 -0
  8. package/src/documentlist/converters.d.ts +63 -63
  9. package/src/documentlist/converters.js +354 -354
  10. package/src/documentlist/documentlistcommand.d.ts +80 -80
  11. package/src/documentlist/documentlistcommand.js +145 -145
  12. package/src/documentlist/documentlistediting.d.ts +154 -154
  13. package/src/documentlist/documentlistediting.js +565 -565
  14. package/src/documentlist/documentlistindentcommand.d.ts +62 -62
  15. package/src/documentlist/documentlistindentcommand.js +129 -129
  16. package/src/documentlist/documentlistmergecommand.d.ts +76 -76
  17. package/src/documentlist/documentlistmergecommand.js +174 -174
  18. package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
  19. package/src/documentlist/documentlistsplitcommand.js +70 -70
  20. package/src/documentlist/documentlistutils.d.ts +46 -46
  21. package/src/documentlist/documentlistutils.js +50 -50
  22. package/src/documentlist/utils/listwalker.d.ts +141 -141
  23. package/src/documentlist/utils/listwalker.js +162 -162
  24. package/src/documentlist/utils/model.d.ts +193 -193
  25. package/src/documentlist/utils/model.js +435 -435
  26. package/src/documentlist/utils/postfixers.d.ts +37 -37
  27. package/src/documentlist/utils/postfixers.js +118 -118
  28. package/src/documentlist/utils/view.d.ts +81 -81
  29. package/src/documentlist/utils/view.js +117 -117
  30. package/src/documentlist.d.ts +26 -26
  31. package/src/documentlist.js +30 -30
  32. package/src/documentlistproperties/converters.d.ts +19 -19
  33. package/src/documentlistproperties/converters.js +43 -43
  34. package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
  35. package/src/documentlistproperties/documentlistpropertiesediting.js +289 -289
  36. package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
  37. package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
  38. package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
  39. package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
  40. package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
  41. package/src/documentlistproperties/documentliststartcommand.js +57 -57
  42. package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
  43. package/src/documentlistproperties/documentliststylecommand.js +113 -113
  44. package/src/documentlistproperties/utils/style.d.ts +20 -20
  45. package/src/documentlistproperties/utils/style.js +54 -54
  46. package/src/documentlistproperties.d.ts +27 -27
  47. package/src/documentlistproperties.js +31 -31
  48. package/src/index.d.ts +40 -39
  49. package/src/index.js +27 -26
  50. package/src/list/converters.d.ts +196 -196
  51. package/src/list/converters.js +905 -905
  52. package/src/list/indentcommand.d.ts +37 -37
  53. package/src/list/indentcommand.js +107 -107
  54. package/src/list/listcommand.d.ts +55 -55
  55. package/src/list/listcommand.js +274 -274
  56. package/src/list/listediting.d.ts +32 -32
  57. package/src/list/listediting.js +161 -161
  58. package/src/list/listui.d.ts +19 -19
  59. package/src/list/listui.js +32 -32
  60. package/src/list/listutils.d.ts +41 -41
  61. package/src/list/listutils.js +46 -46
  62. package/src/list/utils.d.ts +112 -112
  63. package/src/list/utils.js +374 -374
  64. package/src/list.d.ts +26 -26
  65. package/src/list.js +30 -30
  66. package/src/listconfig.d.ts +122 -122
  67. package/src/listconfig.js +5 -5
  68. package/src/listproperties/listpropertiesediting.d.ts +72 -72
  69. package/src/listproperties/listpropertiesediting.js +696 -696
  70. package/src/listproperties/listpropertiesui.d.ts +23 -23
  71. package/src/listproperties/listpropertiesui.js +277 -277
  72. package/src/listproperties/listreversedcommand.d.ts +38 -38
  73. package/src/listproperties/listreversedcommand.js +52 -52
  74. package/src/listproperties/liststartcommand.d.ts +37 -37
  75. package/src/listproperties/liststartcommand.js +51 -51
  76. package/src/listproperties/liststylecommand.d.ts +67 -67
  77. package/src/listproperties/liststylecommand.js +99 -99
  78. package/src/listproperties/ui/collapsibleview.d.ts +63 -63
  79. package/src/listproperties/ui/collapsibleview.js +89 -89
  80. package/src/listproperties/ui/listpropertiesview.d.ts +157 -157
  81. package/src/listproperties/ui/listpropertiesview.js +299 -299
  82. package/src/listproperties.d.ts +26 -26
  83. package/src/listproperties.js +30 -30
  84. package/src/liststyle.d.ts +28 -28
  85. package/src/liststyle.js +36 -36
  86. package/src/todolist/checktodolistcommand.d.ts +52 -52
  87. package/src/todolist/checktodolistcommand.js +76 -76
  88. package/src/todolist/todolistconverters.d.ts +82 -82
  89. package/src/todolist/todolistconverters.js +260 -260
  90. package/src/todolist/todolistediting.d.ts +39 -39
  91. package/src/todolist/todolistediting.js +161 -161
  92. package/src/todolist/todolistui.d.ts +19 -19
  93. package/src/todolist/todolistui.js +29 -29
  94. package/src/todolist.d.ts +27 -27
  95. package/src/todolist.js +31 -31
@@ -1,30 +1,30 @@
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/listproperties
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import ListPropertiesEditing from './listproperties/listpropertiesediting';
10
- import ListPropertiesUI from './listproperties/listpropertiesui';
11
- /**
12
- * The list properties feature.
13
- *
14
- * This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
15
- * editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
16
- */
17
- export default class ListProperties extends Plugin {
18
- /**
19
- * @inheritDoc
20
- */
21
- static get requires() {
22
- return [ListPropertiesEditing, ListPropertiesUI];
23
- }
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'ListProperties';
29
- }
30
- }
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/listproperties
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import ListPropertiesEditing from './listproperties/listpropertiesediting';
10
+ import ListPropertiesUI from './listproperties/listpropertiesui';
11
+ /**
12
+ * The list properties feature.
13
+ *
14
+ * This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
15
+ * editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
16
+ */
17
+ export default class ListProperties extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires() {
22
+ return [ListPropertiesEditing, ListPropertiesUI];
23
+ }
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName() {
28
+ return 'ListProperties';
29
+ }
30
+ }
@@ -1,28 +1,28 @@
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/liststyle
7
- */
8
- import { Plugin, type Editor } from 'ckeditor5/src/core';
9
- import ListProperties from './listproperties';
10
- /**
11
- * The list style feature.
12
- *
13
- * This is an obsolete plugin that exists for backward compatibility only.
14
- * Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
15
- *
16
- * @deprecated
17
- */
18
- export default class ListStyle extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get requires(): readonly [typeof ListProperties];
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName(): 'ListStyle';
27
- constructor(editor: Editor);
28
- }
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/liststyle
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core';
9
+ import ListProperties from './listproperties';
10
+ /**
11
+ * The list style feature.
12
+ *
13
+ * This is an obsolete plugin that exists for backward compatibility only.
14
+ * Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
15
+ *
16
+ * @deprecated
17
+ */
18
+ export default class ListStyle extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof ListProperties];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "ListStyle";
27
+ constructor(editor: Editor);
28
+ }
package/src/liststyle.js CHANGED
@@ -1,36 +1,36 @@
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/liststyle
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import ListProperties from './listproperties';
10
- import { logWarning } from 'ckeditor5/src/utils';
11
- /**
12
- * The list style feature.
13
- *
14
- * This is an obsolete plugin that exists for backward compatibility only.
15
- * Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
16
- *
17
- * @deprecated
18
- */
19
- export default class ListStyle extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires() {
24
- return [ListProperties];
25
- }
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName() {
30
- return 'ListStyle';
31
- }
32
- constructor(editor) {
33
- super(editor);
34
- logWarning('The `ListStyle` plugin is obsolete. Use `ListProperties` instead.');
35
- }
36
- }
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/liststyle
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import ListProperties from './listproperties';
10
+ import { logWarning } from 'ckeditor5/src/utils';
11
+ /**
12
+ * The list style feature.
13
+ *
14
+ * This is an obsolete plugin that exists for backward compatibility only.
15
+ * Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
16
+ *
17
+ * @deprecated
18
+ */
19
+ export default class ListStyle extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires() {
24
+ return [ListProperties];
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName() {
30
+ return 'ListStyle';
31
+ }
32
+ constructor(editor) {
33
+ super(editor);
34
+ logWarning('The `ListStyle` plugin is obsolete. Use `ListProperties` instead.');
35
+ }
36
+ }
@@ -1,52 +1,52 @@
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/todolist/checktodolistcommand
7
- */
8
- import { Command, type Editor } from 'ckeditor5/src/core';
9
- import type { Element } from 'ckeditor5/src/engine';
10
- /**
11
- * The check to-do command.
12
- *
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.
15
- */
16
- export default class CheckTodoListCommand 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
- }
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/todolist/checktodolistcommand
7
+ */
8
+ import { Command, type Editor } from 'ckeditor5/src/core';
9
+ import type { Element } from 'ckeditor5/src/engine';
10
+ /**
11
+ * The check to-do command.
12
+ *
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.
15
+ */
16
+ export default class CheckTodoListCommand 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
+ }
@@ -1,76 +1,76 @@
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/todolist/checktodolistcommand
7
- */
8
- import { Command } from 'ckeditor5/src/core';
9
- const attributeKey = 'todoListChecked';
10
- /**
11
- * The check to-do command.
12
- *
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.
15
- */
16
- export default class CheckTodoListCommand extends Command {
17
- /**
18
- * @inheritDoc
19
- */
20
- constructor(editor) {
21
- super(editor);
22
- this._selectedElements = [];
23
- // Refresh command before executing to be sure all values are up to date.
24
- // It is needed when selection has changed before command execution, in the same change block.
25
- this.on('execute', () => {
26
- this.refresh();
27
- }, { priority: 'highest' });
28
- }
29
- /**
30
- * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
31
- */
32
- 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;
55
- }
56
- /**
57
- * Executes the command.
58
- *
59
- * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
60
- * the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
61
- * value to decide what it should do.
62
- */
63
- execute(options = {}) {
64
- this.editor.model.change(writer => {
65
- for (const element of this._selectedElements) {
66
- const value = (options.forceValue === undefined) ? !this.value : options.forceValue;
67
- if (value) {
68
- writer.setAttribute(attributeKey, true, element);
69
- }
70
- else {
71
- writer.removeAttribute(attributeKey, element);
72
- }
73
- }
74
- });
75
- }
76
- }
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/todolist/checktodolistcommand
7
+ */
8
+ import { Command } from 'ckeditor5/src/core';
9
+ const attributeKey = 'todoListChecked';
10
+ /**
11
+ * The check to-do command.
12
+ *
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.
15
+ */
16
+ export default class CheckTodoListCommand extends Command {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ constructor(editor) {
21
+ super(editor);
22
+ this._selectedElements = [];
23
+ // Refresh command before executing to be sure all values are up to date.
24
+ // It is needed when selection has changed before command execution, in the same change block.
25
+ this.on('execute', () => {
26
+ this.refresh();
27
+ }, { priority: 'highest' });
28
+ }
29
+ /**
30
+ * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
31
+ */
32
+ 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;
55
+ }
56
+ /**
57
+ * Executes the command.
58
+ *
59
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
60
+ * the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
61
+ * value to decide what it should do.
62
+ */
63
+ execute(options = {}) {
64
+ this.editor.model.change(writer => {
65
+ for (const element of this._selectedElements) {
66
+ const value = (options.forceValue === undefined) ? !this.value : options.forceValue;
67
+ if (value) {
68
+ writer.setAttribute(attributeKey, true, element);
69
+ }
70
+ else {
71
+ writer.removeAttribute(attributeKey, element);
72
+ }
73
+ }
74
+ });
75
+ }
76
+ }
@@ -1,82 +1,82 @@
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/todolist/todolistconverters
7
- */
8
- import type { DowncastAttributeEvent, DowncastInsertEvent, Element, MapperModelToViewPositionEvent, Model, UpcastElementEvent, View } from 'ckeditor5/src/engine';
9
- import { type GetCallback } from 'ckeditor5/src/utils';
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/list/converters~modelViewChangeType} and followed by
53
- * {@link module:list/list/converters~modelViewMergeAfterChangeType} to handle splitting and merging surrounding lists of the same type.
54
- *
55
- * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
56
- *
57
- * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
58
- * @param onCheckedChange Callback fired after clicking the checkbox UI element.
59
- * @param view Editing view controller.
60
- * @returns Returns a conversion callback.
61
- */
62
- export declare function modelViewChangeType(onCheckedChange: (element: Element) => void, view: View): GetCallback<DowncastAttributeEvent<Element>>;
63
- /**
64
- * A model-to-view converter for the `todoListChecked` attribute change on the `listItem` model element.
65
- *
66
- * It marks the {@link module:engine/view/uielement~UIElement checkbox UI element} as checked.
67
- *
68
- * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
69
- *
70
- * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
71
- * @param onCheckedChange Callback fired after clicking the checkbox UI element.
72
- * @returns Returns a conversion callback.
73
- */
74
- export declare function modelViewChangeChecked(onCheckedChange: (element: Element) => void): GetCallback<DowncastAttributeEvent<Element>>;
75
- /**
76
- * A model-to-view position at zero offset mapper.
77
- *
78
- * This helper ensures that position inside todo-list in the view is mapped after the checkbox.
79
- *
80
- * It only handles the position at the beginning of a list item as other positions are properly mapped be the default mapper.
81
- */
82
- export declare function mapModelToViewPosition(view: View): GetCallback<MapperModelToViewPositionEvent>;
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/todolist/todolistconverters
7
+ */
8
+ import type { DowncastAttributeEvent, DowncastInsertEvent, Element, MapperModelToViewPositionEvent, Model, UpcastElementEvent, View } from 'ckeditor5/src/engine';
9
+ import { type GetCallback } from 'ckeditor5/src/utils';
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/list/converters~modelViewChangeType} and followed by
53
+ * {@link module:list/list/converters~modelViewMergeAfterChangeType} to handle splitting and merging surrounding lists of the same type.
54
+ *
55
+ * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
56
+ *
57
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
58
+ * @param onCheckedChange Callback fired after clicking the checkbox UI element.
59
+ * @param view Editing view controller.
60
+ * @returns Returns a conversion callback.
61
+ */
62
+ export declare function modelViewChangeType(onCheckedChange: (element: Element) => void, view: View): GetCallback<DowncastAttributeEvent<Element>>;
63
+ /**
64
+ * A model-to-view converter for the `todoListChecked` attribute change on the `listItem` model element.
65
+ *
66
+ * It marks the {@link module:engine/view/uielement~UIElement checkbox UI element} as checked.
67
+ *
68
+ * It is used by {@link module:engine/controller/editingcontroller~EditingController}.
69
+ *
70
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
71
+ * @param onCheckedChange Callback fired after clicking the checkbox UI element.
72
+ * @returns Returns a conversion callback.
73
+ */
74
+ export declare function modelViewChangeChecked(onCheckedChange: (element: Element) => void): GetCallback<DowncastAttributeEvent<Element>>;
75
+ /**
76
+ * A model-to-view position at zero offset mapper.
77
+ *
78
+ * This helper ensures that position inside todo-list in the view is mapped after the checkbox.
79
+ *
80
+ * It only handles the position at the beginning of a list item as other positions are properly mapped be the default mapper.
81
+ */
82
+ export declare function mapModelToViewPosition(view: View): GetCallback<MapperModelToViewPositionEvent>;