@ckeditor/ckeditor5-list 36.0.0 → 37.0.0-alpha.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/build/list.js +1 -1
- package/package.json +39 -38
- package/src/documentlist/converters.d.ts +63 -0
- package/src/documentlist/converters.js +4 -4
- package/src/documentlist/documentlistcommand.d.ts +81 -0
- package/src/documentlist/documentlistcommand.js +1 -0
- package/src/documentlist/documentlistediting.d.ts +156 -0
- package/src/documentlist/documentlistindentcommand.d.ts +63 -0
- package/src/documentlist/documentlistindentcommand.js +1 -0
- package/src/documentlist/documentlistmergecommand.d.ts +77 -0
- package/src/documentlist/documentlistmergecommand.js +1 -0
- package/src/documentlist/documentlistsplitcommand.d.ts +68 -0
- package/src/documentlist/documentlistsplitcommand.js +1 -0
- package/src/documentlist/documentlistutils.d.ts +42 -0
- package/src/documentlist/utils/listwalker.d.ts +141 -0
- package/src/documentlist/utils/model.d.ts +193 -0
- package/src/documentlist/utils/postfixers.d.ts +37 -0
- package/src/documentlist/utils/view.d.ts +81 -0
- package/src/documentlist.d.ts +30 -0
- package/src/documentlist.js +1 -0
- package/src/documentlistproperties/converters.d.ts +19 -0
- package/src/documentlistproperties/documentlistpropertiesediting.d.ts +92 -0
- package/src/documentlistproperties/documentlistpropertiesutils.d.ts +38 -0
- package/src/documentlistproperties/documentlistreversedcommand.d.ts +37 -0
- package/src/documentlistproperties/documentlistreversedcommand.js +1 -0
- package/src/documentlistproperties/documentliststartcommand.d.ts +39 -0
- package/src/documentlistproperties/documentliststartcommand.js +1 -0
- package/src/documentlistproperties/documentliststylecommand.d.ts +73 -0
- package/src/documentlistproperties/documentliststylecommand.js +1 -0
- package/src/documentlistproperties/utils/style.d.ts +20 -0
- package/src/documentlistproperties.d.ts +31 -0
- package/src/documentlistproperties.js +1 -0
- package/src/index.d.ts +25 -0
- package/src/index.js +2 -0
- package/src/list/converters.d.ts +196 -0
- package/src/list/converters.js +2 -2
- package/src/list/indentcommand.d.ts +39 -0
- package/src/list/indentcommand.js +1 -0
- package/src/list/listcommand.d.ts +56 -0
- package/src/list/listcommand.js +1 -0
- package/src/list/listediting.d.ts +34 -0
- package/src/list/listui.d.ts +24 -0
- package/src/list/listutils.d.ts +46 -0
- package/src/list/utils.d.ts +113 -0
- package/src/list/utils.js +2 -1
- package/src/list.d.ts +26 -0
- package/src/listcommands.d.ts +37 -0
- package/src/listconfig.d.ts +132 -0
- package/src/listproperties/listpropertiesediting.d.ts +76 -0
- package/src/listproperties/listpropertiesui.d.ts +29 -0
- package/src/listproperties/listpropertiesui.js +1 -0
- package/src/listproperties/listreversedcommand.d.ts +39 -0
- package/src/listproperties/listreversedcommand.js +1 -0
- package/src/listproperties/liststartcommand.d.ts +38 -0
- package/src/listproperties/liststartcommand.js +1 -0
- package/src/listproperties/liststylecommand.d.ts +68 -0
- package/src/listproperties/liststylecommand.js +2 -1
- package/src/listproperties/ui/collapsibleview.d.ts +63 -0
- package/src/listproperties/ui/listpropertiesview.d.ts +157 -0
- package/src/listproperties.d.ts +30 -0
- package/src/listproperties.js +1 -0
- package/src/liststyle.d.ts +32 -0
- package/src/todolist/checktodolistcommand.d.ts +53 -0
- package/src/todolist/checktodolistcommand.js +1 -0
- package/src/todolist/todolistconverters.d.ts +82 -0
- package/src/todolist/todolistediting.d.ts +43 -0
- package/src/todolist/todolistui.d.ts +24 -0
- package/src/todolist.d.ts +27 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Command } from 'ckeditor5/src/core';
|
|
9
9
|
import { getListTypeFromListStyleType, getSelectedListItems } from '../list/utils';
|
|
10
|
+
import '../listcommands';
|
|
10
11
|
/**
|
|
11
12
|
* The list style command. It changes the `listStyle` attribute of the selected list items.
|
|
12
13
|
*
|
|
@@ -77,7 +78,7 @@ export default class ListStyleCommand extends Command {
|
|
|
77
78
|
return numberedList.isEnabled || bulletedList.isEnabled;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
|
-
*
|
|
81
|
+
* Checks if the provided list style is valid. Also changes the selection to a list if it's not set yet.
|
|
81
82
|
*
|
|
82
83
|
* @param The type of the list style. If `null` is specified, the function does nothing.
|
|
83
84
|
*/
|
|
@@ -0,0 +1,63 @@
|
|
|
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/ui/collapsibleview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from 'ckeditor5/src/utils';
|
|
9
|
+
import { View, ButtonView, type ViewCollection } from 'ckeditor5/src/ui';
|
|
10
|
+
import '../../../theme/collapsible.css';
|
|
11
|
+
/**
|
|
12
|
+
* A collapsible UI component. Consists of a labeled button and a container which can be collapsed
|
|
13
|
+
* by clicking the button. The collapsible container can be a host to other UI views.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export default class CollapsibleView extends View {
|
|
18
|
+
/**
|
|
19
|
+
* `true` when the container with {@link #children} is collapsed. `false` otherwise.
|
|
20
|
+
*
|
|
21
|
+
* @observable
|
|
22
|
+
*/
|
|
23
|
+
isCollapsed: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The text label of the {@link #buttonView}.
|
|
26
|
+
*
|
|
27
|
+
* @observable
|
|
28
|
+
* @default 'Show more'
|
|
29
|
+
*/
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* The ID of the label inside the {@link #buttonView} that describes the collapsible
|
|
33
|
+
* container for assistive technologies. Set after the button was {@link #render rendered}.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
* @readonly
|
|
37
|
+
* @observable
|
|
38
|
+
*/
|
|
39
|
+
_collapsibleAriaLabelUid: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The main button that, when clicked, collapses or expands the container with {@link #children}.
|
|
42
|
+
*/
|
|
43
|
+
readonly buttonView: ButtonView;
|
|
44
|
+
/**
|
|
45
|
+
* A collection of the child views that can be collapsed by clicking the {@link #buttonView}.
|
|
46
|
+
*/
|
|
47
|
+
readonly children: ViewCollection;
|
|
48
|
+
/**
|
|
49
|
+
* Creates an instance of the collapsible view.
|
|
50
|
+
*
|
|
51
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
52
|
+
* @param childViews An optional array of initial child views to be inserted into the collapsible.
|
|
53
|
+
*/
|
|
54
|
+
constructor(locale: Locale, childViews?: Array<View>);
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
render(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Creates the main {@link #buttonView} of the collapsible.
|
|
61
|
+
*/
|
|
62
|
+
private _createButtonView;
|
|
63
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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/ui/listpropertiesview
|
|
7
|
+
*/
|
|
8
|
+
import { View, ViewCollection, FocusCycler, SwitchButtonView, LabeledFieldView, type ButtonView, type InputNumberView } from 'ckeditor5/src/ui';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils';
|
|
10
|
+
import CollapsibleView from './collapsibleview';
|
|
11
|
+
import type { ListPropertiesConfig } from '../../listconfig';
|
|
12
|
+
import '../../../theme/listproperties.css';
|
|
13
|
+
/**
|
|
14
|
+
* The list properties view to be displayed in the list dropdown.
|
|
15
|
+
*
|
|
16
|
+
* Contains a grid of available list styles and, for numbered list, also the list start index and reversed fields.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export default class ListPropertiesView extends View {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
locale: Locale;
|
|
25
|
+
/**
|
|
26
|
+
* A collection of the child views.
|
|
27
|
+
*/
|
|
28
|
+
readonly children: ViewCollection;
|
|
29
|
+
/**
|
|
30
|
+
* A view that renders the grid of list styles.
|
|
31
|
+
*/
|
|
32
|
+
readonly stylesView: StylesView | null;
|
|
33
|
+
/**
|
|
34
|
+
* A collapsible view that hosts additional list property fields ({@link #startIndexFieldView} and
|
|
35
|
+
* {@link #reversedSwitchButtonView}) to visually separate them from the {@link #stylesView grid of styles}.
|
|
36
|
+
*
|
|
37
|
+
* **Note**: Only present when:
|
|
38
|
+
* * the view represents **numbered** list properties,
|
|
39
|
+
* * and the {@link #stylesView} is rendered,
|
|
40
|
+
* * and either {@link #startIndexFieldView} or {@link #reversedSwitchButtonView} is rendered.
|
|
41
|
+
*
|
|
42
|
+
* @readonly
|
|
43
|
+
*/
|
|
44
|
+
additionalPropertiesCollapsibleView: CollapsibleView | null;
|
|
45
|
+
/**
|
|
46
|
+
* A labeled number field allowing the user to set the start index of the list.
|
|
47
|
+
*
|
|
48
|
+
* **Note**: Only present when the view represents **numbered** list properties.
|
|
49
|
+
*
|
|
50
|
+
* @readonly
|
|
51
|
+
*/
|
|
52
|
+
startIndexFieldView: LabeledFieldView<InputNumberView> | null;
|
|
53
|
+
/**
|
|
54
|
+
* A switch button allowing the user to make the edited list reversed.
|
|
55
|
+
*
|
|
56
|
+
* **Note**: Only present when the view represents **numbered** list properties.
|
|
57
|
+
*
|
|
58
|
+
* @readonly
|
|
59
|
+
*/
|
|
60
|
+
reversedSwitchButtonView: SwitchButtonView | null;
|
|
61
|
+
/**
|
|
62
|
+
* Tracks information about the DOM focus in the view.
|
|
63
|
+
*/
|
|
64
|
+
readonly focusTracker: FocusTracker;
|
|
65
|
+
/**
|
|
66
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
67
|
+
*/
|
|
68
|
+
readonly keystrokes: KeystrokeHandler;
|
|
69
|
+
/**
|
|
70
|
+
* A collection of views that can be focused in the properties view.
|
|
71
|
+
*/
|
|
72
|
+
readonly focusables: ViewCollection;
|
|
73
|
+
/**
|
|
74
|
+
* Helps cycling over {@link #focusables} in the view.
|
|
75
|
+
*/
|
|
76
|
+
readonly focusCycler: FocusCycler;
|
|
77
|
+
/**
|
|
78
|
+
* Creates an instance of the list properties view.
|
|
79
|
+
*
|
|
80
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
81
|
+
* @param options Options of the view.
|
|
82
|
+
* @param options.enabledProperties An object containing the configuration of enabled list property names.
|
|
83
|
+
* Allows conditional rendering the sub-components of the properties view.
|
|
84
|
+
* @param options.styleButtonViews A list of style buttons to be rendered
|
|
85
|
+
* inside the styles grid. The grid will not be rendered when `enabledProperties` does not include the `'styles'` key.
|
|
86
|
+
* @param options.styleGridAriaLabel An assistive technologies label set on the grid of styles (if the grid is rendered).
|
|
87
|
+
*/
|
|
88
|
+
constructor(locale: Locale, { enabledProperties, styleButtonViews, styleGridAriaLabel }: {
|
|
89
|
+
enabledProperties: ListPropertiesConfig;
|
|
90
|
+
styleButtonViews: Array<ButtonView> | null;
|
|
91
|
+
styleGridAriaLabel: string;
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* @inheritDoc
|
|
95
|
+
*/
|
|
96
|
+
render(): void;
|
|
97
|
+
/**
|
|
98
|
+
* @inheritDoc
|
|
99
|
+
*/
|
|
100
|
+
focus(): void;
|
|
101
|
+
/**
|
|
102
|
+
* @inheritDoc
|
|
103
|
+
*/
|
|
104
|
+
focusLast(): void;
|
|
105
|
+
/**
|
|
106
|
+
* @inheritDoc
|
|
107
|
+
*/
|
|
108
|
+
destroy(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Creates the list styles grid.
|
|
111
|
+
*
|
|
112
|
+
* @param styleButtons Buttons to be placed in the grid.
|
|
113
|
+
* @param styleGridAriaLabel The assistive technology label of the grid.
|
|
114
|
+
*/
|
|
115
|
+
private _createStylesView;
|
|
116
|
+
/**
|
|
117
|
+
* Renders {@link #startIndexFieldView} and/or {@link #reversedSwitchButtonView} depending on the configuration of the properties view.
|
|
118
|
+
*
|
|
119
|
+
* @param enabledProperties An object containing the configuration of enabled list property names
|
|
120
|
+
* (see {@link #constructor}).
|
|
121
|
+
*/
|
|
122
|
+
private _addNumberedListPropertyViews;
|
|
123
|
+
/**
|
|
124
|
+
* Creates the list start index labeled field.
|
|
125
|
+
*/
|
|
126
|
+
private _createStartIndexField;
|
|
127
|
+
/**
|
|
128
|
+
* Creates the reversed list switch button.
|
|
129
|
+
*/
|
|
130
|
+
private _createReversedSwitchButton;
|
|
131
|
+
}
|
|
132
|
+
export type StylesView = View & {
|
|
133
|
+
children: ViewCollection;
|
|
134
|
+
focusTracker: FocusTracker;
|
|
135
|
+
keystrokes: KeystrokeHandler;
|
|
136
|
+
focus(): void;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Fired when the list start index value has changed via {@link #startIndexFieldView}.
|
|
140
|
+
*
|
|
141
|
+
* @eventName listStart
|
|
142
|
+
*/
|
|
143
|
+
export type ListPropertiesViewListStartEvent = {
|
|
144
|
+
name: 'listStart';
|
|
145
|
+
args: [data: {
|
|
146
|
+
startIndex: number;
|
|
147
|
+
}];
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Fired when the list order has changed (reversed) via {@link #reversedSwitchButtonView}.
|
|
151
|
+
*
|
|
152
|
+
* @eventName listReversed
|
|
153
|
+
*/
|
|
154
|
+
export type ListPropertiesViewListReversedEvent = {
|
|
155
|
+
name: 'listReversed';
|
|
156
|
+
args: [];
|
|
157
|
+
};
|
|
@@ -0,0 +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, type PluginDependencies } from 'ckeditor5/src/core';
|
|
9
|
+
import './listconfig';
|
|
10
|
+
/**
|
|
11
|
+
* The list properties feature.
|
|
12
|
+
*
|
|
13
|
+
* This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
14
|
+
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
15
|
+
*/
|
|
16
|
+
export default class ListProperties extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get requires(): PluginDependencies;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName(): 'ListProperties';
|
|
25
|
+
}
|
|
26
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
27
|
+
interface PluginsMap {
|
|
28
|
+
[ListProperties.pluginName]: ListProperties;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/listproperties.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
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, type PluginDependencies } from 'ckeditor5/src/core';
|
|
9
|
+
/**
|
|
10
|
+
* The list style feature.
|
|
11
|
+
*
|
|
12
|
+
* This is an obsolete plugin that exists for backward compatibility only.
|
|
13
|
+
* Use the {@link module:list/listproperties~ListProperties list properties plugin} instead.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
export default class ListStyle extends Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get requires(): PluginDependencies;
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get pluginName(): 'ListStyle';
|
|
26
|
+
constructor(editor: Editor);
|
|
27
|
+
}
|
|
28
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
29
|
+
interface PluginsMap {
|
|
30
|
+
[ListStyle.pluginName]: ListStyle;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
*/
|
|
8
|
+
import { Command, type Editor } from 'ckeditor5/src/core';
|
|
9
|
+
import type { Element } from 'ckeditor5/src/engine';
|
|
10
|
+
import '../listcommands';
|
|
11
|
+
/**
|
|
12
|
+
* The check to-do command.
|
|
13
|
+
*
|
|
14
|
+
* The command is registered by the {@link module:list/todolist/todolistediting~TodoListEditing} as
|
|
15
|
+
* the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
|
|
16
|
+
*/
|
|
17
|
+
export default class CheckTodoListCommand extends Command {
|
|
18
|
+
/**
|
|
19
|
+
* A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
20
|
+
*
|
|
21
|
+
* @observable
|
|
22
|
+
* @readonly
|
|
23
|
+
*/
|
|
24
|
+
value: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
_selectedElements: Array<Element>;
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
constructor(editor: Editor);
|
|
35
|
+
/**
|
|
36
|
+
* Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
|
|
37
|
+
*/
|
|
38
|
+
refresh(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
|
|
41
|
+
*/
|
|
42
|
+
private _getSelectedItems;
|
|
43
|
+
/**
|
|
44
|
+
* Executes the command.
|
|
45
|
+
*
|
|
46
|
+
* @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply
|
|
47
|
+
* the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
|
|
48
|
+
* value to decide what it should do.
|
|
49
|
+
*/
|
|
50
|
+
execute(options?: {
|
|
51
|
+
forceValue?: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
}
|
|
@@ -0,0 +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/todolist/todolistconverters
|
|
7
|
+
*/
|
|
8
|
+
import type { DowncastAttributeEvent, DowncastInsertEvent, Element, MapperModelToViewPositionEvent, Model, UpcastElementEvent, View } from 'ckeditor5/src/engine';
|
|
9
|
+
import { type GetCallback } from 'ckeditor5/src/utils';
|
|
10
|
+
/**
|
|
11
|
+
* A model-to-view converter for the `listItem` model element insertion.
|
|
12
|
+
*
|
|
13
|
+
* It converts the `listItem` model element to an unordered list with a {@link module:engine/view/uielement~UIElement checkbox element}
|
|
14
|
+
* at the beginning of each list item. It also merges the list with surrounding lists (if available).
|
|
15
|
+
*
|
|
16
|
+
* It is used by {@link module:engine/controller/editingcontroller~EditingController}.
|
|
17
|
+
*
|
|
18
|
+
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
|
|
19
|
+
* @param model Model instance.
|
|
20
|
+
* @param onCheckboxChecked Callback function.
|
|
21
|
+
* @returns Returns a conversion callback.
|
|
22
|
+
*/
|
|
23
|
+
export declare function modelViewInsertion(model: Model, onCheckboxChecked: (element: Element) => void): GetCallback<DowncastInsertEvent<Element>>;
|
|
24
|
+
/**
|
|
25
|
+
* A model-to-view converter for the `listItem` model element insertion.
|
|
26
|
+
*
|
|
27
|
+
* It is used by {@link module:engine/controller/datacontroller~DataController}.
|
|
28
|
+
*
|
|
29
|
+
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
|
|
30
|
+
* @param model Model instance.
|
|
31
|
+
* @returns Returns a conversion callback.
|
|
32
|
+
*/
|
|
33
|
+
export declare function dataModelViewInsertion(model: Model): GetCallback<DowncastInsertEvent<Element>>;
|
|
34
|
+
/**
|
|
35
|
+
* A view-to-model converter for the checkbox element inside a view list item.
|
|
36
|
+
*
|
|
37
|
+
* It changes the `listType` of the model `listItem` to a `todo` value.
|
|
38
|
+
* When a view checkbox element is marked as checked, an additional `todoListChecked="true"` attribute is added to the model item.
|
|
39
|
+
*
|
|
40
|
+
* It is used by {@link module:engine/controller/datacontroller~DataController}.
|
|
41
|
+
*
|
|
42
|
+
* @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
|
|
43
|
+
*/
|
|
44
|
+
export declare const dataViewModelCheckmarkInsertion: GetCallback<UpcastElementEvent>;
|
|
45
|
+
/**
|
|
46
|
+
* A model-to-view converter for the `listType` attribute change on the `listItem` model element.
|
|
47
|
+
*
|
|
48
|
+
* This change means that the `<li>` element parent changes to `<ul class="todo-list">` and a
|
|
49
|
+
* {@link module:engine/view/uielement~UIElement checkbox UI element} is added at the beginning
|
|
50
|
+
* of the list item element (or vice versa).
|
|
51
|
+
*
|
|
52
|
+
* This converter is preceded by {@link module:list/list/converters~modelViewChangeType} and followed by
|
|
53
|
+
* {@link module:list/list/converters~modelViewMergeAfterChangeType} to handle splitting and merging surrounding lists of the same type.
|
|
54
|
+
*
|
|
55
|
+
* It is used by {@link module:engine/controller/editingcontroller~EditingController}.
|
|
56
|
+
*
|
|
57
|
+
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
|
|
58
|
+
* @param onCheckedChange Callback fired after clicking the checkbox UI element.
|
|
59
|
+
* @param view Editing view controller.
|
|
60
|
+
* @returns Returns a conversion callback.
|
|
61
|
+
*/
|
|
62
|
+
export declare function modelViewChangeType(onCheckedChange: (element: Element) => void, view: View): GetCallback<DowncastAttributeEvent<Element>>;
|
|
63
|
+
/**
|
|
64
|
+
* A model-to-view converter for the `todoListChecked` attribute change on the `listItem` model element.
|
|
65
|
+
*
|
|
66
|
+
* It marks the {@link module:engine/view/uielement~UIElement checkbox UI element} as checked.
|
|
67
|
+
*
|
|
68
|
+
* It is used by {@link module:engine/controller/editingcontroller~EditingController}.
|
|
69
|
+
*
|
|
70
|
+
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
|
|
71
|
+
* @param onCheckedChange Callback fired after clicking the checkbox UI element.
|
|
72
|
+
* @returns Returns a conversion callback.
|
|
73
|
+
*/
|
|
74
|
+
export declare function modelViewChangeChecked(onCheckedChange: (element: Element) => void): GetCallback<DowncastAttributeEvent<Element>>;
|
|
75
|
+
/**
|
|
76
|
+
* A model-to-view position at zero offset mapper.
|
|
77
|
+
*
|
|
78
|
+
* This helper ensures that position inside todo-list in the view is mapped after the checkbox.
|
|
79
|
+
*
|
|
80
|
+
* It only handles the position at the beginning of a list item as other positions are properly mapped be the default mapper.
|
|
81
|
+
*/
|
|
82
|
+
export declare function mapModelToViewPosition(view: View): GetCallback<MapperModelToViewPositionEvent>;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
|
|
6
|
+
/**
|
|
7
|
+
* The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
|
|
8
|
+
*
|
|
9
|
+
* It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin} and extends
|
|
10
|
+
* it with the commands:
|
|
11
|
+
*
|
|
12
|
+
* - `'todoList'`,
|
|
13
|
+
* - `'checkTodoList'`,
|
|
14
|
+
* - `'todoListCheck'` as an alias for `checkTodoList` command.
|
|
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(): PluginDependencies;
|
|
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
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
40
|
+
interface PluginsMap {
|
|
41
|
+
[TodoListEditing.pluginName]: TodoListEditing;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
+
/**
|
|
7
|
+
* The to-do list UI feature. It introduces the `'todoList'` button that
|
|
8
|
+
* allows to convert elements to and from to-do list items and to indent or outdent them.
|
|
9
|
+
*/
|
|
10
|
+
export default class TodoListUI extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
static get pluginName(): 'TodoListUI';
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
init(): void;
|
|
19
|
+
}
|
|
20
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
21
|
+
interface PluginsMap {
|
|
22
|
+
[TodoListUI.pluginName]: TodoListUI;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
|
|
6
|
+
import '../theme/todolist.css';
|
|
7
|
+
/**
|
|
8
|
+
* The to-do list feature.
|
|
9
|
+
*
|
|
10
|
+
* This is a "glue" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list editing feature}
|
|
11
|
+
* and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
|
|
12
|
+
*/
|
|
13
|
+
export default class TodoList extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get requires(): PluginDependencies;
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): 'TodoList';
|
|
22
|
+
}
|
|
23
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
24
|
+
interface PluginsMap {
|
|
25
|
+
[TodoList.pluginName]: TodoList;
|
|
26
|
+
}
|
|
27
|
+
}
|