@ckeditor/ckeditor5-list 40.0.0 → 40.2.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 (108) hide show
  1. package/CHANGELOG.md +25 -25
  2. package/LICENSE.md +2 -2
  3. package/build/list.js +1 -1
  4. package/build/translations/ug.js +1 -1
  5. package/lang/translations/ug.po +3 -3
  6. package/package.json +2 -3
  7. package/src/augmentation.d.ts +52 -52
  8. package/src/augmentation.js +5 -5
  9. package/src/documentlist/adjacentlistssupport.d.ts +15 -15
  10. package/src/documentlist/adjacentlistssupport.js +81 -81
  11. package/src/documentlist/converters.d.ts +65 -65
  12. package/src/documentlist/converters.js +441 -441
  13. package/src/documentlist/documentlistcommand.d.ts +80 -80
  14. package/src/documentlist/documentlistcommand.js +150 -150
  15. package/src/documentlist/documentlistediting.d.ts +212 -212
  16. package/src/documentlist/documentlistediting.js +646 -645
  17. package/src/documentlist/documentlistindentcommand.d.ts +62 -62
  18. package/src/documentlist/documentlistindentcommand.js +129 -129
  19. package/src/documentlist/documentlistmergecommand.d.ts +76 -76
  20. package/src/documentlist/documentlistmergecommand.js +174 -174
  21. package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
  22. package/src/documentlist/documentlistsplitcommand.js +70 -70
  23. package/src/documentlist/documentlistutils.d.ts +46 -46
  24. package/src/documentlist/documentlistutils.js +50 -50
  25. package/src/documentlist/utils/listwalker.d.ts +145 -145
  26. package/src/documentlist/utils/listwalker.js +182 -182
  27. package/src/documentlist/utils/model.d.ts +202 -202
  28. package/src/documentlist/utils/model.js +455 -455
  29. package/src/documentlist/utils/postfixers.d.ts +37 -37
  30. package/src/documentlist/utils/postfixers.js +126 -126
  31. package/src/documentlist/utils/view.d.ts +81 -81
  32. package/src/documentlist/utils/view.js +117 -117
  33. package/src/documentlist.d.ts +26 -26
  34. package/src/documentlist.js +30 -30
  35. package/src/documentlistproperties/converters.d.ts +19 -19
  36. package/src/documentlistproperties/converters.js +43 -43
  37. package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
  38. package/src/documentlistproperties/documentlistpropertiesediting.js +266 -266
  39. package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
  40. package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
  41. package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
  42. package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
  43. package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
  44. package/src/documentlistproperties/documentliststartcommand.js +57 -57
  45. package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
  46. package/src/documentlistproperties/documentliststylecommand.js +113 -113
  47. package/src/documentlistproperties/utils/style.d.ts +20 -20
  48. package/src/documentlistproperties/utils/style.js +54 -54
  49. package/src/documentlistproperties.d.ts +27 -27
  50. package/src/documentlistproperties.js +31 -31
  51. package/src/index.d.ts +43 -43
  52. package/src/index.js +29 -29
  53. package/src/list/converters.d.ts +196 -196
  54. package/src/list/converters.js +905 -905
  55. package/src/list/indentcommand.d.ts +37 -37
  56. package/src/list/indentcommand.js +107 -107
  57. package/src/list/listcommand.d.ts +55 -55
  58. package/src/list/listcommand.js +274 -274
  59. package/src/list/listediting.d.ts +32 -32
  60. package/src/list/listediting.js +161 -161
  61. package/src/list/listui.d.ts +19 -19
  62. package/src/list/listui.js +32 -32
  63. package/src/list/listutils.d.ts +41 -41
  64. package/src/list/listutils.js +46 -46
  65. package/src/list/utils.d.ts +112 -112
  66. package/src/list/utils.js +374 -374
  67. package/src/list.d.ts +26 -26
  68. package/src/list.js +30 -30
  69. package/src/listconfig.d.ts +132 -132
  70. package/src/listconfig.js +5 -5
  71. package/src/listproperties/listpropertiesediting.d.ts +72 -72
  72. package/src/listproperties/listpropertiesediting.js +696 -696
  73. package/src/listproperties/listpropertiesui.d.ts +23 -23
  74. package/src/listproperties/listpropertiesui.js +277 -277
  75. package/src/listproperties/listreversedcommand.d.ts +38 -38
  76. package/src/listproperties/listreversedcommand.js +52 -52
  77. package/src/listproperties/liststartcommand.d.ts +37 -37
  78. package/src/listproperties/liststartcommand.js +51 -51
  79. package/src/listproperties/liststylecommand.d.ts +67 -67
  80. package/src/listproperties/liststylecommand.js +99 -99
  81. package/src/listproperties/ui/listpropertiesview.d.ts +156 -157
  82. package/src/listproperties/ui/listpropertiesview.js +298 -299
  83. package/src/listproperties.d.ts +26 -26
  84. package/src/listproperties.js +30 -30
  85. package/src/liststyle.d.ts +28 -28
  86. package/src/liststyle.js +36 -36
  87. package/src/tododocumentlist/checktododocumentlistcommand.d.ts +49 -49
  88. package/src/tododocumentlist/checktododocumentlistcommand.js +82 -82
  89. package/src/tododocumentlist/todocheckboxchangeobserver.d.ts +41 -41
  90. package/src/tododocumentlist/todocheckboxchangeobserver.js +37 -37
  91. package/src/tododocumentlist/tododocumentlistediting.d.ts +38 -38
  92. package/src/tododocumentlist/tododocumentlistediting.js +399 -399
  93. package/src/tododocumentlist.d.ts +27 -27
  94. package/src/tododocumentlist.js +31 -31
  95. package/src/todolist/checktodolistcommand.d.ts +52 -52
  96. package/src/todolist/checktodolistcommand.js +76 -76
  97. package/src/todolist/todolistconverters.d.ts +82 -82
  98. package/src/todolist/todolistconverters.js +260 -260
  99. package/src/todolist/todolistediting.d.ts +39 -39
  100. package/src/todolist/todolistediting.js +161 -161
  101. package/src/todolist/todolistui.d.ts +19 -19
  102. package/src/todolist/todolistui.js +29 -29
  103. package/src/todolist.d.ts +27 -27
  104. package/src/todolist.js +31 -31
  105. package/build/list.js.map +0 -1
  106. package/src/listproperties/ui/collapsibleview.d.ts +0 -63
  107. package/src/listproperties/ui/collapsibleview.js +0 -89
  108. package/theme/collapsible.css +0 -10
@@ -1,161 +1,161 @@
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/list/listediting
7
- */
8
- import ListCommand from './listcommand';
9
- import IndentCommand from './indentcommand';
10
- import ListUtils from './listutils';
11
- import { Plugin } from 'ckeditor5/src/core';
12
- import { Enter } from 'ckeditor5/src/enter';
13
- import { Delete } from 'ckeditor5/src/typing';
14
- import { cleanList, cleanListItem, modelViewInsertion, modelViewChangeType, modelViewMergeAfterChangeType, modelViewMergeAfter, modelViewRemove, modelViewSplitOnInsert, modelViewChangeIndent, modelChangePostFixer, modelIndentPasteFixer, viewModelConverter, modelToViewPosition, viewToModelPosition } from './converters';
15
- import '../../theme/list.css';
16
- /**
17
- * The engine of the list feature. It handles creating, editing and removing lists and list items.
18
- *
19
- * It registers the `'numberedList'`, `'bulletedList'`, `'indentList'` and `'outdentList'` commands.
20
- */
21
- export default class ListEditing extends Plugin {
22
- /**
23
- * @inheritDoc
24
- */
25
- static get pluginName() {
26
- return 'ListEditing';
27
- }
28
- /**
29
- * @inheritDoc
30
- */
31
- static get requires() {
32
- return [Enter, Delete, ListUtils];
33
- }
34
- /**
35
- * @inheritDoc
36
- */
37
- init() {
38
- const editor = this.editor;
39
- // Schema.
40
- // Note: in case `$block` will ever be allowed in `listItem`, keep in mind that this feature
41
- // uses `Selection#getSelectedBlocks()` without any additional processing to obtain all selected list items.
42
- // If there are blocks allowed inside list item, algorithms using `getSelectedBlocks()` will have to be modified.
43
- editor.model.schema.register('listItem', {
44
- inheritAllFrom: '$block',
45
- allowAttributes: ['listType', 'listIndent']
46
- });
47
- // Converters.
48
- const data = editor.data;
49
- const editing = editor.editing;
50
- editor.model.document.registerPostFixer(writer => modelChangePostFixer(editor.model, writer));
51
- editing.mapper.registerViewToModelLength('li', getViewListItemLength);
52
- data.mapper.registerViewToModelLength('li', getViewListItemLength);
53
- editing.mapper.on('modelToViewPosition', modelToViewPosition(editing.view));
54
- editing.mapper.on('viewToModelPosition', viewToModelPosition(editor.model));
55
- data.mapper.on('modelToViewPosition', modelToViewPosition(editing.view));
56
- editor.conversion.for('editingDowncast')
57
- .add(dispatcher => {
58
- dispatcher.on('insert', modelViewSplitOnInsert, { priority: 'high' });
59
- dispatcher.on('insert:listItem', modelViewInsertion(editor.model));
60
- dispatcher.on('attribute:listType:listItem', modelViewChangeType, { priority: 'high' });
61
- dispatcher.on('attribute:listType:listItem', modelViewMergeAfterChangeType, { priority: 'low' });
62
- dispatcher.on('attribute:listIndent:listItem', modelViewChangeIndent(editor.model));
63
- dispatcher.on('remove:listItem', modelViewRemove(editor.model));
64
- dispatcher.on('remove', modelViewMergeAfter, { priority: 'low' });
65
- });
66
- editor.conversion.for('dataDowncast')
67
- .add(dispatcher => {
68
- dispatcher.on('insert', modelViewSplitOnInsert, { priority: 'high' });
69
- dispatcher.on('insert:listItem', modelViewInsertion(editor.model));
70
- });
71
- editor.conversion.for('upcast')
72
- .add(dispatcher => {
73
- dispatcher.on('element:ul', cleanList, { priority: 'high' });
74
- dispatcher.on('element:ol', cleanList, { priority: 'high' });
75
- dispatcher.on('element:li', cleanListItem, { priority: 'high' });
76
- dispatcher.on('element:li', viewModelConverter);
77
- });
78
- // Fix indentation of pasted items.
79
- editor.model.on('insertContent', modelIndentPasteFixer, { priority: 'high' });
80
- // Register commands for numbered and bulleted list.
81
- editor.commands.add('numberedList', new ListCommand(editor, 'numbered'));
82
- editor.commands.add('bulletedList', new ListCommand(editor, 'bulleted'));
83
- // Register commands for indenting.
84
- editor.commands.add('indentList', new IndentCommand(editor, 'forward'));
85
- editor.commands.add('outdentList', new IndentCommand(editor, 'backward'));
86
- const viewDocument = editing.view.document;
87
- // Overwrite default Enter key behavior.
88
- // If Enter key is pressed with selection collapsed in empty list item, outdent it instead of breaking it.
89
- this.listenTo(viewDocument, 'enter', (evt, data) => {
90
- const doc = this.editor.model.document;
91
- const positionParent = doc.selection.getLastPosition().parent;
92
- if (doc.selection.isCollapsed && positionParent.name == 'listItem' && positionParent.isEmpty) {
93
- this.editor.execute('outdentList');
94
- data.preventDefault();
95
- evt.stop();
96
- }
97
- }, { context: 'li' });
98
- // Overwrite default Backspace key behavior.
99
- // If Backspace key is pressed with selection collapsed on first position in first list item, outdent it. #83
100
- this.listenTo(viewDocument, 'delete', (evt, data) => {
101
- // Check conditions from those that require less computations like those immediately available.
102
- if (data.direction !== 'backward') {
103
- return;
104
- }
105
- const selection = this.editor.model.document.selection;
106
- if (!selection.isCollapsed) {
107
- return;
108
- }
109
- const firstPosition = selection.getFirstPosition();
110
- if (!firstPosition.isAtStart) {
111
- return;
112
- }
113
- const positionParent = firstPosition.parent;
114
- if (positionParent.name !== 'listItem') {
115
- return;
116
- }
117
- const previousIsAListItem = positionParent.previousSibling && positionParent.previousSibling.name === 'listItem';
118
- if (previousIsAListItem) {
119
- return;
120
- }
121
- this.editor.execute('outdentList');
122
- data.preventDefault();
123
- evt.stop();
124
- }, { context: 'li' });
125
- this.listenTo(editor.editing.view.document, 'tab', (evt, data) => {
126
- const commandName = data.shiftKey ? 'outdentList' : 'indentList';
127
- const command = this.editor.commands.get(commandName);
128
- if (command.isEnabled) {
129
- editor.execute(commandName);
130
- data.stopPropagation();
131
- data.preventDefault();
132
- evt.stop();
133
- }
134
- }, { context: 'li' });
135
- }
136
- /**
137
- * @inheritDoc
138
- */
139
- afterInit() {
140
- const commands = this.editor.commands;
141
- const indent = commands.get('indent');
142
- const outdent = commands.get('outdent');
143
- if (indent) {
144
- indent.registerChildCommand(commands.get('indentList'));
145
- }
146
- if (outdent) {
147
- outdent.registerChildCommand(commands.get('outdentList'));
148
- }
149
- }
150
- }
151
- function getViewListItemLength(element) {
152
- let length = 1;
153
- for (const child of element.getChildren()) {
154
- if (child.name == 'ul' || child.name == 'ol') {
155
- for (const item of child.getChildren()) {
156
- length += getViewListItemLength(item);
157
- }
158
- }
159
- }
160
- return length;
161
- }
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/list/listediting
7
+ */
8
+ import ListCommand from './listcommand';
9
+ import IndentCommand from './indentcommand';
10
+ import ListUtils from './listutils';
11
+ import { Plugin } from 'ckeditor5/src/core';
12
+ import { Enter } from 'ckeditor5/src/enter';
13
+ import { Delete } from 'ckeditor5/src/typing';
14
+ import { cleanList, cleanListItem, modelViewInsertion, modelViewChangeType, modelViewMergeAfterChangeType, modelViewMergeAfter, modelViewRemove, modelViewSplitOnInsert, modelViewChangeIndent, modelChangePostFixer, modelIndentPasteFixer, viewModelConverter, modelToViewPosition, viewToModelPosition } from './converters';
15
+ import '../../theme/list.css';
16
+ /**
17
+ * The engine of the list feature. It handles creating, editing and removing lists and list items.
18
+ *
19
+ * It registers the `'numberedList'`, `'bulletedList'`, `'indentList'` and `'outdentList'` commands.
20
+ */
21
+ export default class ListEditing extends Plugin {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName() {
26
+ return 'ListEditing';
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get requires() {
32
+ return [Enter, Delete, ListUtils];
33
+ }
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ init() {
38
+ const editor = this.editor;
39
+ // Schema.
40
+ // Note: in case `$block` will ever be allowed in `listItem`, keep in mind that this feature
41
+ // uses `Selection#getSelectedBlocks()` without any additional processing to obtain all selected list items.
42
+ // If there are blocks allowed inside list item, algorithms using `getSelectedBlocks()` will have to be modified.
43
+ editor.model.schema.register('listItem', {
44
+ inheritAllFrom: '$block',
45
+ allowAttributes: ['listType', 'listIndent']
46
+ });
47
+ // Converters.
48
+ const data = editor.data;
49
+ const editing = editor.editing;
50
+ editor.model.document.registerPostFixer(writer => modelChangePostFixer(editor.model, writer));
51
+ editing.mapper.registerViewToModelLength('li', getViewListItemLength);
52
+ data.mapper.registerViewToModelLength('li', getViewListItemLength);
53
+ editing.mapper.on('modelToViewPosition', modelToViewPosition(editing.view));
54
+ editing.mapper.on('viewToModelPosition', viewToModelPosition(editor.model));
55
+ data.mapper.on('modelToViewPosition', modelToViewPosition(editing.view));
56
+ editor.conversion.for('editingDowncast')
57
+ .add(dispatcher => {
58
+ dispatcher.on('insert', modelViewSplitOnInsert, { priority: 'high' });
59
+ dispatcher.on('insert:listItem', modelViewInsertion(editor.model));
60
+ dispatcher.on('attribute:listType:listItem', modelViewChangeType, { priority: 'high' });
61
+ dispatcher.on('attribute:listType:listItem', modelViewMergeAfterChangeType, { priority: 'low' });
62
+ dispatcher.on('attribute:listIndent:listItem', modelViewChangeIndent(editor.model));
63
+ dispatcher.on('remove:listItem', modelViewRemove(editor.model));
64
+ dispatcher.on('remove', modelViewMergeAfter, { priority: 'low' });
65
+ });
66
+ editor.conversion.for('dataDowncast')
67
+ .add(dispatcher => {
68
+ dispatcher.on('insert', modelViewSplitOnInsert, { priority: 'high' });
69
+ dispatcher.on('insert:listItem', modelViewInsertion(editor.model));
70
+ });
71
+ editor.conversion.for('upcast')
72
+ .add(dispatcher => {
73
+ dispatcher.on('element:ul', cleanList, { priority: 'high' });
74
+ dispatcher.on('element:ol', cleanList, { priority: 'high' });
75
+ dispatcher.on('element:li', cleanListItem, { priority: 'high' });
76
+ dispatcher.on('element:li', viewModelConverter);
77
+ });
78
+ // Fix indentation of pasted items.
79
+ editor.model.on('insertContent', modelIndentPasteFixer, { priority: 'high' });
80
+ // Register commands for numbered and bulleted list.
81
+ editor.commands.add('numberedList', new ListCommand(editor, 'numbered'));
82
+ editor.commands.add('bulletedList', new ListCommand(editor, 'bulleted'));
83
+ // Register commands for indenting.
84
+ editor.commands.add('indentList', new IndentCommand(editor, 'forward'));
85
+ editor.commands.add('outdentList', new IndentCommand(editor, 'backward'));
86
+ const viewDocument = editing.view.document;
87
+ // Overwrite default Enter key behavior.
88
+ // If Enter key is pressed with selection collapsed in empty list item, outdent it instead of breaking it.
89
+ this.listenTo(viewDocument, 'enter', (evt, data) => {
90
+ const doc = this.editor.model.document;
91
+ const positionParent = doc.selection.getLastPosition().parent;
92
+ if (doc.selection.isCollapsed && positionParent.name == 'listItem' && positionParent.isEmpty) {
93
+ this.editor.execute('outdentList');
94
+ data.preventDefault();
95
+ evt.stop();
96
+ }
97
+ }, { context: 'li' });
98
+ // Overwrite default Backspace key behavior.
99
+ // If Backspace key is pressed with selection collapsed on first position in first list item, outdent it. #83
100
+ this.listenTo(viewDocument, 'delete', (evt, data) => {
101
+ // Check conditions from those that require less computations like those immediately available.
102
+ if (data.direction !== 'backward') {
103
+ return;
104
+ }
105
+ const selection = this.editor.model.document.selection;
106
+ if (!selection.isCollapsed) {
107
+ return;
108
+ }
109
+ const firstPosition = selection.getFirstPosition();
110
+ if (!firstPosition.isAtStart) {
111
+ return;
112
+ }
113
+ const positionParent = firstPosition.parent;
114
+ if (positionParent.name !== 'listItem') {
115
+ return;
116
+ }
117
+ const previousIsAListItem = positionParent.previousSibling && positionParent.previousSibling.name === 'listItem';
118
+ if (previousIsAListItem) {
119
+ return;
120
+ }
121
+ this.editor.execute('outdentList');
122
+ data.preventDefault();
123
+ evt.stop();
124
+ }, { context: 'li' });
125
+ this.listenTo(editor.editing.view.document, 'tab', (evt, data) => {
126
+ const commandName = data.shiftKey ? 'outdentList' : 'indentList';
127
+ const command = this.editor.commands.get(commandName);
128
+ if (command.isEnabled) {
129
+ editor.execute(commandName);
130
+ data.stopPropagation();
131
+ data.preventDefault();
132
+ evt.stop();
133
+ }
134
+ }, { context: 'li' });
135
+ }
136
+ /**
137
+ * @inheritDoc
138
+ */
139
+ afterInit() {
140
+ const commands = this.editor.commands;
141
+ const indent = commands.get('indent');
142
+ const outdent = commands.get('outdent');
143
+ if (indent) {
144
+ indent.registerChildCommand(commands.get('indentList'));
145
+ }
146
+ if (outdent) {
147
+ outdent.registerChildCommand(commands.get('outdentList'));
148
+ }
149
+ }
150
+ }
151
+ function getViewListItemLength(element) {
152
+ let length = 1;
153
+ for (const child of element.getChildren()) {
154
+ if (child.name == 'ul' || child.name == 'ol') {
155
+ for (const item of child.getChildren()) {
156
+ length += getViewListItemLength(item);
157
+ }
158
+ }
159
+ }
160
+ return length;
161
+ }
@@ -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
- import { Plugin } from 'ckeditor5/src/core';
6
- /**
7
- * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
8
- * allow to convert paragraphs to and from list items and indent or outdent them.
9
- */
10
- export default class ListUI extends Plugin {
11
- /**
12
- * @inheritDoc
13
- */
14
- static get pluginName(): "ListUI";
15
- /**
16
- * @inheritDoc
17
- */
18
- init(): void;
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
+ import { Plugin } from 'ckeditor5/src/core';
6
+ /**
7
+ * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
8
+ * allow to convert paragraphs to and from list items and indent or outdent them.
9
+ */
10
+ export default class ListUI extends Plugin {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static get pluginName(): "ListUI";
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ init(): void;
19
+ }
@@ -1,32 +1,32 @@
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/list/listui
7
- */
8
- import { createUIComponent } from './utils';
9
- import numberedListIcon from '../../theme/icons/numberedlist.svg';
10
- import bulletedListIcon from '../../theme/icons/bulletedlist.svg';
11
- import { Plugin } from 'ckeditor5/src/core';
12
- /**
13
- * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
14
- * allow to convert paragraphs to and from list items and indent or outdent them.
15
- */
16
- export default class ListUI extends Plugin {
17
- /**
18
- * @inheritDoc
19
- */
20
- static get pluginName() {
21
- return 'ListUI';
22
- }
23
- /**
24
- * @inheritDoc
25
- */
26
- init() {
27
- const t = this.editor.t;
28
- // Create two buttons and link them with numberedList and bulletedList commands.
29
- createUIComponent(this.editor, 'numberedList', t('Numbered List'), numberedListIcon);
30
- createUIComponent(this.editor, 'bulletedList', t('Bulleted List'), bulletedListIcon);
31
- }
32
- }
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/list/listui
7
+ */
8
+ import { createUIComponent } from './utils';
9
+ import numberedListIcon from '../../theme/icons/numberedlist.svg';
10
+ import bulletedListIcon from '../../theme/icons/bulletedlist.svg';
11
+ import { Plugin } from 'ckeditor5/src/core';
12
+ /**
13
+ * The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
14
+ * allow to convert paragraphs to and from list items and indent or outdent them.
15
+ */
16
+ export default class ListUI extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName() {
21
+ return 'ListUI';
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ init() {
27
+ const t = this.editor.t;
28
+ // Create two buttons and link them with numberedList and bulletedList commands.
29
+ createUIComponent(this.editor, 'numberedList', t('Numbered List'), numberedListIcon);
30
+ createUIComponent(this.editor, 'bulletedList', t('Bulleted List'), bulletedListIcon);
31
+ }
32
+ }
@@ -1,41 +1,41 @@
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/list/listutils
7
- */
8
- import type { Element, Model, Position } from 'ckeditor5/src/engine';
9
- import { Plugin } from 'ckeditor5/src/core';
10
- /**
11
- * A set of helpers related to document lists.
12
- */
13
- export default class ListUtils extends Plugin {
14
- /**
15
- * @inheritDoc
16
- */
17
- static get pluginName(): "ListUtils";
18
- /**
19
- * Checks whether the given list-style-type is supported by numbered or bulleted list.
20
- */
21
- getListTypeFromListStyleType(listStyleType: string): 'bulleted' | 'numbered' | null;
22
- /**
23
- * Returns an array with all `listItem` elements in the model selection.
24
- *
25
- * It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
26
- * If no list is selected, it returns an empty array.
27
- * The order of the elements is not specified.
28
- */
29
- getSelectedListItems(model: Model): Array<Element>;
30
- /**
31
- * Returns an array with all `listItem` elements that represent the same list.
32
- *
33
- * It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
34
- *
35
- * Additionally, if the `position` is inside a list item, that list item will be returned as well.
36
- *
37
- * @param position Starting position.
38
- * @param direction Walking direction.
39
- */
40
- getSiblingNodes(position: Position, direction: 'forward' | 'backward'): Array<Element>;
41
- }
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/list/listutils
7
+ */
8
+ import type { Element, Model, Position } from 'ckeditor5/src/engine';
9
+ import { Plugin } from 'ckeditor5/src/core';
10
+ /**
11
+ * A set of helpers related to document lists.
12
+ */
13
+ export default class ListUtils extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "ListUtils";
18
+ /**
19
+ * Checks whether the given list-style-type is supported by numbered or bulleted list.
20
+ */
21
+ getListTypeFromListStyleType(listStyleType: string): 'bulleted' | 'numbered' | null;
22
+ /**
23
+ * Returns an array with all `listItem` elements in the model selection.
24
+ *
25
+ * It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
26
+ * If no list is selected, it returns an empty array.
27
+ * The order of the elements is not specified.
28
+ */
29
+ getSelectedListItems(model: Model): Array<Element>;
30
+ /**
31
+ * Returns an array with all `listItem` elements that represent the same list.
32
+ *
33
+ * It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
34
+ *
35
+ * Additionally, if the `position` is inside a list item, that list item will be returned as well.
36
+ *
37
+ * @param position Starting position.
38
+ * @param direction Walking direction.
39
+ */
40
+ getSiblingNodes(position: Position, direction: 'forward' | 'backward'): Array<Element>;
41
+ }
@@ -1,46 +1,46 @@
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
- import { Plugin } from 'ckeditor5/src/core';
6
- import { getListTypeFromListStyleType, getSelectedListItems, getSiblingNodes } from './utils';
7
- /**
8
- * A set of helpers related to document lists.
9
- */
10
- export default class ListUtils extends Plugin {
11
- /**
12
- * @inheritDoc
13
- */
14
- static get pluginName() {
15
- return 'ListUtils';
16
- }
17
- /**
18
- * Checks whether the given list-style-type is supported by numbered or bulleted list.
19
- */
20
- getListTypeFromListStyleType(listStyleType) {
21
- return getListTypeFromListStyleType(listStyleType);
22
- }
23
- /**
24
- * Returns an array with all `listItem` elements in the model selection.
25
- *
26
- * It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
27
- * If no list is selected, it returns an empty array.
28
- * The order of the elements is not specified.
29
- */
30
- getSelectedListItems(model) {
31
- return getSelectedListItems(model);
32
- }
33
- /**
34
- * Returns an array with all `listItem` elements that represent the same list.
35
- *
36
- * It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
37
- *
38
- * Additionally, if the `position` is inside a list item, that list item will be returned as well.
39
- *
40
- * @param position Starting position.
41
- * @param direction Walking direction.
42
- */
43
- getSiblingNodes(position, direction) {
44
- return getSiblingNodes(position, direction);
45
- }
46
- }
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
+ import { Plugin } from 'ckeditor5/src/core';
6
+ import { getListTypeFromListStyleType, getSelectedListItems, getSiblingNodes } from './utils';
7
+ /**
8
+ * A set of helpers related to document lists.
9
+ */
10
+ export default class ListUtils extends Plugin {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static get pluginName() {
15
+ return 'ListUtils';
16
+ }
17
+ /**
18
+ * Checks whether the given list-style-type is supported by numbered or bulleted list.
19
+ */
20
+ getListTypeFromListStyleType(listStyleType) {
21
+ return getListTypeFromListStyleType(listStyleType);
22
+ }
23
+ /**
24
+ * Returns an array with all `listItem` elements in the model selection.
25
+ *
26
+ * It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
27
+ * If no list is selected, it returns an empty array.
28
+ * The order of the elements is not specified.
29
+ */
30
+ getSelectedListItems(model) {
31
+ return getSelectedListItems(model);
32
+ }
33
+ /**
34
+ * Returns an array with all `listItem` elements that represent the same list.
35
+ *
36
+ * It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
37
+ *
38
+ * Additionally, if the `position` is inside a list item, that list item will be returned as well.
39
+ *
40
+ * @param position Starting position.
41
+ * @param direction Walking direction.
42
+ */
43
+ getSiblingNodes(position, direction) {
44
+ return getSiblingNodes(position, direction);
45
+ }
46
+ }