UNPKG

1.79 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 */
5/**
6 * @module list/legacytodolist/legacychecktodolistcommand
7 */
8import { Command, type Editor } from 'ckeditor5/src/core.js';
9import type { Element } from 'ckeditor5/src/engine.js';
10/**
11 * The check to-do command.
12 *
13 * The command is registered by the {@link module:list/legacytodolist/legacytodolistediting~LegacyTodoListEditing} as
14 * the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
15 */
16export default class LegacyCheckTodoListCommand extends Command {
17 /**
18 * A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
19 *
20 * @observable
21 * @readonly
22 */
23 value: boolean;
24 /**
25 * A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
26 *
27 * @internal
28 */
29 _selectedElements: Array<Element>;
30 /**
31 * @inheritDoc
32 */
33 constructor(editor: Editor);
34 /**
35 * Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
36 */
37 refresh(): void;
38 /**
39 * Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
40 */
41 private _getSelectedItems;
42 /**
43 * Executes the command.
44 *
45 * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
46 * the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
47 * value to decide what it should do.
48 */
49 execute(options?: {
50 forceValue?: boolean;
51 }): void;
52}