UNPKG

1.91 kBTypeScriptView Raw
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 */
5import { Command, type Editor } from 'ckeditor5/src/core.js';
6import { type ListType } from '../list/listediting.js';
7/**
8 * The list command. It is used by the {@link module:list/legacylist~LegacyList legacy list feature}.
9 */
10export default class LegacyListCommand extends Command {
11 /**
12 * The type of the list created by the command.
13 */
14 readonly type: ListType;
15 /**
16 * A flag indicating whether the command is active, which means that the selection starts in a list of the same type.
17 *
18 * @readonly
19 */
20 value: boolean;
21 /**
22 * Creates an instance of the command.
23 *
24 * @param editor The editor instance.
25 * @param type List type that will be handled by this command.
26 */
27 constructor(editor: Editor, type: ListType);
28 /**
29 * @inheritDoc
30 */
31 refresh(): void;
32 /**
33 * Executes the list command.
34 *
35 * @fires execute
36 * @param options Command options.
37 * @param options.forceValue If set, it will force the command behavior. If `true`, the command will try to convert the
38 * selected items and potentially the neighbor elements to the proper list items. If set to `false`, it will convert selected elements
39 * to paragraphs. If not set, the command will toggle selected elements to list items or paragraphs, depending on the selection.
40 */
41 execute(options?: {
42 forceValue?: boolean;
43 }): void;
44 /**
45 * Checks the command's {@link #value}.
46 *
47 * @returns The current value.
48 */
49 private _getValue;
50 /**
51 * Checks whether the command can be enabled in the current context.
52 *
53 * @returns Whether the command should be enabled.
54 */
55 private _checkEnabled;
56}