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 | import { Plugin } from 'ckeditor5/src/core.js';
|
6 | import LegacyListEditing from '../legacylist/legacylistediting.js';
|
7 | /**
|
8 | * The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
|
9 | *
|
10 | * It registers the entire functionality of the {@link module:list/legacylist/legacylistediting~LegacyListEditing legacy list editing
|
11 | * plugin} and extends it with the commands:
|
12 | *
|
13 | * - `'todoList'`,
|
14 | * - `'checkTodoList'`,
|
15 | * - `'todoListCheck'` as an alias for `checkTodoList` command.
|
16 | */
|
17 | export default class LegacyTodoListEditing extends Plugin {
|
18 | /**
|
19 | * @inheritDoc
|
20 | */
|
21 | static get pluginName(): "LegacyTodoListEditing";
|
22 | /**
|
23 | * @inheritDoc
|
24 | */
|
25 | static get requires(): readonly [typeof LegacyListEditing];
|
26 | /**
|
27 | * @inheritDoc
|
28 | */
|
29 | init(): void;
|
30 | /**
|
31 | * Handles the checkbox element change, moves the selection to the corresponding model item to make it possible
|
32 | * to toggle the `todoListChecked` attribute using the command, and restores the selection position.
|
33 | *
|
34 | * Some say it's a hack :) Moving the selection only for executing the command on a certain node and restoring it after,
|
35 | * is not a clear solution. We need to design an API for using commands beyond the selection range.
|
36 | * See https://github.com/ckeditor/ckeditor5/issues/1954.
|
37 | */
|
38 | private _handleCheckmarkChange;
|
39 | /**
|
40 | * Observe when user enters or leaves todo list and set proper aria value in global live announcer.
|
41 | * This allows screen readers to indicate when the user has entered and left the specified todo list.
|
42 | *
|
43 | * @internal
|
44 | */
|
45 | private _initAriaAnnouncements;
|
46 | }
|