@ckeditor/ckeditor5-list 40.0.0 → 40.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -25
- package/LICENSE.md +2 -2
- package/build/list.js +1 -1
- package/build/translations/ug.js +1 -1
- package/lang/translations/ug.po +3 -3
- package/package.json +2 -3
- package/src/augmentation.d.ts +52 -52
- package/src/augmentation.js +5 -5
- package/src/documentlist/adjacentlistssupport.d.ts +15 -15
- package/src/documentlist/adjacentlistssupport.js +81 -81
- package/src/documentlist/converters.d.ts +65 -65
- package/src/documentlist/converters.js +441 -441
- package/src/documentlist/documentlistcommand.d.ts +80 -80
- package/src/documentlist/documentlistcommand.js +150 -150
- package/src/documentlist/documentlistediting.d.ts +212 -212
- package/src/documentlist/documentlistediting.js +646 -645
- package/src/documentlist/documentlistindentcommand.d.ts +62 -62
- package/src/documentlist/documentlistindentcommand.js +129 -129
- package/src/documentlist/documentlistmergecommand.d.ts +76 -76
- package/src/documentlist/documentlistmergecommand.js +174 -174
- package/src/documentlist/documentlistsplitcommand.d.ts +67 -67
- package/src/documentlist/documentlistsplitcommand.js +70 -70
- package/src/documentlist/documentlistutils.d.ts +46 -46
- package/src/documentlist/documentlistutils.js +50 -50
- package/src/documentlist/utils/listwalker.d.ts +145 -145
- package/src/documentlist/utils/listwalker.js +182 -182
- package/src/documentlist/utils/model.d.ts +202 -202
- package/src/documentlist/utils/model.js +455 -455
- package/src/documentlist/utils/postfixers.d.ts +37 -37
- package/src/documentlist/utils/postfixers.js +126 -126
- package/src/documentlist/utils/view.d.ts +81 -81
- package/src/documentlist/utils/view.js +117 -117
- package/src/documentlist.d.ts +26 -26
- package/src/documentlist.js +30 -30
- package/src/documentlistproperties/converters.d.ts +19 -19
- package/src/documentlistproperties/converters.js +43 -43
- package/src/documentlistproperties/documentlistpropertiesediting.d.ts +88 -88
- package/src/documentlistproperties/documentlistpropertiesediting.js +266 -266
- package/src/documentlistproperties/documentlistpropertiesutils.d.ts +33 -33
- package/src/documentlistproperties/documentlistpropertiesutils.js +44 -44
- package/src/documentlistproperties/documentlistreversedcommand.d.ts +36 -36
- package/src/documentlistproperties/documentlistreversedcommand.js +55 -55
- package/src/documentlistproperties/documentliststartcommand.d.ts +38 -38
- package/src/documentlistproperties/documentliststartcommand.js +57 -57
- package/src/documentlistproperties/documentliststylecommand.d.ts +72 -72
- package/src/documentlistproperties/documentliststylecommand.js +113 -113
- package/src/documentlistproperties/utils/style.d.ts +20 -20
- package/src/documentlistproperties/utils/style.js +54 -54
- package/src/documentlistproperties.d.ts +27 -27
- package/src/documentlistproperties.js +31 -31
- package/src/index.d.ts +43 -43
- package/src/index.js +29 -29
- package/src/list/converters.d.ts +196 -196
- package/src/list/converters.js +905 -905
- package/src/list/indentcommand.d.ts +37 -37
- package/src/list/indentcommand.js +107 -107
- package/src/list/listcommand.d.ts +55 -55
- package/src/list/listcommand.js +274 -274
- package/src/list/listediting.d.ts +32 -32
- package/src/list/listediting.js +161 -161
- package/src/list/listui.d.ts +19 -19
- package/src/list/listui.js +32 -32
- package/src/list/listutils.d.ts +41 -41
- package/src/list/listutils.js +46 -46
- package/src/list/utils.d.ts +112 -112
- package/src/list/utils.js +374 -374
- package/src/list.d.ts +26 -26
- package/src/list.js +30 -30
- package/src/listconfig.d.ts +132 -132
- package/src/listconfig.js +5 -5
- package/src/listproperties/listpropertiesediting.d.ts +72 -72
- package/src/listproperties/listpropertiesediting.js +696 -696
- package/src/listproperties/listpropertiesui.d.ts +23 -23
- package/src/listproperties/listpropertiesui.js +277 -277
- package/src/listproperties/listreversedcommand.d.ts +38 -38
- package/src/listproperties/listreversedcommand.js +52 -52
- package/src/listproperties/liststartcommand.d.ts +37 -37
- package/src/listproperties/liststartcommand.js +51 -51
- package/src/listproperties/liststylecommand.d.ts +67 -67
- package/src/listproperties/liststylecommand.js +99 -99
- package/src/listproperties/ui/listpropertiesview.d.ts +156 -157
- package/src/listproperties/ui/listpropertiesview.js +298 -299
- package/src/listproperties.d.ts +26 -26
- package/src/listproperties.js +30 -30
- package/src/liststyle.d.ts +28 -28
- package/src/liststyle.js +36 -36
- package/src/tododocumentlist/checktododocumentlistcommand.d.ts +49 -49
- package/src/tododocumentlist/checktododocumentlistcommand.js +82 -82
- package/src/tododocumentlist/todocheckboxchangeobserver.d.ts +41 -41
- package/src/tododocumentlist/todocheckboxchangeobserver.js +37 -37
- package/src/tododocumentlist/tododocumentlistediting.d.ts +38 -38
- package/src/tododocumentlist/tododocumentlistediting.js +399 -399
- package/src/tododocumentlist.d.ts +27 -27
- package/src/tododocumentlist.js +31 -31
- package/src/todolist/checktodolistcommand.d.ts +52 -52
- package/src/todolist/checktodolistcommand.js +76 -76
- package/src/todolist/todolistconverters.d.ts +82 -82
- package/src/todolist/todolistconverters.js +260 -260
- package/src/todolist/todolistediting.d.ts +39 -39
- package/src/todolist/todolistediting.js +161 -161
- package/src/todolist/todolistui.d.ts +19 -19
- package/src/todolist/todolistui.js +29 -29
- package/src/todolist.d.ts +27 -27
- package/src/todolist.js +31 -31
- package/build/list.js.map +0 -1
- package/src/listproperties/ui/collapsibleview.d.ts +0 -63
- package/src/listproperties/ui/collapsibleview.js +0 -89
- package/theme/collapsible.css +0 -10
package/src/listproperties.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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/listproperties
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import ListPropertiesEditing from './listproperties/listpropertiesediting';
|
|
10
|
-
import ListPropertiesUI from './listproperties/listpropertiesui';
|
|
11
|
-
/**
|
|
12
|
-
* The list properties feature.
|
|
13
|
-
*
|
|
14
|
-
* This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
15
|
-
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
16
|
-
*/
|
|
17
|
-
export default class ListProperties extends Plugin {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get requires(): readonly [typeof ListPropertiesEditing, typeof ListPropertiesUI];
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
static get pluginName(): "ListProperties";
|
|
26
|
-
}
|
|
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/listproperties
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import ListPropertiesEditing from './listproperties/listpropertiesediting';
|
|
10
|
+
import ListPropertiesUI from './listproperties/listpropertiesui';
|
|
11
|
+
/**
|
|
12
|
+
* The list properties feature.
|
|
13
|
+
*
|
|
14
|
+
* This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
15
|
+
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
16
|
+
*/
|
|
17
|
+
export default class ListProperties extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get requires(): readonly [typeof ListPropertiesEditing, typeof ListPropertiesUI];
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName(): "ListProperties";
|
|
26
|
+
}
|
package/src/listproperties.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
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/listproperties
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import ListPropertiesEditing from './listproperties/listpropertiesediting';
|
|
10
|
-
import ListPropertiesUI from './listproperties/listpropertiesui';
|
|
11
|
-
/**
|
|
12
|
-
* The list properties feature.
|
|
13
|
-
*
|
|
14
|
-
* This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
15
|
-
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
16
|
-
*/
|
|
17
|
-
export default class ListProperties extends Plugin {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get requires() {
|
|
22
|
-
return [ListPropertiesEditing, ListPropertiesUI];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get pluginName() {
|
|
28
|
-
return 'ListProperties';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
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/listproperties
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import ListPropertiesEditing from './listproperties/listpropertiesediting';
|
|
10
|
+
import ListPropertiesUI from './listproperties/listpropertiesui';
|
|
11
|
+
/**
|
|
12
|
+
* The list properties feature.
|
|
13
|
+
*
|
|
14
|
+
* This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
15
|
+
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
16
|
+
*/
|
|
17
|
+
export default class ListProperties extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get requires() {
|
|
22
|
+
return [ListPropertiesEditing, ListPropertiesUI];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get pluginName() {
|
|
28
|
+
return 'ListProperties';
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/liststyle.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
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/liststyle
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
9
|
-
import ListProperties from './listproperties';
|
|
10
|
-
/**
|
|
11
|
-
* The list style feature.
|
|
12
|
-
*
|
|
13
|
-
* This is an obsolete plugin that exists for backward compatibility only.
|
|
14
|
-
* Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated
|
|
17
|
-
*/
|
|
18
|
-
export default class ListStyle extends Plugin {
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
static get requires(): readonly [typeof ListProperties];
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
static get pluginName(): "ListStyle";
|
|
27
|
-
constructor(editor: Editor);
|
|
28
|
-
}
|
|
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/liststyle
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import ListProperties from './listproperties';
|
|
10
|
+
/**
|
|
11
|
+
* The list style feature.
|
|
12
|
+
*
|
|
13
|
+
* This is an obsolete plugin that exists for backward compatibility only.
|
|
14
|
+
* Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
export default class ListStyle extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get requires(): readonly [typeof ListProperties];
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get pluginName(): "ListStyle";
|
|
27
|
+
constructor(editor: Editor);
|
|
28
|
+
}
|
package/src/liststyle.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
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/liststyle
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import ListProperties from './listproperties';
|
|
10
|
-
import { logWarning } from 'ckeditor5/src/utils';
|
|
11
|
-
/**
|
|
12
|
-
* The list style feature.
|
|
13
|
-
*
|
|
14
|
-
* This is an obsolete plugin that exists for backward compatibility only.
|
|
15
|
-
* Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated
|
|
18
|
-
*/
|
|
19
|
-
export default class ListStyle extends Plugin {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get requires() {
|
|
24
|
-
return [ListProperties];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get pluginName() {
|
|
30
|
-
return 'ListStyle';
|
|
31
|
-
}
|
|
32
|
-
constructor(editor) {
|
|
33
|
-
super(editor);
|
|
34
|
-
logWarning('The `ListStyle` plugin is obsolete. Use `ListProperties` instead.');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
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/liststyle
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import ListProperties from './listproperties';
|
|
10
|
+
import { logWarning } from 'ckeditor5/src/utils';
|
|
11
|
+
/**
|
|
12
|
+
* The list style feature.
|
|
13
|
+
*
|
|
14
|
+
* This is an obsolete plugin that exists for backward compatibility only.
|
|
15
|
+
* Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
19
|
+
export default class ListStyle extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires() {
|
|
24
|
+
return [ListProperties];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName() {
|
|
30
|
+
return 'ListStyle';
|
|
31
|
+
}
|
|
32
|
+
constructor(editor) {
|
|
33
|
+
super(editor);
|
|
34
|
+
logWarning('The `ListStyle` plugin is obsolete. Use `ListProperties` instead.');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
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/tododocumentlist/checktododocumentlistcommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
9
|
-
/**
|
|
10
|
-
* The check to-do command.
|
|
11
|
-
*
|
|
12
|
-
* The command is registered by the {@link module:list/tododocumentlist/tododocumentlistediting~TodoDocumentListEditing} as
|
|
13
|
-
* the `checkTodoList` editor command.
|
|
14
|
-
*/
|
|
15
|
-
export default class CheckTodoDocumentListCommand extends Command {
|
|
16
|
-
/**
|
|
17
|
-
* A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
18
|
-
*
|
|
19
|
-
* @observable
|
|
20
|
-
* @readonly
|
|
21
|
-
*/
|
|
22
|
-
value: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
constructor(editor: Editor);
|
|
27
|
-
/**
|
|
28
|
-
* Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
|
|
29
|
-
*/
|
|
30
|
-
refresh(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Executes the command.
|
|
33
|
-
*
|
|
34
|
-
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
|
|
35
|
-
* the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
|
|
36
|
-
* value to decide what it should do.
|
|
37
|
-
*/
|
|
38
|
-
execute(options?: {
|
|
39
|
-
forceValue?: boolean;
|
|
40
|
-
}): void;
|
|
41
|
-
/**
|
|
42
|
-
* Returns a value for the command.
|
|
43
|
-
*/
|
|
44
|
-
private _getValue;
|
|
45
|
-
/**
|
|
46
|
-
* Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
47
|
-
*/
|
|
48
|
-
private _getSelectedItems;
|
|
49
|
-
}
|
|
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/tododocumentlist/checktododocumentlistcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
/**
|
|
10
|
+
* The check to-do command.
|
|
11
|
+
*
|
|
12
|
+
* The command is registered by the {@link module:list/tododocumentlist/tododocumentlistediting~TodoDocumentListEditing} as
|
|
13
|
+
* the `checkTodoList` editor command.
|
|
14
|
+
*/
|
|
15
|
+
export default class CheckTodoDocumentListCommand extends Command {
|
|
16
|
+
/**
|
|
17
|
+
* A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
18
|
+
*
|
|
19
|
+
* @observable
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
value: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
constructor(editor: Editor);
|
|
27
|
+
/**
|
|
28
|
+
* Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
|
|
29
|
+
*/
|
|
30
|
+
refresh(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Executes the command.
|
|
33
|
+
*
|
|
34
|
+
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
|
|
35
|
+
* the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
|
|
36
|
+
* value to decide what it should do.
|
|
37
|
+
*/
|
|
38
|
+
execute(options?: {
|
|
39
|
+
forceValue?: boolean;
|
|
40
|
+
}): void;
|
|
41
|
+
/**
|
|
42
|
+
* Returns a value for the command.
|
|
43
|
+
*/
|
|
44
|
+
private _getValue;
|
|
45
|
+
/**
|
|
46
|
+
* Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
47
|
+
*/
|
|
48
|
+
private _getSelectedItems;
|
|
49
|
+
}
|
|
@@ -1,82 +1,82 @@
|
|
|
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/tododocumentlist/checktododocumentlistcommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core';
|
|
9
|
-
import { getAllListItemBlocks } from '../documentlist/utils/model';
|
|
10
|
-
/**
|
|
11
|
-
* The check to-do command.
|
|
12
|
-
*
|
|
13
|
-
* The command is registered by the {@link module:list/tododocumentlist/tododocumentlistediting~TodoDocumentListEditing} as
|
|
14
|
-
* the `checkTodoList` editor command.
|
|
15
|
-
*/
|
|
16
|
-
export default class CheckTodoDocumentListCommand extends Command {
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
constructor(editor) {
|
|
21
|
-
super(editor);
|
|
22
|
-
// Refresh command before executing to be sure all values are up to date.
|
|
23
|
-
// It is needed when selection has changed before command execution, in the same change block.
|
|
24
|
-
this.on('execute', () => {
|
|
25
|
-
this.refresh();
|
|
26
|
-
}, { priority: 'highest' });
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
|
|
30
|
-
*/
|
|
31
|
-
refresh() {
|
|
32
|
-
const selectedElements = this._getSelectedItems();
|
|
33
|
-
this.value = this._getValue(selectedElements);
|
|
34
|
-
this.isEnabled = !!selectedElements.length;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Executes the command.
|
|
38
|
-
*
|
|
39
|
-
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
|
|
40
|
-
* the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
|
|
41
|
-
* value to decide what it should do.
|
|
42
|
-
*/
|
|
43
|
-
execute(options = {}) {
|
|
44
|
-
this.editor.model.change(writer => {
|
|
45
|
-
const selectedElements = this._getSelectedItems();
|
|
46
|
-
const value = (options.forceValue === undefined) ? !this._getValue(selectedElements) : options.forceValue;
|
|
47
|
-
for (const element of selectedElements) {
|
|
48
|
-
if (value) {
|
|
49
|
-
writer.setAttribute('todoListChecked', true, element);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
writer.removeAttribute('todoListChecked', element);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Returns a value for the command.
|
|
59
|
-
*/
|
|
60
|
-
_getValue(selectedElements) {
|
|
61
|
-
return selectedElements.every(element => element.getAttribute('todoListChecked'));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
65
|
-
*/
|
|
66
|
-
_getSelectedItems() {
|
|
67
|
-
const model = this.editor.model;
|
|
68
|
-
const schema = model.schema;
|
|
69
|
-
const selectionRange = model.document.selection.getFirstRange();
|
|
70
|
-
const startElement = selectionRange.start.parent;
|
|
71
|
-
const elements = [];
|
|
72
|
-
if (schema.checkAttribute(startElement, 'todoListChecked')) {
|
|
73
|
-
elements.push(...getAllListItemBlocks(startElement));
|
|
74
|
-
}
|
|
75
|
-
for (const item of selectionRange.getItems({ shallow: true })) {
|
|
76
|
-
if (schema.checkAttribute(item, 'todoListChecked') && !elements.includes(item)) {
|
|
77
|
-
elements.push(...getAllListItemBlocks(item));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return elements;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
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/tododocumentlist/checktododocumentlistcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'ckeditor5/src/core';
|
|
9
|
+
import { getAllListItemBlocks } from '../documentlist/utils/model';
|
|
10
|
+
/**
|
|
11
|
+
* The check to-do command.
|
|
12
|
+
*
|
|
13
|
+
* The command is registered by the {@link module:list/tododocumentlist/tododocumentlistediting~TodoDocumentListEditing} as
|
|
14
|
+
* the `checkTodoList` editor command.
|
|
15
|
+
*/
|
|
16
|
+
export default class CheckTodoDocumentListCommand extends Command {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
constructor(editor) {
|
|
21
|
+
super(editor);
|
|
22
|
+
// Refresh command before executing to be sure all values are up to date.
|
|
23
|
+
// It is needed when selection has changed before command execution, in the same change block.
|
|
24
|
+
this.on('execute', () => {
|
|
25
|
+
this.refresh();
|
|
26
|
+
}, { priority: 'highest' });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
|
|
30
|
+
*/
|
|
31
|
+
refresh() {
|
|
32
|
+
const selectedElements = this._getSelectedItems();
|
|
33
|
+
this.value = this._getValue(selectedElements);
|
|
34
|
+
this.isEnabled = !!selectedElements.length;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Executes the command.
|
|
38
|
+
*
|
|
39
|
+
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
|
|
40
|
+
* the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
|
|
41
|
+
* value to decide what it should do.
|
|
42
|
+
*/
|
|
43
|
+
execute(options = {}) {
|
|
44
|
+
this.editor.model.change(writer => {
|
|
45
|
+
const selectedElements = this._getSelectedItems();
|
|
46
|
+
const value = (options.forceValue === undefined) ? !this._getValue(selectedElements) : options.forceValue;
|
|
47
|
+
for (const element of selectedElements) {
|
|
48
|
+
if (value) {
|
|
49
|
+
writer.setAttribute('todoListChecked', true, element);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
writer.removeAttribute('todoListChecked', element);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns a value for the command.
|
|
59
|
+
*/
|
|
60
|
+
_getValue(selectedElements) {
|
|
61
|
+
return selectedElements.every(element => element.getAttribute('todoListChecked'));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
65
|
+
*/
|
|
66
|
+
_getSelectedItems() {
|
|
67
|
+
const model = this.editor.model;
|
|
68
|
+
const schema = model.schema;
|
|
69
|
+
const selectionRange = model.document.selection.getFirstRange();
|
|
70
|
+
const startElement = selectionRange.start.parent;
|
|
71
|
+
const elements = [];
|
|
72
|
+
if (schema.checkAttribute(startElement, 'todoListChecked')) {
|
|
73
|
+
elements.push(...getAllListItemBlocks(startElement));
|
|
74
|
+
}
|
|
75
|
+
for (const item of selectionRange.getItems({ shallow: true })) {
|
|
76
|
+
if (schema.checkAttribute(item, 'todoListChecked') && !elements.includes(item)) {
|
|
77
|
+
elements.push(...getAllListItemBlocks(item));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return elements;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
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/tododocumentlist/todocheckboxchangeobserver
|
|
7
|
-
*/
|
|
8
|
-
import { DomEventObserver, type DomEventData } from 'ckeditor5/src/engine';
|
|
9
|
-
/**
|
|
10
|
-
* Observes all to-do list checkboxes state changes.
|
|
11
|
-
*
|
|
12
|
-
* Note that this observer is not available by default. To make it available it needs to be added to
|
|
13
|
-
* {@link module:engine/view/view~View} by {@link module:engine/view/view~View#addObserver} method.
|
|
14
|
-
*/
|
|
15
|
-
export default class TodoCheckboxChangeObserver extends DomEventObserver<'change'> {
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
readonly domEventType: readonly ["change"];
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
onDomEvent(domEvent: Event): void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Fired when the to-do list checkbox is toggled.
|
|
27
|
-
*
|
|
28
|
-
* Introduced by {@link module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}.
|
|
29
|
-
*
|
|
30
|
-
* Note that this event is not available by default. To make it available,
|
|
31
|
-
* {@link module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}
|
|
32
|
-
* needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
|
|
33
|
-
*
|
|
34
|
-
* @see module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver
|
|
35
|
-
* @eventName module:engine/view/document~Document#todoCheckboxChange
|
|
36
|
-
* @param data The event data.
|
|
37
|
-
*/
|
|
38
|
-
export type ViewDocumentTodoCheckboxChangeEvent = {
|
|
39
|
-
name: 'todoCheckboxChange';
|
|
40
|
-
args: [data: DomEventData<Event>];
|
|
41
|
-
};
|
|
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/tododocumentlist/todocheckboxchangeobserver
|
|
7
|
+
*/
|
|
8
|
+
import { DomEventObserver, type DomEventData } from 'ckeditor5/src/engine';
|
|
9
|
+
/**
|
|
10
|
+
* Observes all to-do list checkboxes state changes.
|
|
11
|
+
*
|
|
12
|
+
* Note that this observer is not available by default. To make it available it needs to be added to
|
|
13
|
+
* {@link module:engine/view/view~View} by {@link module:engine/view/view~View#addObserver} method.
|
|
14
|
+
*/
|
|
15
|
+
export default class TodoCheckboxChangeObserver extends DomEventObserver<'change'> {
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
readonly domEventType: readonly ["change"];
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
onDomEvent(domEvent: Event): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fired when the to-do list checkbox is toggled.
|
|
27
|
+
*
|
|
28
|
+
* Introduced by {@link module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}.
|
|
29
|
+
*
|
|
30
|
+
* Note that this event is not available by default. To make it available,
|
|
31
|
+
* {@link module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver}
|
|
32
|
+
* needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
|
|
33
|
+
*
|
|
34
|
+
* @see module:list/tododocumentlist/todocheckboxchangeobserver~TodoCheckboxChangeObserver
|
|
35
|
+
* @eventName module:engine/view/document~Document#todoCheckboxChange
|
|
36
|
+
* @param data The event data.
|
|
37
|
+
*/
|
|
38
|
+
export type ViewDocumentTodoCheckboxChangeEvent = {
|
|
39
|
+
name: 'todoCheckboxChange';
|
|
40
|
+
args: [data: DomEventData<Event>];
|
|
41
|
+
};
|