@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.
- package/build/list.js +1 -1
- package/build/list.js.map +1 -0
- package/build/translations/fi.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/ckeditor5-metadata.json +44 -0
- package/lang/translations/fi.po +1 -1
- package/lang/translations/pt-br.po +10 -10
- package/package.json +3 -3
- package/src/augmentation.d.ts +52 -50
- package/src/augmentation.js +5 -5
- package/src/documentlist/adjacentlistssupport.d.ts +15 -15
- package/src/documentlist/adjacentlistssupport.js +81 -81
- package/src/documentlist/converters.d.ts +65 -63
- package/src/documentlist/converters.js +441 -354
- package/src/documentlist/documentlistcommand.d.ts +80 -80
- package/src/documentlist/documentlistcommand.js +150 -145
- package/src/documentlist/documentlistediting.d.ts +212 -154
- package/src/documentlist/documentlistediting.js +645 -565
- package/src/documentlist/documentlistindentcommand.d.ts +62 -62
- package/src/documentlist/documentlistindentcommand.js +129 -129
- package/src/documentlist/documentlistmergecommand.d.ts +76 -76
- package/src/documentlist/documentlistmergecommand.js +174 -174
- package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
- package/src/documentlist/documentlistsplitcommand.js +70 -70
- package/src/documentlist/documentlistutils.d.ts +46 -46
- package/src/documentlist/documentlistutils.js +50 -50
- package/src/documentlist/utils/listwalker.d.ts +145 -141
- package/src/documentlist/utils/listwalker.js +182 -162
- package/src/documentlist/utils/model.d.ts +202 -193
- package/src/documentlist/utils/model.js +455 -435
- package/src/documentlist/utils/postfixers.d.ts +37 -37
- package/src/documentlist/utils/postfixers.js +126 -118
- package/src/documentlist/utils/view.d.ts +81 -81
- package/src/documentlist/utils/view.js +117 -117
- package/src/documentlist.d.ts +26 -26
- package/src/documentlist.js +30 -30
- package/src/documentlistproperties/converters.d.ts +19 -19
- package/src/documentlistproperties/converters.js +43 -43
- package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
- package/src/documentlistproperties/documentlistpropertiesediting.js +266 -289
- package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
- package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
- package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
- package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
- package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
- package/src/documentlistproperties/documentliststartcommand.js +57 -57
- package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
- package/src/documentlistproperties/documentliststylecommand.js +113 -113
- package/src/documentlistproperties/utils/style.d.ts +20 -20
- package/src/documentlistproperties/utils/style.js +54 -54
- package/src/documentlistproperties.d.ts +27 -27
- package/src/documentlistproperties.js +31 -31
- package/src/index.d.ts +43 -40
- package/src/index.js +29 -27
- package/src/list/converters.d.ts +196 -196
- package/src/list/converters.js +905 -905
- package/src/list/indentcommand.d.ts +37 -37
- package/src/list/indentcommand.js +107 -107
- package/src/list/listcommand.d.ts +55 -55
- package/src/list/listcommand.js +274 -274
- package/src/list/listediting.d.ts +32 -32
- package/src/list/listediting.js +161 -161
- package/src/list/listui.d.ts +19 -19
- package/src/list/listui.js +32 -32
- package/src/list/listutils.d.ts +41 -41
- package/src/list/listutils.js +46 -46
- package/src/list/utils.d.ts +112 -112
- package/src/list/utils.js +374 -374
- package/src/list.d.ts +26 -26
- package/src/list.js +30 -30
- package/src/listconfig.d.ts +132 -122
- package/src/listconfig.js +5 -5
- package/src/listproperties/listpropertiesediting.d.ts +72 -72
- package/src/listproperties/listpropertiesediting.js +696 -696
- package/src/listproperties/listpropertiesui.d.ts +23 -23
- package/src/listproperties/listpropertiesui.js +277 -277
- package/src/listproperties/listreversedcommand.d.ts +38 -38
- package/src/listproperties/listreversedcommand.js +52 -52
- package/src/listproperties/liststartcommand.d.ts +37 -37
- package/src/listproperties/liststartcommand.js +51 -51
- package/src/listproperties/liststylecommand.d.ts +67 -67
- package/src/listproperties/liststylecommand.js +99 -99
- package/src/listproperties/ui/collapsibleview.d.ts +63 -63
- package/src/listproperties/ui/collapsibleview.js +89 -89
- package/src/listproperties/ui/listpropertiesview.d.ts +157 -157
- package/src/listproperties/ui/listpropertiesview.js +299 -299
- package/src/listproperties.d.ts +26 -26
- package/src/listproperties.js +30 -30
- package/src/liststyle.d.ts +28 -28
- package/src/liststyle.js +36 -36
- package/src/tododocumentlist/checktododocumentlistcommand.d.ts +49 -0
- package/src/tododocumentlist/checktododocumentlistcommand.js +82 -0
- package/src/tododocumentlist/todocheckboxchangeobserver.d.ts +41 -0
- package/src/tododocumentlist/todocheckboxchangeobserver.js +37 -0
- package/src/tododocumentlist/tododocumentlistediting.d.ts +38 -0
- package/src/tododocumentlist/tododocumentlistediting.js +399 -0
- package/src/tododocumentlist.d.ts +27 -0
- package/src/tododocumentlist.js +31 -0
- package/src/todolist/checktodolistcommand.d.ts +52 -52
- package/src/todolist/checktodolistcommand.js +76 -76
- package/src/todolist/todolistconverters.d.ts +82 -82
- package/src/todolist/todolistconverters.js +260 -260
- package/src/todolist/todolistediting.d.ts +39 -39
- package/src/todolist/todolistediting.js +161 -161
- package/src/todolist/todolistui.d.ts +19 -19
- package/src/todolist/todolistui.js +29 -29
- package/src/todolist.d.ts +27 -27
- package/src/todolist.js +31 -31
- package/theme/todolist.css +101 -70
|
@@ -1,37 +1,37 @@
|
|
|
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 { Command, type Editor } from 'ckeditor5/src/core';
|
|
6
|
-
/**
|
|
7
|
-
* The list indent command. It is used by the {@link module:list/list~List list feature}.
|
|
8
|
-
*/
|
|
9
|
-
export default class IndentCommand extends Command {
|
|
10
|
-
/**
|
|
11
|
-
* Determines by how much the command will change the list item's indent attribute.
|
|
12
|
-
*/
|
|
13
|
-
private readonly _indentBy;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an instance of the command.
|
|
16
|
-
*
|
|
17
|
-
* @param editor The editor instance.
|
|
18
|
-
* @param indentDirection The direction of indent. If it is equal to `backward`, the command will outdent a list item.
|
|
19
|
-
*/
|
|
20
|
-
constructor(editor: Editor, indentDirection: 'forward' | 'backward');
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
refresh(): void;
|
|
25
|
-
/**
|
|
26
|
-
* Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
|
|
27
|
-
*
|
|
28
|
-
* @fires execute
|
|
29
|
-
*/
|
|
30
|
-
execute(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Checks whether the command can be enabled in the current context.
|
|
33
|
-
*
|
|
34
|
-
* @returns Whether the command should be enabled.
|
|
35
|
-
*/
|
|
36
|
-
private _checkEnabled;
|
|
37
|
-
}
|
|
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 { Command, type Editor } from 'ckeditor5/src/core';
|
|
6
|
+
/**
|
|
7
|
+
* The list indent command. It is used by the {@link module:list/list~List list feature}.
|
|
8
|
+
*/
|
|
9
|
+
export default class IndentCommand extends Command {
|
|
10
|
+
/**
|
|
11
|
+
* Determines by how much the command will change the list item's indent attribute.
|
|
12
|
+
*/
|
|
13
|
+
private readonly _indentBy;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of the command.
|
|
16
|
+
*
|
|
17
|
+
* @param editor The editor instance.
|
|
18
|
+
* @param indentDirection The direction of indent. If it is equal to `backward`, the command will outdent a list item.
|
|
19
|
+
*/
|
|
20
|
+
constructor(editor: Editor, indentDirection: 'forward' | 'backward');
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
refresh(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
|
|
27
|
+
*
|
|
28
|
+
* @fires execute
|
|
29
|
+
*/
|
|
30
|
+
execute(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Checks whether the command can be enabled in the current context.
|
|
33
|
+
*
|
|
34
|
+
* @returns Whether the command should be enabled.
|
|
35
|
+
*/
|
|
36
|
+
private _checkEnabled;
|
|
37
|
+
}
|
|
@@ -1,107 +1,107 @@
|
|
|
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 { Command } from 'ckeditor5/src/core';
|
|
6
|
-
import { first } from 'ckeditor5/src/utils';
|
|
7
|
-
/**
|
|
8
|
-
* The list indent command. It is used by the {@link module:list/list~List list feature}.
|
|
9
|
-
*/
|
|
10
|
-
export default class IndentCommand extends Command {
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of the command.
|
|
13
|
-
*
|
|
14
|
-
* @param editor The editor instance.
|
|
15
|
-
* @param indentDirection The direction of indent. If it is equal to `backward`, the command will outdent a list item.
|
|
16
|
-
*/
|
|
17
|
-
constructor(editor, indentDirection) {
|
|
18
|
-
super(editor);
|
|
19
|
-
this._indentBy = indentDirection == 'forward' ? 1 : -1;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
refresh() {
|
|
25
|
-
this.isEnabled = this._checkEnabled();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
|
|
29
|
-
*
|
|
30
|
-
* @fires execute
|
|
31
|
-
*/
|
|
32
|
-
execute() {
|
|
33
|
-
const model = this.editor.model;
|
|
34
|
-
const doc = model.document;
|
|
35
|
-
let itemsToChange = Array.from(doc.selection.getSelectedBlocks());
|
|
36
|
-
model.change(writer => {
|
|
37
|
-
const lastItem = itemsToChange[itemsToChange.length - 1];
|
|
38
|
-
// Indenting a list item should also indent all the items that are already sub-items of indented item.
|
|
39
|
-
let next = lastItem.nextSibling;
|
|
40
|
-
// Check all items after last indented item, as long as their indent is bigger than indent of that item.
|
|
41
|
-
while (next && next.name == 'listItem' &&
|
|
42
|
-
next.getAttribute('listIndent') > lastItem.getAttribute('listIndent')) {
|
|
43
|
-
itemsToChange.push(next);
|
|
44
|
-
next = next.nextSibling;
|
|
45
|
-
}
|
|
46
|
-
// We need to be sure to keep model in correct state after each small change, because converters
|
|
47
|
-
// bases on that state and assumes that model is correct.
|
|
48
|
-
// Because of that, if the command outdents items, we will outdent them starting from the last item, as
|
|
49
|
-
// it is safer.
|
|
50
|
-
if (this._indentBy < 0) {
|
|
51
|
-
itemsToChange = itemsToChange.reverse();
|
|
52
|
-
}
|
|
53
|
-
for (const item of itemsToChange) {
|
|
54
|
-
const indent = item.getAttribute('listIndent') + this._indentBy;
|
|
55
|
-
// If indent is lower than 0, it means that the item got outdented when it was not indented.
|
|
56
|
-
// This means that we need to convert that list item to paragraph.
|
|
57
|
-
if (indent < 0) {
|
|
58
|
-
// To keep the model as correct as possible, first rename listItem, then remove attributes,
|
|
59
|
-
// as listItem without attributes is very incorrect and will cause problems in converters.
|
|
60
|
-
// No need to remove attributes, will be removed by post fixer.
|
|
61
|
-
writer.rename(item, 'paragraph');
|
|
62
|
-
}
|
|
63
|
-
// If indent is >= 0, change the attribute value.
|
|
64
|
-
else {
|
|
65
|
-
writer.setAttribute('listIndent', indent, item);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// It allows to execute an action after executing the `~IndentCommand#execute` method, for example adjusting
|
|
69
|
-
// attributes of changed list items.
|
|
70
|
-
this.fire('_executeCleanup', itemsToChange);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Checks whether the command can be enabled in the current context.
|
|
75
|
-
*
|
|
76
|
-
* @returns Whether the command should be enabled.
|
|
77
|
-
*/
|
|
78
|
-
_checkEnabled() {
|
|
79
|
-
// Check whether any of position's ancestor is a list item.
|
|
80
|
-
const listItem = first(this.editor.model.document.selection.getSelectedBlocks());
|
|
81
|
-
// If selection is not in a list item, the command is disabled.
|
|
82
|
-
if (!listItem || !listItem.is('element', 'listItem')) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
if (this._indentBy > 0) {
|
|
86
|
-
// Cannot indent first item in it's list. Check if before `listItem` is a list item that is in same list.
|
|
87
|
-
// To be in the same list, the item has to have same attributes and cannot be "split" by an item with lower indent.
|
|
88
|
-
const indent = listItem.getAttribute('listIndent');
|
|
89
|
-
const type = listItem.getAttribute('listType');
|
|
90
|
-
let prev = listItem.previousSibling;
|
|
91
|
-
while (prev && prev.is('element', 'listItem') && prev.getAttribute('listIndent') >= indent) {
|
|
92
|
-
if (prev.getAttribute('listIndent') == indent) {
|
|
93
|
-
// The item is on the same level.
|
|
94
|
-
// If it has same type, it means that we found a preceding sibling from the same list.
|
|
95
|
-
// If it does not have same type, it means that `listItem` is on different list (this can happen only
|
|
96
|
-
// on top level lists, though).
|
|
97
|
-
return prev.getAttribute('listType') == type;
|
|
98
|
-
}
|
|
99
|
-
prev = prev.previousSibling;
|
|
100
|
-
}
|
|
101
|
-
// Could not find similar list item, this means that `listItem` is first in its list.
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
// If we are outdenting it is enough to be in list item. Every list item can always be outdented.
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
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 { Command } from 'ckeditor5/src/core';
|
|
6
|
+
import { first } from 'ckeditor5/src/utils';
|
|
7
|
+
/**
|
|
8
|
+
* The list indent command. It is used by the {@link module:list/list~List list feature}.
|
|
9
|
+
*/
|
|
10
|
+
export default class IndentCommand extends Command {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the command.
|
|
13
|
+
*
|
|
14
|
+
* @param editor The editor instance.
|
|
15
|
+
* @param indentDirection The direction of indent. If it is equal to `backward`, the command will outdent a list item.
|
|
16
|
+
*/
|
|
17
|
+
constructor(editor, indentDirection) {
|
|
18
|
+
super(editor);
|
|
19
|
+
this._indentBy = indentDirection == 'forward' ? 1 : -1;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
refresh() {
|
|
25
|
+
this.isEnabled = this._checkEnabled();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
|
|
29
|
+
*
|
|
30
|
+
* @fires execute
|
|
31
|
+
*/
|
|
32
|
+
execute() {
|
|
33
|
+
const model = this.editor.model;
|
|
34
|
+
const doc = model.document;
|
|
35
|
+
let itemsToChange = Array.from(doc.selection.getSelectedBlocks());
|
|
36
|
+
model.change(writer => {
|
|
37
|
+
const lastItem = itemsToChange[itemsToChange.length - 1];
|
|
38
|
+
// Indenting a list item should also indent all the items that are already sub-items of indented item.
|
|
39
|
+
let next = lastItem.nextSibling;
|
|
40
|
+
// Check all items after last indented item, as long as their indent is bigger than indent of that item.
|
|
41
|
+
while (next && next.name == 'listItem' &&
|
|
42
|
+
next.getAttribute('listIndent') > lastItem.getAttribute('listIndent')) {
|
|
43
|
+
itemsToChange.push(next);
|
|
44
|
+
next = next.nextSibling;
|
|
45
|
+
}
|
|
46
|
+
// We need to be sure to keep model in correct state after each small change, because converters
|
|
47
|
+
// bases on that state and assumes that model is correct.
|
|
48
|
+
// Because of that, if the command outdents items, we will outdent them starting from the last item, as
|
|
49
|
+
// it is safer.
|
|
50
|
+
if (this._indentBy < 0) {
|
|
51
|
+
itemsToChange = itemsToChange.reverse();
|
|
52
|
+
}
|
|
53
|
+
for (const item of itemsToChange) {
|
|
54
|
+
const indent = item.getAttribute('listIndent') + this._indentBy;
|
|
55
|
+
// If indent is lower than 0, it means that the item got outdented when it was not indented.
|
|
56
|
+
// This means that we need to convert that list item to paragraph.
|
|
57
|
+
if (indent < 0) {
|
|
58
|
+
// To keep the model as correct as possible, first rename listItem, then remove attributes,
|
|
59
|
+
// as listItem without attributes is very incorrect and will cause problems in converters.
|
|
60
|
+
// No need to remove attributes, will be removed by post fixer.
|
|
61
|
+
writer.rename(item, 'paragraph');
|
|
62
|
+
}
|
|
63
|
+
// If indent is >= 0, change the attribute value.
|
|
64
|
+
else {
|
|
65
|
+
writer.setAttribute('listIndent', indent, item);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// It allows to execute an action after executing the `~IndentCommand#execute` method, for example adjusting
|
|
69
|
+
// attributes of changed list items.
|
|
70
|
+
this.fire('_executeCleanup', itemsToChange);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks whether the command can be enabled in the current context.
|
|
75
|
+
*
|
|
76
|
+
* @returns Whether the command should be enabled.
|
|
77
|
+
*/
|
|
78
|
+
_checkEnabled() {
|
|
79
|
+
// Check whether any of position's ancestor is a list item.
|
|
80
|
+
const listItem = first(this.editor.model.document.selection.getSelectedBlocks());
|
|
81
|
+
// If selection is not in a list item, the command is disabled.
|
|
82
|
+
if (!listItem || !listItem.is('element', 'listItem')) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (this._indentBy > 0) {
|
|
86
|
+
// Cannot indent first item in it's list. Check if before `listItem` is a list item that is in same list.
|
|
87
|
+
// To be in the same list, the item has to have same attributes and cannot be "split" by an item with lower indent.
|
|
88
|
+
const indent = listItem.getAttribute('listIndent');
|
|
89
|
+
const type = listItem.getAttribute('listType');
|
|
90
|
+
let prev = listItem.previousSibling;
|
|
91
|
+
while (prev && prev.is('element', 'listItem') && prev.getAttribute('listIndent') >= indent) {
|
|
92
|
+
if (prev.getAttribute('listIndent') == indent) {
|
|
93
|
+
// The item is on the same level.
|
|
94
|
+
// If it has same type, it means that we found a preceding sibling from the same list.
|
|
95
|
+
// If it does not have same type, it means that `listItem` is on different list (this can happen only
|
|
96
|
+
// on top level lists, though).
|
|
97
|
+
return prev.getAttribute('listType') == type;
|
|
98
|
+
}
|
|
99
|
+
prev = prev.previousSibling;
|
|
100
|
+
}
|
|
101
|
+
// Could not find similar list item, this means that `listItem` is first in its list.
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
// If we are outdenting it is enough to be in list item. Every list item can always be outdented.
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,55 +1,55 @@
|
|
|
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 { Command, type Editor } from 'ckeditor5/src/core';
|
|
6
|
-
/**
|
|
7
|
-
* The list command. It is used by the {@link module:list/list~List list feature}.
|
|
8
|
-
*/
|
|
9
|
-
export default class ListCommand extends Command {
|
|
10
|
-
/**
|
|
11
|
-
* The type of the list created by the command.
|
|
12
|
-
*/
|
|
13
|
-
readonly type: 'numbered' | 'bulleted' | 'todo';
|
|
14
|
-
/**
|
|
15
|
-
* A flag indicating whether the command is active, which means that the selection starts in a list of the same type.
|
|
16
|
-
*
|
|
17
|
-
* @readonly
|
|
18
|
-
*/
|
|
19
|
-
value: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Creates an instance of the command.
|
|
22
|
-
*
|
|
23
|
-
* @param editor The editor instance.
|
|
24
|
-
* @param type List type that will be handled by this command.
|
|
25
|
-
*/
|
|
26
|
-
constructor(editor: Editor, type: 'numbered' | 'bulleted' | 'todo');
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
refresh(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Executes the list command.
|
|
33
|
-
*
|
|
34
|
-
* @fires execute
|
|
35
|
-
* @param options Command options.
|
|
36
|
-
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will try to convert the
|
|
37
|
-
* selected items and potentially the neighbor elements to the proper list items. If set to `false`, it will convert selected elements
|
|
38
|
-
* to paragraphs. If not set, the command will toggle selected elements to list items or paragraphs, depending on the selection.
|
|
39
|
-
*/
|
|
40
|
-
execute(options?: {
|
|
41
|
-
forceValue?: boolean;
|
|
42
|
-
}): void;
|
|
43
|
-
/**
|
|
44
|
-
* Checks the command's {@link #value}.
|
|
45
|
-
*
|
|
46
|
-
* @returns The current value.
|
|
47
|
-
*/
|
|
48
|
-
private _getValue;
|
|
49
|
-
/**
|
|
50
|
-
* Checks whether the command can be enabled in the current context.
|
|
51
|
-
*
|
|
52
|
-
* @returns Whether the command should be enabled.
|
|
53
|
-
*/
|
|
54
|
-
private _checkEnabled;
|
|
55
|
-
}
|
|
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 { Command, type Editor } from 'ckeditor5/src/core';
|
|
6
|
+
/**
|
|
7
|
+
* The list command. It is used by the {@link module:list/list~List list feature}.
|
|
8
|
+
*/
|
|
9
|
+
export default class ListCommand extends Command {
|
|
10
|
+
/**
|
|
11
|
+
* The type of the list created by the command.
|
|
12
|
+
*/
|
|
13
|
+
readonly type: 'numbered' | 'bulleted' | 'todo';
|
|
14
|
+
/**
|
|
15
|
+
* A flag indicating whether the command is active, which means that the selection starts in a list of the same type.
|
|
16
|
+
*
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
value: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of the command.
|
|
22
|
+
*
|
|
23
|
+
* @param editor The editor instance.
|
|
24
|
+
* @param type List type that will be handled by this command.
|
|
25
|
+
*/
|
|
26
|
+
constructor(editor: Editor, type: 'numbered' | 'bulleted' | 'todo');
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
refresh(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Executes the list command.
|
|
33
|
+
*
|
|
34
|
+
* @fires execute
|
|
35
|
+
* @param options Command options.
|
|
36
|
+
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will try to convert the
|
|
37
|
+
* selected items and potentially the neighbor elements to the proper list items. If set to `false`, it will convert selected elements
|
|
38
|
+
* to paragraphs. If not set, the command will toggle selected elements to list items or paragraphs, depending on the selection.
|
|
39
|
+
*/
|
|
40
|
+
execute(options?: {
|
|
41
|
+
forceValue?: boolean;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* Checks the command's {@link #value}.
|
|
45
|
+
*
|
|
46
|
+
* @returns The current value.
|
|
47
|
+
*/
|
|
48
|
+
private _getValue;
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether the command can be enabled in the current context.
|
|
51
|
+
*
|
|
52
|
+
* @returns Whether the command should be enabled.
|
|
53
|
+
*/
|
|
54
|
+
private _checkEnabled;
|
|
55
|
+
}
|