@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,117 +1,117 @@
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
- * Checks if view element is a list type (ul or ol).
7
- *
8
- * @internal
9
- */
10
- export function isListView(viewElement) {
11
- return viewElement.is('element', 'ol') || viewElement.is('element', 'ul');
12
- }
13
- /**
14
- * Checks if view element is a list item (li).
15
- *
16
- * @internal
17
- */
18
- export function isListItemView(viewElement) {
19
- return viewElement.is('element', 'li');
20
- }
21
- /**
22
- * Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.
23
- *
24
- * Also, fixes non HTML compliant lists indents:
25
- *
26
- * ```
27
- * before: fixed list:
28
- * OL OL
29
- * |-> LI (parent LIs: 0) |-> LI (indent: 0)
30
- * |-> OL |-> OL
31
- * |-> OL |
32
- * | |-> OL |
33
- * | |-> OL |
34
- * | |-> LI (parent LIs: 1) |-> LI (indent: 1)
35
- * |-> LI (parent LIs: 1) |-> LI (indent: 1)
36
- *
37
- * before: fixed list:
38
- * OL OL
39
- * |-> OL |
40
- * |-> OL |
41
- * |-> OL |
42
- * |-> LI (parent LIs: 0) |-> LI (indent: 0)
43
- *
44
- * before: fixed list:
45
- * OL OL
46
- * |-> LI (parent LIs: 0) |-> LI (indent: 0)
47
- * |-> OL |-> OL
48
- * |-> LI (parent LIs: 0) |-> LI (indent: 1)
49
- * ```
50
- *
51
- * @internal
52
- */
53
- export function getIndent(listItem) {
54
- let indent = 0;
55
- let parent = listItem.parent;
56
- while (parent) {
57
- // Each LI in the tree will result in an increased indent for HTML compliant lists.
58
- if (isListItemView(parent)) {
59
- indent++;
60
- }
61
- else {
62
- // If however the list is nested in other list we should check previous sibling of any of the list elements...
63
- const previousSibling = parent.previousSibling;
64
- // ...because the we might need increase its indent:
65
- // before: fixed list:
66
- // OL OL
67
- // |-> LI (parent LIs: 0) |-> LI (indent: 0)
68
- // |-> OL |-> OL
69
- // |-> LI (parent LIs: 0) |-> LI (indent: 1)
70
- if (previousSibling && isListItemView(previousSibling)) {
71
- indent++;
72
- }
73
- }
74
- parent = parent.parent;
75
- }
76
- return indent;
77
- }
78
- /**
79
- * Creates a list attribute element (ol or ul).
80
- *
81
- * @internal
82
- */
83
- export function createListElement(writer, indent, type, id = getViewElementIdForListType(type, indent)) {
84
- // Negative priorities so that restricted editing attribute won't wrap lists.
85
- return writer.createAttributeElement(getViewElementNameForListType(type), null, {
86
- priority: 2 * indent / 100 - 100,
87
- id
88
- });
89
- }
90
- /**
91
- * Creates a list item attribute element (li).
92
- *
93
- * @internal
94
- */
95
- export function createListItemElement(writer, indent, id) {
96
- // Negative priorities so that restricted editing attribute won't wrap list items.
97
- return writer.createAttributeElement('li', null, {
98
- priority: (2 * indent + 1) / 100 - 100,
99
- id
100
- });
101
- }
102
- /**
103
- * Returns a view element name for the given list type.
104
- *
105
- * @internal
106
- */
107
- export function getViewElementNameForListType(type) {
108
- return type == 'numbered' ? 'ol' : 'ul';
109
- }
110
- /**
111
- * Returns a view element ID for the given list type and indent.
112
- *
113
- * @internal
114
- */
115
- export function getViewElementIdForListType(type, indent) {
116
- return `list-${type}-${indent}`;
117
- }
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
+ * Checks if view element is a list type (ul or ol).
7
+ *
8
+ * @internal
9
+ */
10
+ export function isListView(viewElement) {
11
+ return viewElement.is('element', 'ol') || viewElement.is('element', 'ul');
12
+ }
13
+ /**
14
+ * Checks if view element is a list item (li).
15
+ *
16
+ * @internal
17
+ */
18
+ export function isListItemView(viewElement) {
19
+ return viewElement.is('element', 'li');
20
+ }
21
+ /**
22
+ * Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.
23
+ *
24
+ * Also, fixes non HTML compliant lists indents:
25
+ *
26
+ * ```
27
+ * before: fixed list:
28
+ * OL OL
29
+ * |-> LI (parent LIs: 0) |-> LI (indent: 0)
30
+ * |-> OL |-> OL
31
+ * |-> OL |
32
+ * | |-> OL |
33
+ * | |-> OL |
34
+ * | |-> LI (parent LIs: 1) |-> LI (indent: 1)
35
+ * |-> LI (parent LIs: 1) |-> LI (indent: 1)
36
+ *
37
+ * before: fixed list:
38
+ * OL OL
39
+ * |-> OL |
40
+ * |-> OL |
41
+ * |-> OL |
42
+ * |-> LI (parent LIs: 0) |-> LI (indent: 0)
43
+ *
44
+ * before: fixed list:
45
+ * OL OL
46
+ * |-> LI (parent LIs: 0) |-> LI (indent: 0)
47
+ * |-> OL |-> OL
48
+ * |-> LI (parent LIs: 0) |-> LI (indent: 1)
49
+ * ```
50
+ *
51
+ * @internal
52
+ */
53
+ export function getIndent(listItem) {
54
+ let indent = 0;
55
+ let parent = listItem.parent;
56
+ while (parent) {
57
+ // Each LI in the tree will result in an increased indent for HTML compliant lists.
58
+ if (isListItemView(parent)) {
59
+ indent++;
60
+ }
61
+ else {
62
+ // If however the list is nested in other list we should check previous sibling of any of the list elements...
63
+ const previousSibling = parent.previousSibling;
64
+ // ...because the we might need increase its indent:
65
+ // before: fixed list:
66
+ // OL OL
67
+ // |-> LI (parent LIs: 0) |-> LI (indent: 0)
68
+ // |-> OL |-> OL
69
+ // |-> LI (parent LIs: 0) |-> LI (indent: 1)
70
+ if (previousSibling && isListItemView(previousSibling)) {
71
+ indent++;
72
+ }
73
+ }
74
+ parent = parent.parent;
75
+ }
76
+ return indent;
77
+ }
78
+ /**
79
+ * Creates a list attribute element (ol or ul).
80
+ *
81
+ * @internal
82
+ */
83
+ export function createListElement(writer, indent, type, id = getViewElementIdForListType(type, indent)) {
84
+ // Negative priorities so that restricted editing attribute won't wrap lists.
85
+ return writer.createAttributeElement(getViewElementNameForListType(type), null, {
86
+ priority: 2 * indent / 100 - 100,
87
+ id
88
+ });
89
+ }
90
+ /**
91
+ * Creates a list item attribute element (li).
92
+ *
93
+ * @internal
94
+ */
95
+ export function createListItemElement(writer, indent, id) {
96
+ // Negative priorities so that restricted editing attribute won't wrap list items.
97
+ return writer.createAttributeElement('li', null, {
98
+ priority: (2 * indent + 1) / 100 - 100,
99
+ id
100
+ });
101
+ }
102
+ /**
103
+ * Returns a view element name for the given list type.
104
+ *
105
+ * @internal
106
+ */
107
+ export function getViewElementNameForListType(type) {
108
+ return type == 'numbered' ? 'ol' : 'ul';
109
+ }
110
+ /**
111
+ * Returns a view element ID for the given list type and indent.
112
+ *
113
+ * @internal
114
+ */
115
+ export function getViewElementIdForListType(type, indent) {
116
+ return `list-${type}-${indent}`;
117
+ }
@@ -1,26 +1,26 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module list/documentlist
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import DocumentListEditing from './documentlist/documentlistediting';
10
- import ListUI from './list/listui';
11
- /**
12
- * The document list feature.
13
- *
14
- * This is a "glue" plugin that loads the {@link module:list/documentlist/documentlistediting~DocumentListEditing document list
15
- * editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
16
- */
17
- export default class DocumentList extends Plugin {
18
- /**
19
- * @inheritDoc
20
- */
21
- static get requires(): readonly [typeof DocumentListEditing, typeof ListUI];
22
- /**
23
- * @inheritDoc
24
- */
25
- static get pluginName(): 'DocumentList';
26
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/documentlist
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import DocumentListEditing from './documentlist/documentlistediting';
10
+ import ListUI from './list/listui';
11
+ /**
12
+ * The document list feature.
13
+ *
14
+ * This is a "glue" plugin that loads the {@link module:list/documentlist/documentlistediting~DocumentListEditing document list
15
+ * editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
16
+ */
17
+ export default class DocumentList extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires(): readonly [typeof DocumentListEditing, typeof ListUI];
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "DocumentList";
26
+ }
@@ -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/documentlist
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import DocumentListEditing from './documentlist/documentlistediting';
10
- import ListUI from './list/listui';
11
- /**
12
- * The document list feature.
13
- *
14
- * This is a "glue" plugin that loads the {@link module:list/documentlist/documentlistediting~DocumentListEditing document list
15
- * editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
16
- */
17
- export default class DocumentList extends Plugin {
18
- /**
19
- * @inheritDoc
20
- */
21
- static get requires() {
22
- return [DocumentListEditing, ListUI];
23
- }
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'DocumentList';
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/documentlist
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import DocumentListEditing from './documentlist/documentlistediting';
10
+ import ListUI from './list/listui';
11
+ /**
12
+ * The document list feature.
13
+ *
14
+ * This is a "glue" plugin that loads the {@link module:list/documentlist/documentlistediting~DocumentListEditing document list
15
+ * editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
16
+ */
17
+ export default class DocumentList extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires() {
22
+ return [DocumentListEditing, ListUI];
23
+ }
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName() {
28
+ return 'DocumentList';
29
+ }
30
+ }
@@ -1,19 +1,19 @@
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/documentlistproperties/converters
7
- */
8
- import type { UpcastElementEvent } from 'ckeditor5/src/engine';
9
- import type { GetCallback } from 'ckeditor5/src/utils';
10
- import type { AttributeStrategy } from './documentlistpropertiesediting';
11
- /**
12
- * Returns a converter that consumes the `style`, `reversed`, and `start` attributes.
13
- * In `style`, it searches for the `list-style-type` definition.
14
- * If not found, the `"default"` value will be used.
15
- *
16
- * @internal
17
- * @param strategy
18
- */
19
- export declare function listPropertiesUpcastConverter(strategy: AttributeStrategy): GetCallback<UpcastElementEvent>;
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/documentlistproperties/converters
7
+ */
8
+ import type { UpcastElementEvent } from 'ckeditor5/src/engine';
9
+ import type { GetCallback } from 'ckeditor5/src/utils';
10
+ import type { AttributeStrategy } from './documentlistpropertiesediting';
11
+ /**
12
+ * Returns a converter that consumes the `style`, `reversed`, and `start` attributes.
13
+ * In `style`, it searches for the `list-style-type` definition.
14
+ * If not found, the `"default"` value will be used.
15
+ *
16
+ * @internal
17
+ * @param strategy
18
+ */
19
+ export declare function listPropertiesUpcastConverter(strategy: AttributeStrategy): GetCallback<UpcastElementEvent>;
@@ -1,43 +1,43 @@
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
- * Returns a converter that consumes the `style`, `reversed`, and `start` attributes.
7
- * In `style`, it searches for the `list-style-type` definition.
8
- * If not found, the `"default"` value will be used.
9
- *
10
- * @internal
11
- * @param strategy
12
- */
13
- export function listPropertiesUpcastConverter(strategy) {
14
- return (evt, data, conversionApi) => {
15
- const { writer, schema, consumable } = conversionApi;
16
- // If there is no view consumable to consume, set the default attribute value to be able to reconvert nested lists on parent change.
17
- // So abort converting if attribute was directly consumed.
18
- if (consumable.test(data.viewItem, strategy.viewConsumables) === false) {
19
- return;
20
- }
21
- if (!data.modelRange) {
22
- Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));
23
- }
24
- let applied = false;
25
- for (const item of data.modelRange.getItems({ shallow: true })) {
26
- if (!schema.checkAttribute(item, strategy.attributeName)) {
27
- continue;
28
- }
29
- if (!strategy.appliesToListItem(item)) {
30
- continue;
31
- }
32
- // Set list attributes only on same level items, those nested deeper are already handled by the recursive conversion.
33
- if (item.hasAttribute(strategy.attributeName)) {
34
- continue;
35
- }
36
- writer.setAttribute(strategy.attributeName, strategy.getAttributeOnUpcast(data.viewItem), item);
37
- applied = true;
38
- }
39
- if (applied) {
40
- consumable.consume(data.viewItem, strategy.viewConsumables);
41
- }
42
- };
43
- }
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
+ * Returns a converter that consumes the `style`, `reversed`, and `start` attributes.
7
+ * In `style`, it searches for the `list-style-type` definition.
8
+ * If not found, the `"default"` value will be used.
9
+ *
10
+ * @internal
11
+ * @param strategy
12
+ */
13
+ export function listPropertiesUpcastConverter(strategy) {
14
+ return (evt, data, conversionApi) => {
15
+ const { writer, schema, consumable } = conversionApi;
16
+ // If there is no view consumable to consume, set the default attribute value to be able to reconvert nested lists on parent change.
17
+ // So abort converting if attribute was directly consumed.
18
+ if (consumable.test(data.viewItem, strategy.viewConsumables) === false) {
19
+ return;
20
+ }
21
+ if (!data.modelRange) {
22
+ Object.assign(data, conversionApi.convertChildren(data.viewItem, data.modelCursor));
23
+ }
24
+ let applied = false;
25
+ for (const item of data.modelRange.getItems({ shallow: true })) {
26
+ if (!schema.checkAttribute(item, strategy.attributeName)) {
27
+ continue;
28
+ }
29
+ if (!strategy.appliesToListItem(item)) {
30
+ continue;
31
+ }
32
+ // Set list attributes only on same level items, those nested deeper are already handled by the recursive conversion.
33
+ if (item.hasAttribute(strategy.attributeName)) {
34
+ continue;
35
+ }
36
+ writer.setAttribute(strategy.attributeName, strategy.getAttributeOnUpcast(data.viewItem), item);
37
+ applied = true;
38
+ }
39
+ if (applied) {
40
+ consumable.consume(data.viewItem, strategy.viewConsumables);
41
+ }
42
+ };
43
+ }
@@ -1,88 +1,88 @@
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/documentlistproperties/documentlistpropertiesediting
7
- */
8
- import { Plugin, type Editor } from 'ckeditor5/src/core';
9
- import type { Consumables, DowncastWriter, Element, Item, ViewElement } from 'ckeditor5/src/engine';
10
- import DocumentListEditing, { type ListItemAttributesMap } from '../documentlist/documentlistediting';
11
- import DocumentListPropertiesUtils from './documentlistpropertiesutils';
12
- /**
13
- * The document list properties engine feature.
14
- *
15
- * It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they are enabled in the configuration.
16
- * Read more in {@link module:list/listconfig~ListPropertiesConfig}.
17
- */
18
- export default class DocumentListPropertiesEditing extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get requires(): readonly [typeof DocumentListEditing, typeof DocumentListPropertiesUtils];
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName(): 'DocumentListPropertiesEditing';
27
- /**
28
- * @inheritDoc
29
- */
30
- constructor(editor: Editor);
31
- /**
32
- * @inheritDoc
33
- */
34
- init(): void;
35
- }
36
- /**
37
- * Strategy for dealing with `listItem` attributes supported by this plugin.
38
- *
39
- * @internal
40
- */
41
- export interface AttributeStrategy {
42
- /**
43
- * The model attribute name.
44
- */
45
- attributeName: keyof ListItemAttributesMap;
46
- /**
47
- * The model attribute default value.
48
- */
49
- defaultValue: unknown;
50
- /**
51
- * The view consumable as expected by {@link module:engine/conversion/viewconsumable~ViewConsumable#consume `ViewConsumable`}.
52
- */
53
- viewConsumables: Consumables;
54
- /**
55
- * Registers an editor command.
56
- */
57
- addCommand(editor: Editor): void;
58
- /**
59
- * Verifies whether the strategy is applicable for the specified model element.
60
- */
61
- appliesToListItem(element: Item): boolean;
62
- /**
63
- * Verifies whether the model attribute value is valid.
64
- */
65
- hasValidAttribute(element: Element): boolean;
66
- /**
67
- * Sets the property on the view element.
68
- */
69
- setAttributeOnDowncast(writer: DowncastWriter, value: unknown, element: ViewElement): void;
70
- /**
71
- * Retrieves the property value from the view element.
72
- */
73
- getAttributeOnUpcast(element: ViewElement): unknown;
74
- }
75
- declare module '../documentlist/documentlistediting' {
76
- interface ListItemAttributesMap {
77
- listStyle?: string;
78
- listStart?: number;
79
- listReversed?: boolean;
80
- }
81
- }
82
- declare module '../documentlist/utils/model' {
83
- interface ListElement {
84
- getAttribute(key: 'listStyle'): string;
85
- getAttribute(key: 'listStart'): number;
86
- getAttribute(key: 'listReversed'): boolean;
87
- }
88
- }
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/documentlistproperties/documentlistpropertiesediting
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core';
9
+ import type { Consumables, DowncastWriter, Element, Item, ViewElement } from 'ckeditor5/src/engine';
10
+ import DocumentListEditing, { type ListItemAttributesMap } from '../documentlist/documentlistediting';
11
+ import DocumentListPropertiesUtils from './documentlistpropertiesutils';
12
+ /**
13
+ * The document list properties engine feature.
14
+ *
15
+ * It registers the `'listStyle'`, `'listReversed'` and `'listStart'` commands if they are enabled in the configuration.
16
+ * Read more in {@link module:list/listconfig~ListPropertiesConfig}.
17
+ */
18
+ export default class DocumentListPropertiesEditing extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof DocumentListEditing, typeof DocumentListPropertiesUtils];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "DocumentListPropertiesEditing";
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ constructor(editor: Editor);
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ init(): void;
35
+ }
36
+ /**
37
+ * Strategy for dealing with `listItem` attributes supported by this plugin.
38
+ *
39
+ * @internal
40
+ */
41
+ export interface AttributeStrategy {
42
+ /**
43
+ * The model attribute name.
44
+ */
45
+ attributeName: keyof ListItemAttributesMap;
46
+ /**
47
+ * The model attribute default value.
48
+ */
49
+ defaultValue: unknown;
50
+ /**
51
+ * The view consumable as expected by {@link module:engine/conversion/viewconsumable~ViewConsumable#consume `ViewConsumable`}.
52
+ */
53
+ viewConsumables: Consumables;
54
+ /**
55
+ * Registers an editor command.
56
+ */
57
+ addCommand(editor: Editor): void;
58
+ /**
59
+ * Verifies whether the strategy is applicable for the specified model element.
60
+ */
61
+ appliesToListItem(element: Item): boolean;
62
+ /**
63
+ * Verifies whether the model attribute value is valid.
64
+ */
65
+ hasValidAttribute(element: Element): boolean;
66
+ /**
67
+ * Sets the property on the view element.
68
+ */
69
+ setAttributeOnDowncast(writer: DowncastWriter, value: unknown, element: ViewElement): void;
70
+ /**
71
+ * Retrieves the property value from the view element.
72
+ */
73
+ getAttributeOnUpcast(element: ViewElement): unknown;
74
+ }
75
+ declare module '../documentlist/documentlistediting' {
76
+ interface ListItemAttributesMap {
77
+ listStyle?: string;
78
+ listStart?: number;
79
+ listReversed?: boolean;
80
+ }
81
+ }
82
+ declare module '../documentlist/utils/model' {
83
+ interface ListElement {
84
+ getAttribute(key: 'listStyle'): string;
85
+ getAttribute(key: 'listStart'): number;
86
+ getAttribute(key: 'listReversed'): boolean;
87
+ }
88
+ }