@ckeditor/ckeditor5-list 41.3.0 → 41.4.0-alpha.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/dist/index-content.css +102 -0
- package/dist/index-editor.css +74 -0
- package/dist/index.css +228 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +7564 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/si.d.ts +8 -0
- package/dist/translations/si.js +5 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/types/augmentation.d.ts +57 -0
- package/dist/types/documentlist.d.ts +32 -0
- package/dist/types/documentlistproperties.d.ts +32 -0
- package/dist/types/index.d.ts +49 -0
- package/dist/types/legacylist/legacyconverters.d.ts +200 -0
- package/dist/types/legacylist/legacyindentcommand.d.ts +41 -0
- package/dist/types/legacylist/legacylistcommand.d.ts +60 -0
- package/dist/types/legacylist/legacylistediting.d.ts +36 -0
- package/dist/types/legacylist/legacylistutils.d.ts +45 -0
- package/dist/types/legacylist/legacyutils.d.ts +105 -0
- package/dist/types/legacylist.d.ts +30 -0
- package/dist/types/legacylistproperties/legacylistpropertiesediting.d.ts +76 -0
- package/dist/types/legacylistproperties/legacylistreversedcommand.d.ts +42 -0
- package/dist/types/legacylistproperties/legacyliststartcommand.d.ts +41 -0
- package/dist/types/legacylistproperties/legacyliststylecommand.d.ts +71 -0
- package/dist/types/legacylistproperties.d.ts +31 -0
- package/dist/types/legacytodolist/legacychecktodolistcommand.d.ts +56 -0
- package/dist/types/legacytodolist/legacytodolistconverters.d.ts +87 -0
- package/dist/types/legacytodolist/legacytodolistediting.d.ts +50 -0
- package/dist/types/legacytodolist.d.ts +31 -0
- package/dist/types/list/adjacentlistssupport.d.ts +19 -0
- package/dist/types/list/converters.d.ts +77 -0
- package/dist/types/list/listcommand.d.ts +96 -0
- package/dist/types/list/listediting.d.ts +226 -0
- package/dist/types/list/listindentcommand.d.ts +66 -0
- package/dist/types/list/listmergecommand.d.ts +80 -0
- package/dist/types/list/listsplitcommand.d.ts +71 -0
- package/dist/types/list/listui.d.ts +23 -0
- package/dist/types/list/listutils.d.ts +56 -0
- package/dist/types/list/utils/listwalker.d.ts +146 -0
- package/dist/types/list/utils/model.d.ts +213 -0
- package/dist/types/list/utils/postfixers.d.ts +41 -0
- package/dist/types/list/utils/view.d.ts +86 -0
- package/dist/types/list/utils.d.ts +22 -0
- package/dist/types/list.d.ts +30 -0
- package/dist/types/listconfig.d.ts +136 -0
- package/dist/types/listproperties/converters.d.ts +23 -0
- package/dist/types/listproperties/listpropertiesediting.d.ts +92 -0
- package/dist/types/listproperties/listpropertiesui.d.ts +27 -0
- package/dist/types/listproperties/listpropertiesutils.d.ts +37 -0
- package/dist/types/listproperties/listreversedcommand.d.ts +40 -0
- package/dist/types/listproperties/liststartcommand.d.ts +42 -0
- package/dist/types/listproperties/liststylecommand.d.ts +76 -0
- package/dist/types/listproperties/ui/listpropertiesview.d.ts +160 -0
- package/dist/types/listproperties/utils/style.d.ts +24 -0
- package/dist/types/listproperties.d.ts +31 -0
- package/dist/types/tododocumentlist.d.ts +32 -0
- package/dist/types/todolist/checktodolistcommand.d.ts +53 -0
- package/dist/types/todolist/todocheckboxchangeobserver.d.ts +45 -0
- package/dist/types/todolist/todolistediting.d.ts +49 -0
- package/dist/types/todolist/todolistui.d.ts +23 -0
- package/dist/types/todolist.d.ts +31 -0
- package/lang/contexts.json +3 -1
- package/package.json +3 -2
- package/src/legacytodolist/legacytodolistediting.d.ts +7 -0
- package/src/legacytodolist/legacytodolistediting.js +32 -0
- package/src/todolist/todolistediting.d.ts +7 -0
- package/src/todolist/todolistediting.js +38 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/listsplitcommand
|
|
11
|
+
*/
|
|
12
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
|
13
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
14
|
+
/**
|
|
15
|
+
* The document list split command that splits the list item at the selection.
|
|
16
|
+
*
|
|
17
|
+
* It is used by the {@link module:list/list~List list feature}.
|
|
18
|
+
*/
|
|
19
|
+
export default class ListSplitCommand extends Command {
|
|
20
|
+
/**
|
|
21
|
+
* Whether list item should be split before or after the selected block.
|
|
22
|
+
*/
|
|
23
|
+
private readonly _direction;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of the command.
|
|
26
|
+
*
|
|
27
|
+
* @param editor The editor instance.
|
|
28
|
+
* @param direction Whether list item should be split before or after the selected block.
|
|
29
|
+
*/
|
|
30
|
+
constructor(editor: Editor, direction: 'before' | 'after');
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
refresh(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Splits the list item at the selection.
|
|
37
|
+
*
|
|
38
|
+
* @fires execute
|
|
39
|
+
* @fires afterExecute
|
|
40
|
+
*/
|
|
41
|
+
execute(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Fires the `afterExecute` event.
|
|
44
|
+
*
|
|
45
|
+
* @param changedBlocks The changed list elements.
|
|
46
|
+
*/
|
|
47
|
+
private _fireAfterExecute;
|
|
48
|
+
/**
|
|
49
|
+
* Checks whether the command can be enabled in the current context.
|
|
50
|
+
*
|
|
51
|
+
* @returns Whether the command should be enabled.
|
|
52
|
+
*/
|
|
53
|
+
private _checkEnabled;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the model element that is the main focus of the command (according to the current selection and command direction).
|
|
56
|
+
*/
|
|
57
|
+
private _getStartBlock;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Event fired by the {@link ~ListSplitCommand#execute} method.
|
|
61
|
+
*
|
|
62
|
+
* It allows to execute an action after executing the {@link module:list/list/listcommand~ListCommand#execute}
|
|
63
|
+
* method, for example adjusting attributes of changed list items.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
* @eventName ~ListSplitCommand#afterExecute
|
|
67
|
+
*/
|
|
68
|
+
export type ListSplitCommandAfterExecuteEvent = {
|
|
69
|
+
name: 'afterExecute';
|
|
70
|
+
args: [changedBlocks: Array<Element>];
|
|
71
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
10
|
+
/**
|
|
11
|
+
* The list UI feature. It introduces the `'numberedList'` and `'bulletedList'` buttons that
|
|
12
|
+
* allow to convert paragraphs to and from list items and indent or outdent them.
|
|
13
|
+
*/
|
|
14
|
+
export default class ListUI extends Plugin {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get pluginName(): "ListUI";
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
init(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/listutils
|
|
11
|
+
*/
|
|
12
|
+
import type { Element, Node } from 'ckeditor5/src/engine.js';
|
|
13
|
+
import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
14
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
15
|
+
import { type ListElement } from './utils/model.js';
|
|
16
|
+
import type { ListType } from './listediting.js';
|
|
17
|
+
/**
|
|
18
|
+
* A set of helpers related to document lists.
|
|
19
|
+
*/
|
|
20
|
+
export default class ListUtils extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName(): "ListUtils";
|
|
25
|
+
/**
|
|
26
|
+
* Expands the given list of selected blocks to include all the items of the lists they're in.
|
|
27
|
+
*
|
|
28
|
+
* @param blocks The list of selected blocks.
|
|
29
|
+
*/
|
|
30
|
+
expandListBlocksToCompleteList(blocks: ArrayOrItem<Element>): Array<Element>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if the given block is the first in the list item.
|
|
33
|
+
*
|
|
34
|
+
* @param listBlock The list block element.
|
|
35
|
+
*/
|
|
36
|
+
isFirstBlockOfListItem(listBlock: Element): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if the given model node is a list item block.
|
|
39
|
+
*
|
|
40
|
+
* @param node A model node.
|
|
41
|
+
*/
|
|
42
|
+
isListItemBlock(node: Node | null): node is ListElement;
|
|
43
|
+
/**
|
|
44
|
+
* Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
|
|
45
|
+
*
|
|
46
|
+
* @param blocks The list of selected blocks.
|
|
47
|
+
* @param options.withNested Whether should include nested list items.
|
|
48
|
+
*/
|
|
49
|
+
expandListBlocksToCompleteItems(blocks: ArrayOrItem<Element>, options?: {
|
|
50
|
+
withNested?: boolean;
|
|
51
|
+
}): Array<Element>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns true if listType is of type `numbered` or `customNumbered`.
|
|
54
|
+
*/
|
|
55
|
+
isNumberedListType(listType: ListType): boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/utils/listwalker
|
|
11
|
+
*/
|
|
12
|
+
import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
13
|
+
import { type ListElement } from './model.js';
|
|
14
|
+
import type { Element, Node } from 'ckeditor5/src/engine.js';
|
|
15
|
+
/**
|
|
16
|
+
* Document list blocks iterator.
|
|
17
|
+
*/
|
|
18
|
+
export default class ListWalker {
|
|
19
|
+
/**
|
|
20
|
+
* The start list item block element.
|
|
21
|
+
*/
|
|
22
|
+
private _startElement;
|
|
23
|
+
/**
|
|
24
|
+
* The reference indent. Initialized by the indent of the start block.
|
|
25
|
+
*/
|
|
26
|
+
private _referenceIndent;
|
|
27
|
+
/**
|
|
28
|
+
* The iterating direction.
|
|
29
|
+
*/
|
|
30
|
+
private _isForward;
|
|
31
|
+
/**
|
|
32
|
+
* Whether start block should be included in the result (if it's matching other criteria).
|
|
33
|
+
*/
|
|
34
|
+
private _includeSelf;
|
|
35
|
+
/**
|
|
36
|
+
* Additional attributes that must be the same for each block.
|
|
37
|
+
*/
|
|
38
|
+
private _sameAttributes;
|
|
39
|
+
/**
|
|
40
|
+
* Whether blocks with the same indent level as the start block should be included in the result.
|
|
41
|
+
*/
|
|
42
|
+
private _sameIndent;
|
|
43
|
+
/**
|
|
44
|
+
* Whether blocks with a lower indent level than the start block should be included in the result.
|
|
45
|
+
*/
|
|
46
|
+
private _lowerIndent;
|
|
47
|
+
/**
|
|
48
|
+
* Whether blocks with a higher indent level than the start block should be included in the result.
|
|
49
|
+
*/
|
|
50
|
+
private _higherIndent;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a document list iterator.
|
|
53
|
+
*
|
|
54
|
+
* @param startElement The start list item block element.
|
|
55
|
+
* @param options.direction The iterating direction.
|
|
56
|
+
* @param options.includeSelf Whether start block should be included in the result (if it's matching other criteria).
|
|
57
|
+
* @param options.sameAttributes Additional attributes that must be the same for each block.
|
|
58
|
+
* @param options.sameIndent Whether blocks with the same indent level as the start block should be included
|
|
59
|
+
* in the result.
|
|
60
|
+
* @param options.lowerIndent Whether blocks with a lower indent level than the start block should be included
|
|
61
|
+
* in the result.
|
|
62
|
+
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
|
|
63
|
+
* in the result.
|
|
64
|
+
*/
|
|
65
|
+
constructor(startElement: Node, options: ListWalkerOptions);
|
|
66
|
+
/**
|
|
67
|
+
* Performs only first step of iteration and returns the result.
|
|
68
|
+
*
|
|
69
|
+
* @param startElement The start list item block element.
|
|
70
|
+
* @param options.direction The iterating direction.
|
|
71
|
+
* @param options.includeSelf Whether start block should be included in the result (if it's matching other criteria).
|
|
72
|
+
* @param options.sameAttributes Additional attributes that must be the same for each block.
|
|
73
|
+
* @param options.sameIndent Whether blocks with the same indent level as the start block should be included
|
|
74
|
+
* in the result.
|
|
75
|
+
* @param options.lowerIndent Whether blocks with a lower indent level than the start block should be included
|
|
76
|
+
* in the result.
|
|
77
|
+
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
|
|
78
|
+
* in the result.
|
|
79
|
+
*/
|
|
80
|
+
static first(startElement: Node, options: ListWalkerOptions): ListElement | null;
|
|
81
|
+
/**
|
|
82
|
+
* Iterable interface.
|
|
83
|
+
*/
|
|
84
|
+
[Symbol.iterator](): Iterator<ListElement>;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the model element to start iterating.
|
|
87
|
+
*/
|
|
88
|
+
private _getStartNode;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Iterates sibling list blocks starting from the given node.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
* @param node The model node.
|
|
95
|
+
* @param direction Iteration direction.
|
|
96
|
+
* @returns The object with `node` and `previous` {@link module:engine/model/element~Element blocks}.
|
|
97
|
+
*/
|
|
98
|
+
export declare function iterateSiblingListBlocks(node: Node | null, direction?: 'forward' | 'backward'): IterableIterator<ListIteratorValue>;
|
|
99
|
+
/**
|
|
100
|
+
* The iterable protocol over the list elements.
|
|
101
|
+
*
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
export declare class ListBlocksIterable {
|
|
105
|
+
private _listHead;
|
|
106
|
+
/**
|
|
107
|
+
* @param listHead The head element of a list.
|
|
108
|
+
*/
|
|
109
|
+
constructor(listHead: Element);
|
|
110
|
+
/**
|
|
111
|
+
* List blocks iterator.
|
|
112
|
+
*
|
|
113
|
+
* Iterates over all blocks of a list.
|
|
114
|
+
*/
|
|
115
|
+
[Symbol.iterator](): Iterator<ListIteratorValue>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Object returned by `iterateSiblingListBlocks()` when traversing a list.
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
export interface ListIteratorValue {
|
|
123
|
+
/**
|
|
124
|
+
* The current list node.
|
|
125
|
+
*/
|
|
126
|
+
node: ListElement;
|
|
127
|
+
/**
|
|
128
|
+
* The previous list node.
|
|
129
|
+
*/
|
|
130
|
+
previous: ListElement | null;
|
|
131
|
+
/**
|
|
132
|
+
* The previous list node at the same indent as current node.
|
|
133
|
+
*/
|
|
134
|
+
previousNodeInList: ListElement | null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Document list blocks iterator options.
|
|
138
|
+
*/
|
|
139
|
+
export type ListWalkerOptions = {
|
|
140
|
+
direction?: 'forward' | 'backward';
|
|
141
|
+
includeSelf?: boolean;
|
|
142
|
+
sameAttributes?: ArrayOrItem<string>;
|
|
143
|
+
sameIndent?: boolean;
|
|
144
|
+
lowerIndent?: boolean;
|
|
145
|
+
higherIndent?: boolean;
|
|
146
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/utils/model
|
|
11
|
+
*/
|
|
12
|
+
import type { DocumentFragment, Element, Model, Node, Writer, Item, Schema } from 'ckeditor5/src/engine.js';
|
|
13
|
+
import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
|
|
14
|
+
import { type ListWalkerOptions } from './listwalker.js';
|
|
15
|
+
import { type ListType } from '../listediting.js';
|
|
16
|
+
/**
|
|
17
|
+
* The list item ID generator.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare class ListItemUid {
|
|
22
|
+
/**
|
|
23
|
+
* Returns the next ID.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
static next(): string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* An {@link module:engine/model/element~Element} that is known to be a list element.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export interface ListElement extends Element {
|
|
35
|
+
getAttribute(key: 'listItemId'): string;
|
|
36
|
+
getAttribute(key: 'listIndent'): number;
|
|
37
|
+
getAttribute(key: 'listType'): ListType;
|
|
38
|
+
getAttribute(key: string): unknown;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns true if the given model node is a list item block.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare function isListItemBlock(node: Item | DocumentFragment | null): node is ListElement;
|
|
46
|
+
/**
|
|
47
|
+
* Returns an array with all elements that represents the same list item.
|
|
48
|
+
*
|
|
49
|
+
* It means that values for `listIndent`, and `listItemId` for all items are equal.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
* @param listItem Starting list item element.
|
|
53
|
+
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included
|
|
54
|
+
* in the result.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getAllListItemBlocks(listItem: Node, options?: {
|
|
57
|
+
higherIndent?: boolean;
|
|
58
|
+
}): Array<ListElement>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns an array with elements that represents the same list item in the specified direction.
|
|
61
|
+
*
|
|
62
|
+
* It means that values for `listIndent` and `listItemId` for all items are equal.
|
|
63
|
+
*
|
|
64
|
+
* **Note**: For backward search the provided item is not included, but for forward search it is included in the result.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
* @param listItem Starting list item element.
|
|
68
|
+
* @param options.direction Walking direction.
|
|
69
|
+
* @param options.higherIndent Whether blocks with a higher indent level than the start block should be included in the result.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getListItemBlocks(listItem: Node, options?: {
|
|
72
|
+
direction?: 'forward' | 'backward';
|
|
73
|
+
higherIndent?: boolean;
|
|
74
|
+
}): Array<ListElement>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a list items nested inside the given list item.
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
export declare function getNestedListBlocks(listItem: Element): Array<ListElement>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns array of all blocks/items of the same list as given block (same indent, same type and properties).
|
|
83
|
+
*
|
|
84
|
+
* @internal
|
|
85
|
+
* @param listItem Starting list item element.
|
|
86
|
+
* @param options Additional list walker options to modify the range of returned list items.
|
|
87
|
+
*/
|
|
88
|
+
export declare function getListItems(listItem: Element, options?: ListWalkerOptions): Array<ListElement>;
|
|
89
|
+
/**
|
|
90
|
+
* Check if the given block is the first in the list item.
|
|
91
|
+
*
|
|
92
|
+
* @internal
|
|
93
|
+
* @param listBlock The list block element.
|
|
94
|
+
*/
|
|
95
|
+
export declare function isFirstBlockOfListItem(listBlock: Node): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Check if the given block is the last in the list item.
|
|
98
|
+
*
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export declare function isLastBlockOfListItem(listBlock: Element): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.
|
|
104
|
+
*
|
|
105
|
+
* @internal
|
|
106
|
+
* @param blocks The list of selected blocks.
|
|
107
|
+
* @param options.withNested Whether should include nested list items.
|
|
108
|
+
*/
|
|
109
|
+
export declare function expandListBlocksToCompleteItems(blocks: ArrayOrItem<Element>, options?: {
|
|
110
|
+
withNested?: boolean;
|
|
111
|
+
}): Array<ListElement>;
|
|
112
|
+
/**
|
|
113
|
+
* Expands the given list of selected blocks to include all the items of the lists they're in.
|
|
114
|
+
*
|
|
115
|
+
* @internal
|
|
116
|
+
* @param blocks The list of selected blocks.
|
|
117
|
+
*/
|
|
118
|
+
export declare function expandListBlocksToCompleteList(blocks: ArrayOrItem<Element>): Array<ListElement>;
|
|
119
|
+
/**
|
|
120
|
+
* Splits the list item just before the provided list block.
|
|
121
|
+
*
|
|
122
|
+
* @internal
|
|
123
|
+
* @param listBlock The list block element.
|
|
124
|
+
* @param writer The model writer.
|
|
125
|
+
* @returns The array of updated blocks.
|
|
126
|
+
*/
|
|
127
|
+
export declare function splitListItemBefore(listBlock: Element, writer: Writer): Array<ListElement>;
|
|
128
|
+
/**
|
|
129
|
+
* Merges the list item with the parent list item.
|
|
130
|
+
*
|
|
131
|
+
* @internal
|
|
132
|
+
* @param listBlock The list block element.
|
|
133
|
+
* @param parentBlock The list block element to merge with.
|
|
134
|
+
* @param writer The model writer.
|
|
135
|
+
* @returns The array of updated blocks.
|
|
136
|
+
*/
|
|
137
|
+
export declare function mergeListItemBefore(listBlock: Node, parentBlock: Element, writer: Writer): Array<ListElement>;
|
|
138
|
+
/**
|
|
139
|
+
* Increases indentation of given list blocks.
|
|
140
|
+
*
|
|
141
|
+
* @internal
|
|
142
|
+
* @param blocks The block or iterable of blocks.
|
|
143
|
+
* @param writer The model writer.
|
|
144
|
+
* @param options.expand Whether should expand the list of blocks to include complete list items.
|
|
145
|
+
* @param options.indentBy The number of levels the indentation should change (could be negative).
|
|
146
|
+
*/
|
|
147
|
+
export declare function indentBlocks(blocks: ArrayOrItem<ListElement>, writer: Writer, { expand, indentBy }?: {
|
|
148
|
+
expand?: boolean;
|
|
149
|
+
indentBy?: number;
|
|
150
|
+
}): Array<ListElement>;
|
|
151
|
+
/**
|
|
152
|
+
* Decreases indentation of given list of blocks. If the indentation of some blocks matches the indentation
|
|
153
|
+
* of surrounding blocks, they get merged together.
|
|
154
|
+
*
|
|
155
|
+
* @internal
|
|
156
|
+
* @param blocks The block or iterable of blocks.
|
|
157
|
+
* @param writer The model writer.
|
|
158
|
+
*/
|
|
159
|
+
export declare function outdentBlocksWithMerge(blocks: ArrayOrItem<ListElement>, writer: Writer): Array<ListElement>;
|
|
160
|
+
/**
|
|
161
|
+
* Removes all list attributes from the given blocks.
|
|
162
|
+
*
|
|
163
|
+
* @internal
|
|
164
|
+
* @param blocks The block or iterable of blocks.
|
|
165
|
+
* @param writer The model writer.
|
|
166
|
+
* @returns Array of altered blocks.
|
|
167
|
+
*/
|
|
168
|
+
export declare function removeListAttributes(blocks: ArrayOrItem<Element>, writer: Writer): Array<Element>;
|
|
169
|
+
/**
|
|
170
|
+
* Checks whether the given blocks are related to a single list item.
|
|
171
|
+
*
|
|
172
|
+
* @internal
|
|
173
|
+
* @param blocks The list block elements.
|
|
174
|
+
*/
|
|
175
|
+
export declare function isSingleListItem(blocks: Array<Node>): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Modifies the indents of list blocks following the given list block so the indentation is valid after
|
|
178
|
+
* the given block is no longer a list item.
|
|
179
|
+
*
|
|
180
|
+
* @internal
|
|
181
|
+
* @param lastBlock The last list block that has become a non-list element.
|
|
182
|
+
* @param writer The model writer.
|
|
183
|
+
* @returns Array of altered blocks.
|
|
184
|
+
*/
|
|
185
|
+
export declare function outdentFollowingItems(lastBlock: Element, writer: Writer): Array<ListElement>;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the array of given blocks sorted by model indexes (document order).
|
|
188
|
+
*
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
export declare function sortBlocks<T extends Element>(blocks: Iterable<T>): Array<T>;
|
|
192
|
+
/**
|
|
193
|
+
* Returns a selected block object. If a selected object is inline or when there is no selected
|
|
194
|
+
* object, `null` is returned.
|
|
195
|
+
*
|
|
196
|
+
* @internal
|
|
197
|
+
* @param model The instance of editor model.
|
|
198
|
+
* @returns Selected block object or `null`.
|
|
199
|
+
*/
|
|
200
|
+
export declare function getSelectedBlockObject(model: Model): Element | null;
|
|
201
|
+
/**
|
|
202
|
+
* Checks whether the given block can be replaced by a listItem.
|
|
203
|
+
*
|
|
204
|
+
* Note that this is possible only when multiBlock = false option is set in feature config.
|
|
205
|
+
*
|
|
206
|
+
* @param block A block to be tested.
|
|
207
|
+
* @param schema The schema of the document.
|
|
208
|
+
*/
|
|
209
|
+
export declare function canBecomeSimpleListItem(block: Element, schema: Schema): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Returns true if listType is of type `numbered` or `customNumbered`.
|
|
212
|
+
*/
|
|
213
|
+
export declare function isNumberedListType(listType: ListType): boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/utils/postfixers
|
|
11
|
+
*/
|
|
12
|
+
import type { Position, Writer } from 'ckeditor5/src/engine.js';
|
|
13
|
+
import { type ListIteratorValue } from './listwalker.js';
|
|
14
|
+
import { type ListElement } from './model.js';
|
|
15
|
+
/**
|
|
16
|
+
* Based on the provided positions looks for the list head and stores it in the provided map.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
* @param position The search starting position.
|
|
20
|
+
* @param itemToListHead The map from list item element to the list head element.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findAndAddListHeadToMap(position: Position, itemToListHead: Map<ListElement, ListElement>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Scans the list starting from the given list head element and fixes items' indentation.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
* @param listNodes The iterable of list nodes.
|
|
28
|
+
* @param writer The model writer.
|
|
29
|
+
* @returns Whether the model was modified.
|
|
30
|
+
*/
|
|
31
|
+
export declare function fixListIndents(listNodes: Iterable<ListIteratorValue>, writer: Writer): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Scans the list starting from the given list head element and fixes items' types.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
* @param listNodes The iterable of list nodes.
|
|
37
|
+
* @param seenIds The set of already known IDs.
|
|
38
|
+
* @param writer The model writer.
|
|
39
|
+
* @returns Whether the model was modified.
|
|
40
|
+
*/
|
|
41
|
+
export declare function fixListItemIds(listNodes: Iterable<ListIteratorValue>, seenIds: Set<string>, writer: Writer): boolean;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/utils/view
|
|
11
|
+
*/
|
|
12
|
+
import type { DowncastWriter, ViewAttributeElement, ViewDocumentFragment, ViewElement, ViewNode } from 'ckeditor5/src/engine.js';
|
|
13
|
+
import { type ListType } from '../listediting.js';
|
|
14
|
+
/**
|
|
15
|
+
* Checks if view element is a list type (ul or ol).
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function isListView(viewElement: ViewNode | ViewDocumentFragment): viewElement is ViewElement & {
|
|
20
|
+
name: 'ul' | 'ol';
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Checks if view element is a list item (li).
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function isListItemView(viewElement: ViewNode | ViewDocumentFragment): viewElement is ViewElement & {
|
|
28
|
+
name: 'li';
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.
|
|
32
|
+
*
|
|
33
|
+
* Also, fixes non HTML compliant lists indents:
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* before: fixed list:
|
|
37
|
+
* OL OL
|
|
38
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
39
|
+
* |-> OL |-> OL
|
|
40
|
+
* |-> OL |
|
|
41
|
+
* | |-> OL |
|
|
42
|
+
* | |-> OL |
|
|
43
|
+
* | |-> LI (parent LIs: 1) |-> LI (indent: 1)
|
|
44
|
+
* |-> LI (parent LIs: 1) |-> LI (indent: 1)
|
|
45
|
+
*
|
|
46
|
+
* before: fixed list:
|
|
47
|
+
* OL OL
|
|
48
|
+
* |-> OL |
|
|
49
|
+
* |-> OL |
|
|
50
|
+
* |-> OL |
|
|
51
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
52
|
+
*
|
|
53
|
+
* before: fixed list:
|
|
54
|
+
* OL OL
|
|
55
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 0)
|
|
56
|
+
* |-> OL |-> OL
|
|
57
|
+
* |-> LI (parent LIs: 0) |-> LI (indent: 1)
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function getIndent(listItem: ViewElement): number;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a list attribute element (ol or ul).
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare function createListElement(writer: DowncastWriter, indent: number, type: ListType, id?: string): ViewAttributeElement;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a list item attribute element (li).
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare function createListItemElement(writer: DowncastWriter, indent: number, id: string): ViewAttributeElement;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a view element name for the given list type.
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
export declare function getViewElementNameForListType(type?: ListType): 'ol' | 'ul';
|
|
81
|
+
/**
|
|
82
|
+
* Returns a view element ID for the given list type and indent.
|
|
83
|
+
*
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
export declare function getViewElementIdForListType(type?: ListType, indent?: number): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list/utils
|
|
11
|
+
*/
|
|
12
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
13
|
+
/**
|
|
14
|
+
* Helper method for creating toolbar and menu buttons and linking them with an appropriate command.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
* @param editor The editor instance to which the UI component will be added.
|
|
18
|
+
* @param commandName The name of the command.
|
|
19
|
+
* @param label The button label.
|
|
20
|
+
* @param icon The source of the icon.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createUIComponents(editor: Editor, commandName: 'bulletedList' | 'numberedList' | 'todoList', label: string, icon: string): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @module list/list
|
|
11
|
+
*/
|
|
12
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
13
|
+
import ListEditing from './list/listediting.js';
|
|
14
|
+
import ListUI from './list/listui.js';
|
|
15
|
+
/**
|
|
16
|
+
* The list feature.
|
|
17
|
+
*
|
|
18
|
+
* This is a "glue" plugin that loads the {@link module:list/list/listediting~ListEditing list
|
|
19
|
+
* editing feature} and {@link module:list/list/listui~ListUI list UI feature}.
|
|
20
|
+
*/
|
|
21
|
+
export default class List extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get requires(): readonly [typeof ListEditing, typeof ListUI];
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName(): "List";
|
|
30
|
+
}
|