@ckeditor/ckeditor5-list 47.6.1-alpha.1 → 48.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/LICENSE.md +1 -1
- package/ckeditor5-metadata.json +21 -18
- package/dist/index-content.css +135 -111
- package/dist/index-editor.css +152 -73
- package/dist/index.css +204 -238
- package/dist/index.css.map +1 -1
- package/dist/index.js.map +1 -1
- package/{src → dist}/legacylist/legacyconverters.d.ts +2 -2
- package/{src → dist}/legacylist/legacyindentcommand.d.ts +1 -1
- package/{src → dist}/legacylist/legacylistcommand.d.ts +1 -1
- package/{src → dist}/legacylist/legacylistediting.d.ts +3 -3
- package/{src → dist}/legacylist/legacylistutils.d.ts +2 -2
- package/{src → dist}/legacylist/legacyutils.d.ts +1 -1
- package/{src → dist}/legacylist.d.ts +1 -1
- package/{src → dist}/legacylistproperties/legacylistpropertiesediting.d.ts +1 -1
- package/{src → dist}/legacylistproperties/legacylistreversedcommand.d.ts +1 -1
- package/{src → dist}/legacylistproperties/legacyliststartcommand.d.ts +1 -1
- package/{src → dist}/legacylistproperties/legacyliststylecommand.d.ts +1 -1
- package/{src → dist}/legacylistproperties.d.ts +1 -1
- package/{src → dist}/legacytodolist/legacychecktodolistcommand.d.ts +2 -2
- package/{src → dist}/legacytodolist/legacytodolistconverters.d.ts +2 -2
- package/{src → dist}/legacytodolist/legacytodolistediting.d.ts +1 -1
- package/{src → dist}/legacytodolist.d.ts +1 -1
- package/{src → dist}/list/adjacentlistssupport.d.ts +1 -1
- package/{src → dist}/list/converters.d.ts +2 -2
- package/{src → dist}/list/listcommand.d.ts +2 -2
- package/{src → dist}/list/listediting.d.ts +5 -5
- package/{src → dist}/list/listindentcommand.d.ts +2 -2
- package/{src → dist}/list/listmergecommand.d.ts +2 -2
- package/{src → dist}/list/listsplitcommand.d.ts +2 -2
- package/{src → dist}/list/listui.d.ts +1 -1
- package/{src → dist}/list/listutils.d.ts +3 -3
- package/{src → dist}/list/utils/listwalker.d.ts +2 -2
- package/{src → dist}/list/utils/model.d.ts +2 -2
- package/{src → dist}/list/utils/postfixers.d.ts +1 -1
- package/{src → dist}/list/utils/view.d.ts +1 -1
- package/{src → dist}/list/utils.d.ts +1 -1
- package/{src → dist}/list.d.ts +1 -1
- package/{src → dist}/listconfig.d.ts +1 -1
- package/{src → dist}/listformatting/listitemboldintegration.d.ts +1 -1
- package/{src → dist}/listformatting/listitemfontcolorintegration.d.ts +1 -1
- package/{src → dist}/listformatting/listitemfontfamilyintegration.d.ts +1 -1
- package/{src → dist}/listformatting/listitemfontsizeintegration.d.ts +1 -1
- package/{src → dist}/listformatting/listitemitalicintegration.d.ts +1 -1
- package/{src → dist}/listformatting.d.ts +1 -1
- package/{src → dist}/listproperties/converters.d.ts +2 -2
- package/{src → dist}/listproperties/listpropertiesediting.d.ts +2 -2
- package/{src → dist}/listproperties/listpropertiesui.d.ts +1 -1
- package/{src → dist}/listproperties/listpropertiesutils.d.ts +1 -1
- package/{src → dist}/listproperties/listreversedcommand.d.ts +1 -1
- package/{src → dist}/listproperties/liststartcommand.d.ts +1 -1
- package/{src → dist}/listproperties/liststylecommand.d.ts +1 -1
- package/{src → dist}/listproperties/ui/listpropertiesview.d.ts +2 -2
- package/{src → dist}/listproperties.d.ts +1 -1
- package/{src → dist}/todolist/checktodolistcommand.d.ts +1 -1
- package/{src → dist}/todolist/todocheckboxchangeobserver.d.ts +1 -1
- package/{src → dist}/todolist/todolistediting.d.ts +1 -1
- package/{src → dist}/todolist/todolistui.d.ts +1 -1
- package/{src → dist}/todolist.d.ts +1 -1
- package/package.json +28 -52
- package/build/list.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -37
- package/lang/translations/af.po +0 -152
- package/lang/translations/ar.po +0 -152
- package/lang/translations/ast.po +0 -152
- package/lang/translations/az.po +0 -152
- package/lang/translations/be.po +0 -152
- package/lang/translations/bg.po +0 -152
- package/lang/translations/bn.po +0 -152
- package/lang/translations/bs.po +0 -152
- package/lang/translations/ca.po +0 -152
- package/lang/translations/cs.po +0 -152
- package/lang/translations/da.po +0 -152
- package/lang/translations/de-ch.po +0 -152
- package/lang/translations/de.po +0 -152
- package/lang/translations/el.po +0 -152
- package/lang/translations/en-au.po +0 -152
- package/lang/translations/en-gb.po +0 -152
- package/lang/translations/en.po +0 -152
- package/lang/translations/eo.po +0 -152
- package/lang/translations/es-co.po +0 -152
- package/lang/translations/es.po +0 -152
- package/lang/translations/et.po +0 -152
- package/lang/translations/eu.po +0 -152
- package/lang/translations/fa.po +0 -152
- package/lang/translations/fi.po +0 -152
- package/lang/translations/fr.po +0 -152
- package/lang/translations/gl.po +0 -152
- package/lang/translations/gu.po +0 -152
- package/lang/translations/he.po +0 -152
- package/lang/translations/hi.po +0 -152
- package/lang/translations/hr.po +0 -152
- package/lang/translations/hu.po +0 -152
- package/lang/translations/hy.po +0 -152
- package/lang/translations/id.po +0 -152
- package/lang/translations/it.po +0 -152
- package/lang/translations/ja.po +0 -152
- package/lang/translations/jv.po +0 -152
- package/lang/translations/kk.po +0 -152
- package/lang/translations/km.po +0 -152
- package/lang/translations/kn.po +0 -152
- package/lang/translations/ko.po +0 -152
- package/lang/translations/ku.po +0 -152
- package/lang/translations/lt.po +0 -152
- package/lang/translations/lv.po +0 -152
- package/lang/translations/ms.po +0 -152
- package/lang/translations/nb.po +0 -152
- package/lang/translations/ne.po +0 -152
- package/lang/translations/nl.po +0 -152
- package/lang/translations/no.po +0 -152
- package/lang/translations/oc.po +0 -152
- package/lang/translations/pl.po +0 -152
- package/lang/translations/pt-br.po +0 -152
- package/lang/translations/pt.po +0 -152
- package/lang/translations/ro.po +0 -152
- package/lang/translations/ru.po +0 -152
- package/lang/translations/si.po +0 -152
- package/lang/translations/sk.po +0 -152
- package/lang/translations/sl.po +0 -152
- package/lang/translations/sq.po +0 -152
- package/lang/translations/sr-latn.po +0 -152
- package/lang/translations/sr.po +0 -152
- package/lang/translations/sv.po +0 -152
- package/lang/translations/th.po +0 -152
- package/lang/translations/ti.po +0 -152
- package/lang/translations/tk.po +0 -152
- package/lang/translations/tr.po +0 -152
- package/lang/translations/tt.po +0 -152
- package/lang/translations/ug.po +0 -152
- package/lang/translations/uk.po +0 -152
- package/lang/translations/ur.po +0 -152
- package/lang/translations/uz.po +0 -152
- package/lang/translations/vi.po +0 -152
- package/lang/translations/zh-cn.po +0 -152
- package/lang/translations/zh.po +0 -152
- package/src/augmentation.js +0 -5
- package/src/index.js +0 -67
- package/src/legacyerrors.js +0 -28
- package/src/legacylist/legacyconverters.js +0 -921
- package/src/legacylist/legacyindentcommand.js +0 -111
- package/src/legacylist/legacylistcommand.js +0 -278
- package/src/legacylist/legacylistediting.js +0 -167
- package/src/legacylist/legacylistutils.js +0 -52
- package/src/legacylist/legacyutils.js +0 -357
- package/src/legacylist.js +0 -36
- package/src/legacylistproperties/legacylistpropertiesediting.js +0 -703
- package/src/legacylistproperties/legacylistreversedcommand.js +0 -52
- package/src/legacylistproperties/legacyliststartcommand.js +0 -52
- package/src/legacylistproperties/legacyliststylecommand.js +0 -105
- package/src/legacylistproperties.js +0 -37
- package/src/legacytodolist/legacychecktodolistcommand.js +0 -82
- package/src/legacytodolist/legacytodolistconverters.js +0 -268
- package/src/legacytodolist/legacytodolistediting.js +0 -199
- package/src/legacytodolist.js +0 -37
- package/src/list/adjacentlistssupport.js +0 -87
- package/src/list/converters.js +0 -533
- package/src/list/listcommand.js +0 -176
- package/src/list/listediting.js +0 -696
- package/src/list/listindentcommand.js +0 -136
- package/src/list/listmergecommand.js +0 -182
- package/src/list/listsplitcommand.js +0 -74
- package/src/list/listui.js +0 -42
- package/src/list/listutils.js +0 -68
- package/src/list/utils/listwalker.js +0 -236
- package/src/list/utils/model.js +0 -487
- package/src/list/utils/postfixers.js +0 -131
- package/src/list/utils/view.js +0 -117
- package/src/list/utils.js +0 -51
- package/src/list.js +0 -36
- package/src/listconfig.js +0 -5
- package/src/listformatting/listitemboldintegration.js +0 -88
- package/src/listformatting/listitemfontcolorintegration.js +0 -92
- package/src/listformatting/listitemfontfamilyintegration.js +0 -93
- package/src/listformatting/listitemfontsizeintegration.js +0 -124
- package/src/listformatting/listitemitalicintegration.js +0 -88
- package/src/listformatting.js +0 -248
- package/src/listproperties/converters.js +0 -43
- package/src/listproperties/listpropertiesediting.js +0 -291
- package/src/listproperties/listpropertiesui.js +0 -385
- package/src/listproperties/listpropertiesutils.js +0 -50
- package/src/listproperties/listreversedcommand.js +0 -55
- package/src/listproperties/liststartcommand.js +0 -61
- package/src/listproperties/liststylecommand.js +0 -121
- package/src/listproperties/ui/listpropertiesview.js +0 -318
- package/src/listproperties/utils/config.js +0 -84
- package/src/listproperties/utils/style.js +0 -85
- package/src/listproperties.js +0 -37
- package/src/todolist/checktodolistcommand.js +0 -82
- package/src/todolist/todocheckboxchangeobserver.js +0 -36
- package/src/todolist/todolistediting.js +0 -470
- package/src/todolist/todolistui.js +0 -35
- package/src/todolist.js +0 -37
- package/theme/documentlist.css +0 -8
- package/theme/list.css +0 -40
- package/theme/listformatting.css +0 -66
- package/theme/listproperties.css +0 -10
- package/theme/liststyles.css +0 -8
- package/theme/todolist.css +0 -140
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/legacyerrors.d.ts +0 -0
- /package/{src → dist}/listproperties/utils/config.d.ts +0 -0
- /package/{src → dist}/listproperties/utils/style.d.ts +0 -0
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module list/listproperties/ui/listpropertiesview
|
|
7
|
-
*/
|
|
8
|
-
import { ButtonView, View, ViewCollection, FocusCycler, SwitchButtonView, LabeledFieldView, createLabeledInputNumber, addKeyboardHandlingForGrid, CollapsibleView } from 'ckeditor5/src/ui.js';
|
|
9
|
-
import { FocusTracker, KeystrokeHandler, global } from 'ckeditor5/src/utils.js';
|
|
10
|
-
import '../../../theme/listproperties.css';
|
|
11
|
-
/**
|
|
12
|
-
* The list properties view to be displayed in the list dropdown.
|
|
13
|
-
*
|
|
14
|
-
* Contains a grid of available list styles and, for numbered list, also the list start index and reversed fields.
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export class ListPropertiesView extends View {
|
|
19
|
-
/**
|
|
20
|
-
* A collection of the child views.
|
|
21
|
-
*/
|
|
22
|
-
children;
|
|
23
|
-
/**
|
|
24
|
-
* A view that renders the grid of list styles.
|
|
25
|
-
*/
|
|
26
|
-
stylesView = null;
|
|
27
|
-
/**
|
|
28
|
-
* A collapsible view that hosts additional list property fields ({@link #startIndexFieldView} and
|
|
29
|
-
* {@link #reversedSwitchButtonView}) to visually separate them from the {@link #stylesView grid of styles}.
|
|
30
|
-
*
|
|
31
|
-
* **Note**: Only present when:
|
|
32
|
-
* * the view represents **numbered** list properties,
|
|
33
|
-
* * and the {@link #stylesView} is rendered,
|
|
34
|
-
* * and either {@link #startIndexFieldView} or {@link #reversedSwitchButtonView} is rendered.
|
|
35
|
-
*
|
|
36
|
-
* @readonly
|
|
37
|
-
*/
|
|
38
|
-
additionalPropertiesCollapsibleView = null;
|
|
39
|
-
/**
|
|
40
|
-
* A labeled number field allowing the user to set the start index of the list.
|
|
41
|
-
*
|
|
42
|
-
* **Note**: Only present when the view represents **numbered** list properties.
|
|
43
|
-
*
|
|
44
|
-
* @readonly
|
|
45
|
-
*/
|
|
46
|
-
startIndexFieldView = null;
|
|
47
|
-
/**
|
|
48
|
-
* A switch button allowing the user to make the edited list reversed.
|
|
49
|
-
*
|
|
50
|
-
* **Note**: Only present when the view represents **numbered** list properties.
|
|
51
|
-
*
|
|
52
|
-
* @readonly
|
|
53
|
-
*/
|
|
54
|
-
reversedSwitchButtonView = null;
|
|
55
|
-
/**
|
|
56
|
-
* Tracks information about the DOM focus in the view.
|
|
57
|
-
*/
|
|
58
|
-
focusTracker = new FocusTracker();
|
|
59
|
-
/**
|
|
60
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
61
|
-
*/
|
|
62
|
-
keystrokes = new KeystrokeHandler();
|
|
63
|
-
/**
|
|
64
|
-
* A collection of views that can be focused in the properties view.
|
|
65
|
-
*/
|
|
66
|
-
focusables = new ViewCollection();
|
|
67
|
-
/**
|
|
68
|
-
* Helps cycling over {@link #focusables} in the view.
|
|
69
|
-
*/
|
|
70
|
-
focusCycler;
|
|
71
|
-
/**
|
|
72
|
-
* Creates an instance of the list properties view.
|
|
73
|
-
*
|
|
74
|
-
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
75
|
-
* @param options Options of the view.
|
|
76
|
-
* @param options.enabledProperties An object containing the configuration of enabled list property names.
|
|
77
|
-
* Allows conditional rendering the sub-components of the properties view.
|
|
78
|
-
* @param options.styleButtonViews A list of style buttons to be rendered
|
|
79
|
-
* inside the styles grid. The grid will not be rendered when `enabledProperties` does not include the `'styles'` key.
|
|
80
|
-
* @param options.styleGridAriaLabel An assistive technologies label set on the grid of styles (if the grid is rendered).
|
|
81
|
-
*/
|
|
82
|
-
constructor(locale, { enabledProperties, styleButtonViews, styleGridAriaLabel }) {
|
|
83
|
-
super(locale);
|
|
84
|
-
const elementCssClasses = [
|
|
85
|
-
'ck',
|
|
86
|
-
'ck-list-properties'
|
|
87
|
-
];
|
|
88
|
-
this.children = this.createCollection();
|
|
89
|
-
this.focusCycler = new FocusCycler({
|
|
90
|
-
focusables: this.focusables,
|
|
91
|
-
focusTracker: this.focusTracker,
|
|
92
|
-
keystrokeHandler: this.keystrokes,
|
|
93
|
-
actions: {
|
|
94
|
-
// Navigate #children backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.
|
|
95
|
-
focusPrevious: 'shift + tab',
|
|
96
|
-
// Navigate #children forwards using the <kbd>Tab</kbd> key.
|
|
97
|
-
focusNext: 'tab'
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
// The rendering of the styles grid is conditional. When there is no styles grid, the view will render without collapsible
|
|
101
|
-
// for numbered list properties, hence simplifying the layout.
|
|
102
|
-
if (styleButtonViews && styleButtonViews.length) {
|
|
103
|
-
this.stylesView = this._createStylesView(styleButtonViews, styleGridAriaLabel);
|
|
104
|
-
this.children.add(this.stylesView);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
elementCssClasses.push('ck-list-properties_without-styles');
|
|
108
|
-
}
|
|
109
|
-
// The rendering of the numbered list property views is also conditional. It only makes sense for the numbered list
|
|
110
|
-
// dropdown. The unordered list does not have such properties.
|
|
111
|
-
if (enabledProperties.startIndex || enabledProperties.reversed) {
|
|
112
|
-
this._addNumberedListPropertyViews(enabledProperties);
|
|
113
|
-
elementCssClasses.push('ck-list-properties_with-numbered-properties');
|
|
114
|
-
}
|
|
115
|
-
this.setTemplate({
|
|
116
|
-
tag: 'div',
|
|
117
|
-
attributes: {
|
|
118
|
-
class: elementCssClasses
|
|
119
|
-
},
|
|
120
|
-
children: this.children
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @inheritDoc
|
|
125
|
-
*/
|
|
126
|
-
render() {
|
|
127
|
-
super.render();
|
|
128
|
-
if (this.stylesView) {
|
|
129
|
-
this.focusables.add(this.stylesView);
|
|
130
|
-
this.focusTracker.add(this.stylesView.element);
|
|
131
|
-
// Register the collapsible toggle button to the focus system.
|
|
132
|
-
if (this.startIndexFieldView || this.reversedSwitchButtonView) {
|
|
133
|
-
this.focusables.add(this.children.last.buttonView);
|
|
134
|
-
this.focusTracker.add(this.children.last.buttonView.element);
|
|
135
|
-
}
|
|
136
|
-
for (const item of this.stylesView.children) {
|
|
137
|
-
this.stylesView.focusTracker.add(item.element);
|
|
138
|
-
}
|
|
139
|
-
addKeyboardHandlingForGrid({
|
|
140
|
-
keystrokeHandler: this.stylesView.keystrokes,
|
|
141
|
-
focusTracker: this.stylesView.focusTracker,
|
|
142
|
-
gridItems: this.stylesView.children,
|
|
143
|
-
// Note: The styles view has a different number of columns depending on whether the other properties
|
|
144
|
-
// are enabled in the dropdown or not (https://github.com/ckeditor/ckeditor5/issues/12340)
|
|
145
|
-
numberOfColumns: () => global.window
|
|
146
|
-
.getComputedStyle(this.stylesView.element)
|
|
147
|
-
.getPropertyValue('grid-template-columns')
|
|
148
|
-
.split(' ')
|
|
149
|
-
.length,
|
|
150
|
-
uiLanguageDirection: this.locale && this.locale.uiLanguageDirection
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
if (this.startIndexFieldView) {
|
|
154
|
-
this.focusables.add(this.startIndexFieldView);
|
|
155
|
-
this.focusTracker.add(this.startIndexFieldView.element);
|
|
156
|
-
const stopPropagation = (data) => data.stopPropagation();
|
|
157
|
-
// Since the form is in the dropdown panel which is a child of the toolbar, the toolbar's
|
|
158
|
-
// keystroke handler would take over the key management in the input. We need to prevent
|
|
159
|
-
// this ASAP. Otherwise, the basic caret movement using the arrow keys will be impossible.
|
|
160
|
-
this.keystrokes.set('arrowright', stopPropagation);
|
|
161
|
-
this.keystrokes.set('arrowleft', stopPropagation);
|
|
162
|
-
this.keystrokes.set('arrowup', stopPropagation);
|
|
163
|
-
this.keystrokes.set('arrowdown', stopPropagation);
|
|
164
|
-
}
|
|
165
|
-
if (this.reversedSwitchButtonView) {
|
|
166
|
-
this.focusables.add(this.reversedSwitchButtonView);
|
|
167
|
-
this.focusTracker.add(this.reversedSwitchButtonView.element);
|
|
168
|
-
}
|
|
169
|
-
// Start listening for the keystrokes coming from #element.
|
|
170
|
-
this.keystrokes.listenTo(this.element);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @inheritDoc
|
|
174
|
-
*/
|
|
175
|
-
focus() {
|
|
176
|
-
this.focusCycler.focusFirst();
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @inheritDoc
|
|
180
|
-
*/
|
|
181
|
-
focusLast() {
|
|
182
|
-
this.focusCycler.focusLast();
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* @inheritDoc
|
|
186
|
-
*/
|
|
187
|
-
destroy() {
|
|
188
|
-
super.destroy();
|
|
189
|
-
this.focusTracker.destroy();
|
|
190
|
-
this.keystrokes.destroy();
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Creates the list styles grid.
|
|
194
|
-
*
|
|
195
|
-
* @param styleButtons Buttons to be placed in the grid.
|
|
196
|
-
* @param styleGridAriaLabel The assistive technology label of the grid.
|
|
197
|
-
*/
|
|
198
|
-
_createStylesView(styleButtons, styleGridAriaLabel) {
|
|
199
|
-
const stylesView = new View(this.locale);
|
|
200
|
-
stylesView.children = stylesView.createCollection();
|
|
201
|
-
stylesView.children.addMany(styleButtons);
|
|
202
|
-
stylesView.setTemplate({
|
|
203
|
-
tag: 'div',
|
|
204
|
-
attributes: {
|
|
205
|
-
'aria-label': styleGridAriaLabel,
|
|
206
|
-
class: [
|
|
207
|
-
'ck',
|
|
208
|
-
'ck-list-styles-list'
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
children: stylesView.children
|
|
212
|
-
});
|
|
213
|
-
stylesView.children.delegate('execute').to(this);
|
|
214
|
-
stylesView.focus = function () {
|
|
215
|
-
// If there is a button that is already on, focus it.
|
|
216
|
-
// It's counterintuitive to focus the first button when there is already a button on.
|
|
217
|
-
for (const child of this.children) {
|
|
218
|
-
if (child instanceof ButtonView && child.isOn) {
|
|
219
|
-
child.focus();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
// ... otherwise focus the first button.
|
|
224
|
-
this.children.first.focus();
|
|
225
|
-
};
|
|
226
|
-
stylesView.focusTracker = new FocusTracker();
|
|
227
|
-
stylesView.keystrokes = new KeystrokeHandler();
|
|
228
|
-
stylesView.render();
|
|
229
|
-
stylesView.keystrokes.listenTo(stylesView.element);
|
|
230
|
-
return stylesView;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Renders {@link #startIndexFieldView} and/or {@link #reversedSwitchButtonView} depending on the configuration of the properties view.
|
|
234
|
-
*
|
|
235
|
-
* @param enabledProperties An object containing the configuration of enabled list property names
|
|
236
|
-
* (see {@link #constructor}).
|
|
237
|
-
*/
|
|
238
|
-
_addNumberedListPropertyViews(enabledProperties) {
|
|
239
|
-
const t = this.locale.t;
|
|
240
|
-
const numberedPropertyViews = [];
|
|
241
|
-
if (enabledProperties.startIndex) {
|
|
242
|
-
this.startIndexFieldView = this._createStartIndexField();
|
|
243
|
-
numberedPropertyViews.push(this.startIndexFieldView);
|
|
244
|
-
}
|
|
245
|
-
if (enabledProperties.reversed) {
|
|
246
|
-
this.reversedSwitchButtonView = this._createReversedSwitchButton();
|
|
247
|
-
numberedPropertyViews.push(this.reversedSwitchButtonView);
|
|
248
|
-
}
|
|
249
|
-
// When there are some style buttons, pack the numbered list properties into a collapsible to separate them.
|
|
250
|
-
if (this.stylesView) {
|
|
251
|
-
this.additionalPropertiesCollapsibleView = new CollapsibleView(this.locale, numberedPropertyViews);
|
|
252
|
-
this.additionalPropertiesCollapsibleView.set({
|
|
253
|
-
label: t('List properties'),
|
|
254
|
-
isCollapsed: true
|
|
255
|
-
});
|
|
256
|
-
// Don't enable the collapsible view unless either start index or reversed field is enabled (e.g. when no list is selected).
|
|
257
|
-
this.additionalPropertiesCollapsibleView.buttonView.bind('isEnabled').toMany(numberedPropertyViews, 'isEnabled', (...areEnabled) => areEnabled.some(isEnabled => isEnabled));
|
|
258
|
-
// Automatically collapse the additional properties collapsible when either start index or reversed field gets disabled.
|
|
259
|
-
this.additionalPropertiesCollapsibleView.buttonView.on('change:isEnabled', (evt, data, isEnabled) => {
|
|
260
|
-
if (!isEnabled) {
|
|
261
|
-
this.additionalPropertiesCollapsibleView.isCollapsed = true;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
this.children.add(this.additionalPropertiesCollapsibleView);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
this.children.addMany(numberedPropertyViews);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Creates the list start index labeled field.
|
|
272
|
-
*/
|
|
273
|
-
_createStartIndexField() {
|
|
274
|
-
const t = this.locale.t;
|
|
275
|
-
const startIndexFieldView = new LabeledFieldView(this.locale, createLabeledInputNumber);
|
|
276
|
-
startIndexFieldView.set({
|
|
277
|
-
label: t('Start at'),
|
|
278
|
-
class: 'ck-numbered-list-properties__start-index'
|
|
279
|
-
});
|
|
280
|
-
startIndexFieldView.fieldView.set({
|
|
281
|
-
min: 0,
|
|
282
|
-
step: 1,
|
|
283
|
-
value: 1,
|
|
284
|
-
inputMode: 'numeric'
|
|
285
|
-
});
|
|
286
|
-
startIndexFieldView.fieldView.on('input', () => {
|
|
287
|
-
const inputElement = startIndexFieldView.fieldView.element;
|
|
288
|
-
const startIndex = inputElement.valueAsNumber;
|
|
289
|
-
if (Number.isNaN(startIndex)) {
|
|
290
|
-
// Number inputs allow for the entry of characters that may result in NaN,
|
|
291
|
-
// such as 'e', '+', '123e', '2-'.
|
|
292
|
-
startIndexFieldView.errorText = t('Invalid start index value.');
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
if (!inputElement.checkValidity()) {
|
|
296
|
-
startIndexFieldView.errorText = t('Start index must be greater than 0.');
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
this.fire('listStart', { startIndex });
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
return startIndexFieldView;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Creates the reversed list switch button.
|
|
306
|
-
*/
|
|
307
|
-
_createReversedSwitchButton() {
|
|
308
|
-
const t = this.locale.t;
|
|
309
|
-
const reversedButtonView = new SwitchButtonView(this.locale);
|
|
310
|
-
reversedButtonView.set({
|
|
311
|
-
withText: true,
|
|
312
|
-
label: t('Reversed order'),
|
|
313
|
-
class: 'ck-numbered-list-properties__reversed-order'
|
|
314
|
-
});
|
|
315
|
-
reversedButtonView.delegate('execute').to(this, 'listReversed');
|
|
316
|
-
return reversedButtonView;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module list/listproperties/utils/config
|
|
7
|
-
*/
|
|
8
|
-
import { pick } from 'es-toolkit/compat';
|
|
9
|
-
import { toArray } from 'ckeditor5/src/utils.js';
|
|
10
|
-
/**
|
|
11
|
-
* Normalizes {@link module:list/listconfig~ListPropertiesConfig} in the configuration of the list properties feature.
|
|
12
|
-
* The structure of normalized list properties options looks as follows:
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* {
|
|
16
|
-
* styles: {
|
|
17
|
-
* listTypes: [ 'bulleted', 'numbered' ],
|
|
18
|
-
* useAttribute: false
|
|
19
|
-
* },
|
|
20
|
-
* startIndex: true,
|
|
21
|
-
* reversed: true
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
* @param config The list properties {@link module:list/listconfig~ListPropertiesConfig config}.
|
|
27
|
-
* @returns An object with normalized list properties options.
|
|
28
|
-
*/
|
|
29
|
-
export function getNormalizedConfig(config) {
|
|
30
|
-
const { startIndex, reversed, styles } = config;
|
|
31
|
-
return {
|
|
32
|
-
styles: getNormalizedStylesConfig(styles),
|
|
33
|
-
startIndex: startIndex || false,
|
|
34
|
-
reversed: reversed || false
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Normalizes styles in the configuration of the list properties feature.
|
|
39
|
-
* The structure of normalized list properties options looks as follows:
|
|
40
|
-
*
|
|
41
|
-
* ```ts
|
|
42
|
-
* {
|
|
43
|
-
* listTypes: [ 'bulleted', 'numbered' ],
|
|
44
|
-
* useAttribute: false
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @param styles The list properties styles.
|
|
49
|
-
* @returns An object with normalized list properties styles.
|
|
50
|
-
*/
|
|
51
|
-
function getNormalizedStylesConfig(styles) {
|
|
52
|
-
const normalizedConfig = {
|
|
53
|
-
listTypes: ['bulleted', 'numbered'],
|
|
54
|
-
useAttribute: false,
|
|
55
|
-
listStyleTypes: {
|
|
56
|
-
numbered: ['decimal', 'decimal-leading-zero', 'lower-roman', 'upper-roman', 'lower-latin', 'upper-latin'],
|
|
57
|
-
bulleted: ['disc', 'circle', 'square']
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
if (styles === true) {
|
|
61
|
-
return normalizedConfig;
|
|
62
|
-
}
|
|
63
|
-
if (!styles) {
|
|
64
|
-
normalizedConfig.listTypes = [];
|
|
65
|
-
normalizedConfig.listStyleTypes = {};
|
|
66
|
-
}
|
|
67
|
-
else if (Array.isArray(styles) || typeof styles == 'string') {
|
|
68
|
-
normalizedConfig.listTypes = toArray(styles);
|
|
69
|
-
normalizedConfig.listStyleTypes = pick(normalizedConfig.listStyleTypes, normalizedConfig.listTypes);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
normalizedConfig.listTypes = styles.listTypes ?
|
|
73
|
-
toArray(styles.listTypes) :
|
|
74
|
-
normalizedConfig.listTypes;
|
|
75
|
-
normalizedConfig.useAttribute = !!styles.useAttribute;
|
|
76
|
-
if (styles.listStyleTypes) {
|
|
77
|
-
normalizedConfig.listStyleTypes = styles.listStyleTypes;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
normalizedConfig.listStyleTypes = pick(normalizedConfig.listStyleTypes, normalizedConfig.listTypes);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return normalizedConfig;
|
|
84
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module list/listproperties/utils/style
|
|
7
|
-
*/
|
|
8
|
-
const LIST_STYLE_TO_LIST_TYPE = {};
|
|
9
|
-
const LIST_STYLE_TO_TYPE_ATTRIBUTE = {};
|
|
10
|
-
const TYPE_ATTRIBUTE_TO_LIST_STYLE = {};
|
|
11
|
-
const LIST_STYLE_TYPES = [
|
|
12
|
-
{ listStyle: 'disc', typeAttribute: 'disc', listType: 'bulleted' },
|
|
13
|
-
{ listStyle: 'circle', typeAttribute: 'circle', listType: 'bulleted' },
|
|
14
|
-
{ listStyle: 'square', typeAttribute: 'square', listType: 'bulleted' },
|
|
15
|
-
{ listStyle: 'decimal', typeAttribute: '1', listType: 'numbered' },
|
|
16
|
-
{ listStyle: 'decimal-leading-zero', typeAttribute: null, listType: 'numbered' },
|
|
17
|
-
{ listStyle: 'lower-roman', typeAttribute: 'i', listType: 'numbered' },
|
|
18
|
-
{ listStyle: 'upper-roman', typeAttribute: 'I', listType: 'numbered' },
|
|
19
|
-
{ listStyle: 'lower-alpha', typeAttribute: 'a', listType: 'numbered' },
|
|
20
|
-
{ listStyle: 'upper-alpha', typeAttribute: 'A', listType: 'numbered' },
|
|
21
|
-
{ listStyle: 'lower-latin', typeAttribute: 'a', listType: 'numbered' },
|
|
22
|
-
{ listStyle: 'upper-latin', typeAttribute: 'A', listType: 'numbered' },
|
|
23
|
-
{ listStyle: 'arabic-indic', typeAttribute: null, listType: 'numbered' }
|
|
24
|
-
];
|
|
25
|
-
for (const { listStyle, typeAttribute, listType } of LIST_STYLE_TYPES) {
|
|
26
|
-
LIST_STYLE_TO_LIST_TYPE[listStyle] = listType;
|
|
27
|
-
LIST_STYLE_TO_TYPE_ATTRIBUTE[listStyle] = typeAttribute;
|
|
28
|
-
if (typeAttribute) {
|
|
29
|
-
TYPE_ATTRIBUTE_TO_LIST_STYLE[typeAttribute] = listStyle;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Gets all the style types supported by given list type.
|
|
34
|
-
*
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
export function getAllSupportedStyleTypes() {
|
|
38
|
-
return LIST_STYLE_TYPES.map(x => x.listStyle);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Checks whether the given list-style-type is supported by numbered or bulleted list.
|
|
42
|
-
*
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
export function getListTypeFromListStyleType(listStyleType) {
|
|
46
|
-
return LIST_STYLE_TO_LIST_TYPE[listStyleType] || null;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Converts `type` attribute of `<ul>` or `<ol>` elements to `list-style-type` equivalent.
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
export function getListStyleTypeFromTypeAttribute(value) {
|
|
54
|
-
return TYPE_ATTRIBUTE_TO_LIST_STYLE[value] || null;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Converts `list-style-type` style to `type` attribute of `<ul>` or `<ol>` elements.
|
|
58
|
-
*
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
|
-
export function getTypeAttributeFromListStyleType(value) {
|
|
62
|
-
return LIST_STYLE_TO_TYPE_ATTRIBUTE[value] || null;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Normalizes list style by converting aliases to their canonical form.
|
|
66
|
-
*
|
|
67
|
-
* @internal
|
|
68
|
-
* @param listStyle The list style value to normalize.
|
|
69
|
-
* @returns The canonical form of the list style.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* normalizeListStyle( 'lower-alpha' ); // Returns 'lower-latin'
|
|
73
|
-
* normalizeListStyle( 'upper-alpha' ); // Returns 'upper-latin'
|
|
74
|
-
* normalizeListStyle( 'disc' ); // Returns 'disc'
|
|
75
|
-
*/
|
|
76
|
-
export function normalizeListStyle(listStyle) {
|
|
77
|
-
switch (listStyle) {
|
|
78
|
-
case 'lower-alpha':
|
|
79
|
-
return 'lower-latin';
|
|
80
|
-
case 'upper-alpha':
|
|
81
|
-
return 'upper-latin';
|
|
82
|
-
default:
|
|
83
|
-
return listStyle;
|
|
84
|
-
}
|
|
85
|
-
}
|
package/src/listproperties.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module list/listproperties
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { ListPropertiesEditing } from './listproperties/listpropertiesediting.js';
|
|
10
|
-
import { ListPropertiesUI } from './listproperties/listpropertiesui.js';
|
|
11
|
-
/**
|
|
12
|
-
* The list properties feature.
|
|
13
|
-
*
|
|
14
|
-
* This is a "glue" plugin that loads the
|
|
15
|
-
* {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
16
|
-
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
17
|
-
*/
|
|
18
|
-
export class ListProperties extends Plugin {
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
static get requires() {
|
|
23
|
-
return [ListPropertiesEditing, ListPropertiesUI];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get pluginName() {
|
|
29
|
-
return 'ListProperties';
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
static get isOfficialPlugin() {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module list/todolist/checktodolistcommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { getAllListItemBlocks } from '../list/utils/model.js';
|
|
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.
|
|
15
|
-
*/
|
|
16
|
-
export class CheckTodoListCommand 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~ModelSelection}.
|
|
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,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module list/todolist/todocheckboxchangeobserver
|
|
7
|
-
*/
|
|
8
|
-
import { DomEventObserver } from 'ckeditor5/src/engine.js';
|
|
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~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export class TodoCheckboxChangeObserver extends DomEventObserver {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
domEventType = ['change'];
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
onDomEvent(domEvent) {
|
|
26
|
-
if (domEvent.target) {
|
|
27
|
-
const viewTarget = this.view.domConverter.mapDomToView(domEvent.target);
|
|
28
|
-
if (viewTarget &&
|
|
29
|
-
viewTarget.is('element', 'input') &&
|
|
30
|
-
viewTarget.getAttribute('type') == 'checkbox' &&
|
|
31
|
-
viewTarget.findAncestor({ classes: 'todo-list__label' })) {
|
|
32
|
-
this.fire('todoCheckboxChange', domEvent);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|