@ckeditor/ckeditor5-list 39.0.2 → 40.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 (109) hide show
  1. package/build/list.js +1 -1
  2. package/build/list.js.map +1 -0
  3. package/build/translations/fi.js +1 -1
  4. package/build/translations/pt-br.js +1 -1
  5. package/ckeditor5-metadata.json +44 -0
  6. package/lang/translations/fi.po +1 -1
  7. package/lang/translations/pt-br.po +10 -10
  8. package/package.json +3 -3
  9. package/src/augmentation.d.ts +52 -50
  10. package/src/augmentation.js +5 -5
  11. package/src/documentlist/adjacentlistssupport.d.ts +15 -15
  12. package/src/documentlist/adjacentlistssupport.js +81 -81
  13. package/src/documentlist/converters.d.ts +65 -63
  14. package/src/documentlist/converters.js +441 -354
  15. package/src/documentlist/documentlistcommand.d.ts +80 -80
  16. package/src/documentlist/documentlistcommand.js +150 -145
  17. package/src/documentlist/documentlistediting.d.ts +212 -154
  18. package/src/documentlist/documentlistediting.js +645 -565
  19. package/src/documentlist/documentlistindentcommand.d.ts +62 -62
  20. package/src/documentlist/documentlistindentcommand.js +129 -129
  21. package/src/documentlist/documentlistmergecommand.d.ts +76 -76
  22. package/src/documentlist/documentlistmergecommand.js +174 -174
  23. package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
  24. package/src/documentlist/documentlistsplitcommand.js +70 -70
  25. package/src/documentlist/documentlistutils.d.ts +46 -46
  26. package/src/documentlist/documentlistutils.js +50 -50
  27. package/src/documentlist/utils/listwalker.d.ts +145 -141
  28. package/src/documentlist/utils/listwalker.js +182 -162
  29. package/src/documentlist/utils/model.d.ts +202 -193
  30. package/src/documentlist/utils/model.js +455 -435
  31. package/src/documentlist/utils/postfixers.d.ts +37 -37
  32. package/src/documentlist/utils/postfixers.js +126 -118
  33. package/src/documentlist/utils/view.d.ts +81 -81
  34. package/src/documentlist/utils/view.js +117 -117
  35. package/src/documentlist.d.ts +26 -26
  36. package/src/documentlist.js +30 -30
  37. package/src/documentlistproperties/converters.d.ts +19 -19
  38. package/src/documentlistproperties/converters.js +43 -43
  39. package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
  40. package/src/documentlistproperties/documentlistpropertiesediting.js +266 -289
  41. package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
  42. package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
  43. package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
  44. package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
  45. package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
  46. package/src/documentlistproperties/documentliststartcommand.js +57 -57
  47. package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
  48. package/src/documentlistproperties/documentliststylecommand.js +113 -113
  49. package/src/documentlistproperties/utils/style.d.ts +20 -20
  50. package/src/documentlistproperties/utils/style.js +54 -54
  51. package/src/documentlistproperties.d.ts +27 -27
  52. package/src/documentlistproperties.js +31 -31
  53. package/src/index.d.ts +43 -40
  54. package/src/index.js +29 -27
  55. package/src/list/converters.d.ts +196 -196
  56. package/src/list/converters.js +905 -905
  57. package/src/list/indentcommand.d.ts +37 -37
  58. package/src/list/indentcommand.js +107 -107
  59. package/src/list/listcommand.d.ts +55 -55
  60. package/src/list/listcommand.js +274 -274
  61. package/src/list/listediting.d.ts +32 -32
  62. package/src/list/listediting.js +161 -161
  63. package/src/list/listui.d.ts +19 -19
  64. package/src/list/listui.js +32 -32
  65. package/src/list/listutils.d.ts +41 -41
  66. package/src/list/listutils.js +46 -46
  67. package/src/list/utils.d.ts +112 -112
  68. package/src/list/utils.js +374 -374
  69. package/src/list.d.ts +26 -26
  70. package/src/list.js +30 -30
  71. package/src/listconfig.d.ts +132 -122
  72. package/src/listconfig.js +5 -5
  73. package/src/listproperties/listpropertiesediting.d.ts +72 -72
  74. package/src/listproperties/listpropertiesediting.js +696 -696
  75. package/src/listproperties/listpropertiesui.d.ts +23 -23
  76. package/src/listproperties/listpropertiesui.js +277 -277
  77. package/src/listproperties/listreversedcommand.d.ts +38 -38
  78. package/src/listproperties/listreversedcommand.js +52 -52
  79. package/src/listproperties/liststartcommand.d.ts +37 -37
  80. package/src/listproperties/liststartcommand.js +51 -51
  81. package/src/listproperties/liststylecommand.d.ts +67 -67
  82. package/src/listproperties/liststylecommand.js +99 -99
  83. package/src/listproperties/ui/collapsibleview.d.ts +63 -63
  84. package/src/listproperties/ui/collapsibleview.js +89 -89
  85. package/src/listproperties/ui/listpropertiesview.d.ts +157 -157
  86. package/src/listproperties/ui/listpropertiesview.js +299 -299
  87. package/src/listproperties.d.ts +26 -26
  88. package/src/listproperties.js +30 -30
  89. package/src/liststyle.d.ts +28 -28
  90. package/src/liststyle.js +36 -36
  91. package/src/tododocumentlist/checktododocumentlistcommand.d.ts +49 -0
  92. package/src/tododocumentlist/checktododocumentlistcommand.js +82 -0
  93. package/src/tododocumentlist/todocheckboxchangeobserver.d.ts +41 -0
  94. package/src/tododocumentlist/todocheckboxchangeobserver.js +37 -0
  95. package/src/tododocumentlist/tododocumentlistediting.d.ts +38 -0
  96. package/src/tododocumentlist/tododocumentlistediting.js +399 -0
  97. package/src/tododocumentlist.d.ts +27 -0
  98. package/src/tododocumentlist.js +31 -0
  99. package/src/todolist/checktodolistcommand.d.ts +52 -52
  100. package/src/todolist/checktodolistcommand.js +76 -76
  101. package/src/todolist/todolistconverters.d.ts +82 -82
  102. package/src/todolist/todolistconverters.js +260 -260
  103. package/src/todolist/todolistediting.d.ts +39 -39
  104. package/src/todolist/todolistediting.js +161 -161
  105. package/src/todolist/todolistui.d.ts +19 -19
  106. package/src/todolist/todolistui.js +29 -29
  107. package/src/todolist.d.ts +27 -27
  108. package/src/todolist.js +31 -31
  109. package/theme/todolist.css +101 -70
@@ -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
- import { Plugin } from 'ckeditor5/src/core';
6
- import { getCode, parseKeystroke, getLocalizedArrowKeyCodeDirection } from 'ckeditor5/src/utils';
7
- import ListCommand from '../list/listcommand';
8
- import ListEditing from '../list/listediting';
9
- import CheckTodoListCommand from './checktodolistcommand';
10
- import { dataModelViewInsertion, dataViewModelCheckmarkInsertion, mapModelToViewPosition, modelViewChangeChecked, modelViewChangeType, modelViewInsertion } from './todolistconverters';
11
- const ITEM_TOGGLE_KEYSTROKE = parseKeystroke('Ctrl+Enter');
12
- /**
13
- * The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
14
- *
15
- * It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin} and extends
16
- * it with the commands:
17
- *
18
- * - `'todoList'`,
19
- * - `'checkTodoList'`,
20
- * - `'todoListCheck'` as an alias for `checkTodoList` command.
21
- */
22
- export default class TodoListEditing extends Plugin {
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName() {
27
- return 'TodoListEditing';
28
- }
29
- /**
30
- * @inheritDoc
31
- */
32
- static get requires() {
33
- return [ListEditing];
34
- }
35
- /**
36
- * @inheritDoc
37
- */
38
- init() {
39
- const editor = this.editor;
40
- const { editing, data, model } = editor;
41
- // Extend schema.
42
- model.schema.extend('listItem', {
43
- allowAttributes: ['todoListChecked']
44
- });
45
- // Disallow todoListChecked attribute on other nodes than listItem with to-do listType.
46
- model.schema.addAttributeCheck((context, attributeName) => {
47
- const item = context.last;
48
- if (attributeName == 'todoListChecked' && item.name == 'listItem' && item.getAttribute('listType') != 'todo') {
49
- return false;
50
- }
51
- });
52
- // Register `todoList` command.
53
- editor.commands.add('todoList', new ListCommand(editor, 'todo'));
54
- const checkTodoListCommand = new CheckTodoListCommand(editor);
55
- // Register `checkTodoList` command and add `todoListCheck` command as an alias for backward compatibility.
56
- editor.commands.add('checkTodoList', checkTodoListCommand);
57
- editor.commands.add('todoListCheck', checkTodoListCommand);
58
- // Define converters.
59
- data.downcastDispatcher.on('insert:listItem', dataModelViewInsertion(model), { priority: 'high' });
60
- data.upcastDispatcher.on('element:input', dataViewModelCheckmarkInsertion, { priority: 'high' });
61
- editing.downcastDispatcher.on('insert:listItem', modelViewInsertion(model, listItem => this._handleCheckmarkChange(listItem)), { priority: 'high' });
62
- editing.downcastDispatcher.on('attribute:listType:listItem', modelViewChangeType(listItem => this._handleCheckmarkChange(listItem), editing.view));
63
- editing.downcastDispatcher.on('attribute:todoListChecked:listItem', modelViewChangeChecked(listItem => this._handleCheckmarkChange(listItem)));
64
- editing.mapper.on('modelToViewPosition', mapModelToViewPosition(editing.view));
65
- data.mapper.on('modelToViewPosition', mapModelToViewPosition(editing.view));
66
- // Jump at the end of the previous node on left arrow key press, when selection is after the checkbox.
67
- //
68
- // <blockquote><p>Foo</p></blockquote>
69
- // <ul><li><checkbox/>{}Bar</li></ul>
70
- //
71
- // press: `<-`
72
- //
73
- // <blockquote><p>Foo{}</p></blockquote>
74
- // <ul><li><checkbox/>Bar</li></ul>
75
- //
76
- this.listenTo(editing.view.document, 'arrowKey', jumpOverCheckmarkOnSideArrowKeyPress(model, editor.locale), { context: 'li' });
77
- // Toggle check state of selected to-do list items on keystroke.
78
- this.listenTo(editing.view.document, 'keydown', (evt, data) => {
79
- if (getCode(data) === ITEM_TOGGLE_KEYSTROKE) {
80
- editor.execute('checkTodoList');
81
- evt.stop();
82
- }
83
- }, { priority: 'high' });
84
- // Remove `todoListChecked` attribute when a host element is no longer a to-do list item.
85
- const listItemsToFix = new Set();
86
- this.listenTo(model, 'applyOperation', (evt, args) => {
87
- const operation = args[0];
88
- if (operation.type == 'rename' && operation.oldName == 'listItem') {
89
- const item = operation.position.nodeAfter;
90
- if (item.hasAttribute('todoListChecked')) {
91
- listItemsToFix.add(item);
92
- }
93
- }
94
- else if (operation.type == 'changeAttribute' && operation.key == 'listType' && operation.oldValue === 'todo') {
95
- for (const item of operation.range.getItems()) {
96
- if (item.hasAttribute('todoListChecked') && item.getAttribute('listType') !== 'todo') {
97
- listItemsToFix.add(item);
98
- }
99
- }
100
- }
101
- });
102
- model.document.registerPostFixer(writer => {
103
- let hasChanged = false;
104
- for (const listItem of listItemsToFix) {
105
- writer.removeAttribute('todoListChecked', listItem);
106
- hasChanged = true;
107
- }
108
- listItemsToFix.clear();
109
- return hasChanged;
110
- });
111
- }
112
- /**
113
- * Handles the checkbox element change, moves the selection to the corresponding model item to make it possible
114
- * to toggle the `todoListChecked` attribute using the command, and restores the selection position.
115
- *
116
- * Some say it's a hack :) Moving the selection only for executing the command on a certain node and restoring it after,
117
- * is not a clear solution. We need to design an API for using commands beyond the selection range.
118
- * See https://github.com/ckeditor/ckeditor5/issues/1954.
119
- */
120
- _handleCheckmarkChange(listItem) {
121
- const editor = this.editor;
122
- const model = editor.model;
123
- const previousSelectionRanges = Array.from(model.document.selection.getRanges());
124
- model.change(writer => {
125
- writer.setSelection(listItem, 'end');
126
- editor.execute('checkTodoList');
127
- writer.setSelection(previousSelectionRanges);
128
- });
129
- }
130
- }
131
- /**
132
- * Handles the left/right (LTR/RTL content) arrow key and moves the selection at the end of the previous block element
133
- * if the selection is just after the checkbox element. In other words, it jumps over the checkbox element when
134
- * moving the selection to the left/right (LTR/RTL).
135
- *
136
- * @returns Callback for 'keydown' events.
137
- */
138
- function jumpOverCheckmarkOnSideArrowKeyPress(model, locale) {
139
- return (eventInfo, domEventData) => {
140
- const direction = getLocalizedArrowKeyCodeDirection(domEventData.keyCode, locale.contentLanguageDirection);
141
- if (direction != 'left') {
142
- return;
143
- }
144
- const schema = model.schema;
145
- const selection = model.document.selection;
146
- if (!selection.isCollapsed) {
147
- return;
148
- }
149
- const position = selection.getFirstPosition();
150
- const parent = position.parent;
151
- if (parent.name === 'listItem' && parent.getAttribute('listType') == 'todo' && position.isAtStart) {
152
- const newRange = schema.getNearestSelectionRange(model.createPositionBefore(parent), 'backward');
153
- if (newRange) {
154
- model.change(writer => writer.setSelection(newRange));
155
- }
156
- domEventData.preventDefault();
157
- domEventData.stopPropagation();
158
- eventInfo.stop();
159
- }
160
- };
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
+ import { Plugin } from 'ckeditor5/src/core';
6
+ import { getCode, parseKeystroke, getLocalizedArrowKeyCodeDirection } from 'ckeditor5/src/utils';
7
+ import ListCommand from '../list/listcommand';
8
+ import ListEditing from '../list/listediting';
9
+ import CheckTodoListCommand from './checktodolistcommand';
10
+ import { dataModelViewInsertion, dataViewModelCheckmarkInsertion, mapModelToViewPosition, modelViewChangeChecked, modelViewChangeType, modelViewInsertion } from './todolistconverters';
11
+ const ITEM_TOGGLE_KEYSTROKE = parseKeystroke('Ctrl+Enter');
12
+ /**
13
+ * The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
14
+ *
15
+ * It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin} and extends
16
+ * it with the commands:
17
+ *
18
+ * - `'todoList'`,
19
+ * - `'checkTodoList'`,
20
+ * - `'todoListCheck'` as an alias for `checkTodoList` command.
21
+ */
22
+ export default class TodoListEditing extends Plugin {
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName() {
27
+ return 'TodoListEditing';
28
+ }
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get requires() {
33
+ return [ListEditing];
34
+ }
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ init() {
39
+ const editor = this.editor;
40
+ const { editing, data, model } = editor;
41
+ // Extend schema.
42
+ model.schema.extend('listItem', {
43
+ allowAttributes: ['todoListChecked']
44
+ });
45
+ // Disallow todoListChecked attribute on other nodes than listItem with to-do listType.
46
+ model.schema.addAttributeCheck((context, attributeName) => {
47
+ const item = context.last;
48
+ if (attributeName == 'todoListChecked' && item.name == 'listItem' && item.getAttribute('listType') != 'todo') {
49
+ return false;
50
+ }
51
+ });
52
+ // Register `todoList` command.
53
+ editor.commands.add('todoList', new ListCommand(editor, 'todo'));
54
+ const checkTodoListCommand = new CheckTodoListCommand(editor);
55
+ // Register `checkTodoList` command and add `todoListCheck` command as an alias for backward compatibility.
56
+ editor.commands.add('checkTodoList', checkTodoListCommand);
57
+ editor.commands.add('todoListCheck', checkTodoListCommand);
58
+ // Define converters.
59
+ data.downcastDispatcher.on('insert:listItem', dataModelViewInsertion(model), { priority: 'high' });
60
+ data.upcastDispatcher.on('element:input', dataViewModelCheckmarkInsertion, { priority: 'high' });
61
+ editing.downcastDispatcher.on('insert:listItem', modelViewInsertion(model, listItem => this._handleCheckmarkChange(listItem)), { priority: 'high' });
62
+ editing.downcastDispatcher.on('attribute:listType:listItem', modelViewChangeType(listItem => this._handleCheckmarkChange(listItem), editing.view));
63
+ editing.downcastDispatcher.on('attribute:todoListChecked:listItem', modelViewChangeChecked(listItem => this._handleCheckmarkChange(listItem)));
64
+ editing.mapper.on('modelToViewPosition', mapModelToViewPosition(editing.view));
65
+ data.mapper.on('modelToViewPosition', mapModelToViewPosition(editing.view));
66
+ // Jump at the end of the previous node on left arrow key press, when selection is after the checkbox.
67
+ //
68
+ // <blockquote><p>Foo</p></blockquote>
69
+ // <ul><li><checkbox/>{}Bar</li></ul>
70
+ //
71
+ // press: `<-`
72
+ //
73
+ // <blockquote><p>Foo{}</p></blockquote>
74
+ // <ul><li><checkbox/>Bar</li></ul>
75
+ //
76
+ this.listenTo(editing.view.document, 'arrowKey', jumpOverCheckmarkOnSideArrowKeyPress(model, editor.locale), { context: 'li' });
77
+ // Toggle check state of selected to-do list items on keystroke.
78
+ this.listenTo(editing.view.document, 'keydown', (evt, data) => {
79
+ if (getCode(data) === ITEM_TOGGLE_KEYSTROKE) {
80
+ editor.execute('checkTodoList');
81
+ evt.stop();
82
+ }
83
+ }, { priority: 'high' });
84
+ // Remove `todoListChecked` attribute when a host element is no longer a to-do list item.
85
+ const listItemsToFix = new Set();
86
+ this.listenTo(model, 'applyOperation', (evt, args) => {
87
+ const operation = args[0];
88
+ if (operation.type == 'rename' && operation.oldName == 'listItem') {
89
+ const item = operation.position.nodeAfter;
90
+ if (item.hasAttribute('todoListChecked')) {
91
+ listItemsToFix.add(item);
92
+ }
93
+ }
94
+ else if (operation.type == 'changeAttribute' && operation.key == 'listType' && operation.oldValue === 'todo') {
95
+ for (const item of operation.range.getItems()) {
96
+ if (item.hasAttribute('todoListChecked') && item.getAttribute('listType') !== 'todo') {
97
+ listItemsToFix.add(item);
98
+ }
99
+ }
100
+ }
101
+ });
102
+ model.document.registerPostFixer(writer => {
103
+ let hasChanged = false;
104
+ for (const listItem of listItemsToFix) {
105
+ writer.removeAttribute('todoListChecked', listItem);
106
+ hasChanged = true;
107
+ }
108
+ listItemsToFix.clear();
109
+ return hasChanged;
110
+ });
111
+ }
112
+ /**
113
+ * Handles the checkbox element change, moves the selection to the corresponding model item to make it possible
114
+ * to toggle the `todoListChecked` attribute using the command, and restores the selection position.
115
+ *
116
+ * Some say it's a hack :) Moving the selection only for executing the command on a certain node and restoring it after,
117
+ * is not a clear solution. We need to design an API for using commands beyond the selection range.
118
+ * See https://github.com/ckeditor/ckeditor5/issues/1954.
119
+ */
120
+ _handleCheckmarkChange(listItem) {
121
+ const editor = this.editor;
122
+ const model = editor.model;
123
+ const previousSelectionRanges = Array.from(model.document.selection.getRanges());
124
+ model.change(writer => {
125
+ writer.setSelection(listItem, 'end');
126
+ editor.execute('checkTodoList');
127
+ writer.setSelection(previousSelectionRanges);
128
+ });
129
+ }
130
+ }
131
+ /**
132
+ * Handles the left/right (LTR/RTL content) arrow key and moves the selection at the end of the previous block element
133
+ * if the selection is just after the checkbox element. In other words, it jumps over the checkbox element when
134
+ * moving the selection to the left/right (LTR/RTL).
135
+ *
136
+ * @returns Callback for 'keydown' events.
137
+ */
138
+ function jumpOverCheckmarkOnSideArrowKeyPress(model, locale) {
139
+ return (eventInfo, domEventData) => {
140
+ const direction = getLocalizedArrowKeyCodeDirection(domEventData.keyCode, locale.contentLanguageDirection);
141
+ if (direction != 'left') {
142
+ return;
143
+ }
144
+ const schema = model.schema;
145
+ const selection = model.document.selection;
146
+ if (!selection.isCollapsed) {
147
+ return;
148
+ }
149
+ const position = selection.getFirstPosition();
150
+ const parent = position.parent;
151
+ if (parent.name === 'listItem' && parent.getAttribute('listType') == 'todo' && position.isAtStart) {
152
+ const newRange = schema.getNearestSelectionRange(model.createPositionBefore(parent), 'backward');
153
+ if (newRange) {
154
+ model.change(writer => writer.setSelection(newRange));
155
+ }
156
+ domEventData.preventDefault();
157
+ domEventData.stopPropagation();
158
+ eventInfo.stop();
159
+ }
160
+ };
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 to-do list UI feature. It introduces the `'todoList'` button that
8
- * allows to convert elements to and from to-do list items and to indent or outdent them.
9
- */
10
- export default class TodoListUI extends Plugin {
11
- /**
12
- * @inheritDoc
13
- */
14
- static get pluginName(): "TodoListUI";
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 to-do list UI feature. It introduces the `'todoList'` button that
8
+ * allows to convert elements to and from to-do list items and to indent or outdent them.
9
+ */
10
+ export default class TodoListUI extends Plugin {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static get pluginName(): "TodoListUI";
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ init(): void;
19
+ }
@@ -1,29 +1,29 @@
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/todolistui
7
- */
8
- import { createUIComponent } from '../list/utils';
9
- import todoListIcon from '../../theme/icons/todolist.svg';
10
- import { Plugin } from 'ckeditor5/src/core';
11
- /**
12
- * The to-do list UI feature. It introduces the `'todoList'` button that
13
- * allows to convert elements to and from to-do list items and to indent or outdent them.
14
- */
15
- export default class TodoListUI extends Plugin {
16
- /**
17
- * @inheritDoc
18
- */
19
- static get pluginName() {
20
- return 'TodoListUI';
21
- }
22
- /**
23
- * @inheritDoc
24
- */
25
- init() {
26
- const t = this.editor.t;
27
- createUIComponent(this.editor, 'todoList', t('To-do List'), todoListIcon);
28
- }
29
- }
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/todolistui
7
+ */
8
+ import { createUIComponent } from '../list/utils';
9
+ import todoListIcon from '../../theme/icons/todolist.svg';
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ /**
12
+ * The to-do list UI feature. It introduces the `'todoList'` button that
13
+ * allows to convert elements to and from to-do list items and to indent or outdent them.
14
+ */
15
+ export default class TodoListUI extends Plugin {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName() {
20
+ return 'TodoListUI';
21
+ }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init() {
26
+ const t = this.editor.t;
27
+ createUIComponent(this.editor, 'todoList', t('To-do List'), todoListIcon);
28
+ }
29
+ }
package/src/todolist.d.ts CHANGED
@@ -1,27 +1,27 @@
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
7
- */
8
- import TodoListEditing from './todolist/todolistediting';
9
- import TodoListUI from './todolist/todolistui';
10
- import { Plugin } from 'ckeditor5/src/core';
11
- import '../theme/todolist.css';
12
- /**
13
- * The to-do list feature.
14
- *
15
- * This is a "glue" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list editing feature}
16
- * and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
17
- */
18
- export default class TodoList extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get requires(): readonly [typeof TodoListEditing, typeof TodoListUI];
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName(): "TodoList";
27
- }
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
7
+ */
8
+ import TodoListEditing from './todolist/todolistediting';
9
+ import TodoListUI from './todolist/todolistui';
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import '../theme/todolist.css';
12
+ /**
13
+ * The to-do list feature.
14
+ *
15
+ * This is a "glue" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list editing feature}
16
+ * and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
17
+ */
18
+ export default class TodoList extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof TodoListEditing, typeof TodoListUI];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "TodoList";
27
+ }
package/src/todolist.js CHANGED
@@ -1,31 +1,31 @@
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
7
- */
8
- import TodoListEditing from './todolist/todolistediting';
9
- import TodoListUI from './todolist/todolistui';
10
- import { Plugin } from 'ckeditor5/src/core';
11
- import '../theme/todolist.css';
12
- /**
13
- * The to-do list feature.
14
- *
15
- * This is a "glue" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list editing feature}
16
- * and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
17
- */
18
- export default class TodoList extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get requires() {
23
- return [TodoListEditing, TodoListUI];
24
- }
25
- /**
26
- * @inheritDoc
27
- */
28
- static get pluginName() {
29
- return 'TodoList';
30
- }
31
- }
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
7
+ */
8
+ import TodoListEditing from './todolist/todolistediting';
9
+ import TodoListUI from './todolist/todolistui';
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import '../theme/todolist.css';
12
+ /**
13
+ * The to-do list feature.
14
+ *
15
+ * This is a "glue" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list editing feature}
16
+ * and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
17
+ */
18
+ export default class TodoList extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires() {
23
+ return [TodoListEditing, TodoListUI];
24
+ }
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get pluginName() {
29
+ return 'TodoList';
30
+ }
31
+ }