UNPKG

1.87 kBTypeScriptView Raw
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 */
5import { 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 */
9export 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}