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