1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import type { Element } from 'ckeditor5/src/engine.js';
|
9 | import { Command, type Editor } from 'ckeditor5/src/core.js';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export default class ListSplitCommand extends Command {
|
16 | |
17 |
|
18 |
|
19 | private readonly _direction;
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | constructor(editor: Editor, direction: 'before' | 'after');
|
27 | /**
|
28 | * @inheritDoc
|
29 | */
|
30 | refresh(): void;
|
31 | /**
|
32 | * Splits the list item at the selection.
|
33 | *
|
34 | * @fires execute
|
35 | * @fires afterExecute
|
36 | */
|
37 | execute(): void;
|
38 | /**
|
39 | * Fires the `afterExecute` event.
|
40 | *
|
41 | * @param changedBlocks The changed list elements.
|
42 | */
|
43 | private _fireAfterExecute;
|
44 | /**
|
45 | * Checks whether the command can be enabled in the current context.
|
46 | *
|
47 | * @returns Whether the command should be enabled.
|
48 | */
|
49 | private _checkEnabled;
|
50 | /**
|
51 | * Returns the model element that is the main focus of the command (according to the current selection and command direction).
|
52 | */
|
53 | private _getStartBlock;
|
54 | }
|
55 | /**
|
56 | * Event fired by the {@link ~ListSplitCommand#execute} method.
|
57 | *
|
58 | * It allows to execute an action after executing the {@link module:list/list/listcommand~ListCommand#execute}
|
59 | * method, for example adjusting attributes of changed list items.
|
60 | *
|
61 | * @internal
|
62 | * @eventName ~ListSplitCommand#afterExecute
|
63 | */
|
64 | export type ListSplitCommandAfterExecuteEvent = {
|
65 | name: 'afterExecute';
|
66 | args: [changedBlocks: Array<Element>];
|
67 | };
|