UNPKG

1.75 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 */
5/**
6 * @module list/todolist/checktodolistcommand
7 */
8import { Command, type Editor } from 'ckeditor5/src/core';
9import type { Element } from 'ckeditor5/src/engine';
10/**
11 * The check to-do command.
12 *
13 * The command is registered by the {@link module:list/todolist/todolistediting~TodoListEditing} as
14 * the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
15 */
16export default class CheckTodoListCommand 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}