-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
listconfig.ts
142 lines (132 loc) · 4.38 KB
/
listconfig.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @module list/listconfig
*/
/**
* The configuration of the {@link module:list/list~List list} feature
* and the {@link module:list/legacylist~LegacyList legacy list} feature.
*
* ```ts
* ClassicEditor
* .create( editorElement, {
* list: ... // The list feature configuration.
* } )
* .then( ... )
* .catch( ... );
* ```
*
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
*
* @interface ListConfig
*/
export interface ListConfig {
/**
* The configuration of the {@link module:list/listproperties~ListProperties} feature and the
* {@link module:list/legacylistproperties~LegacyListProperties legacy list properties} feature.
*
* Read more in {@link module:list/listconfig~ListPropertiesConfig}.
*/
properties?: ListPropertiesConfig;
/**
* Allows multiple blocks in single list item.
*
* With this option enabled you can have block widgets, for example images or even tables, within a list item.
*
* **Note:** This is enabled by default.
*
* @default true
*/
multiBlock?: boolean;
}
/**
* The configuration of the {@link module:list/listproperties~ListProperties list properties} feature and the
* {@link module:list/legacylistproperties~LegacyListProperties legacy list properties} feature.
*
* This configuration controls the individual list properties. For instance, it enables or disables specific editor commands
* operating on lists ({@link module:list/listproperties/liststylecommand~ListStyleCommand `'listStyle'`},
* {@link module:list/listproperties/liststartcommand~ListStartCommand `'listStart'`},
* {@link module:list/listproperties/listreversedcommand~ListReversedCommand `'listReversed'`}, or on the legacy lists
* {@link module:list/legacylistproperties/legacyliststylecommand~LegacyListStyleCommand `'listStyle'`},
* {@link module:list/legacylistproperties/legacyliststartcommand~LegacyListStartCommand `'listStart'`},
* {@link module:list/legacylistproperties/legacylistreversedcommand~LegacyListReversedCommand `'listReversed'`}), the look of the UI
* (`'numberedList'` and `'bulletedList'` dropdowns), and the editor data pipeline (allowed HTML attributes).
*
* ```ts
* ClassicEditor
* .create( editorElement, {
* list: {
* properties: {
* styles: true,
* startIndex: true,
* reversed: true
* }
* }
* } )
* .then( ... )
* .catch( ... );
* ```
*/
export interface ListPropertiesConfig {
/**
* When set, the list style feature will be enabled.
* It allows changing the `list-style-type` style or the `type` HTML attribute of a list.
*
* **Note**: Styling using the `type` HTML attribute is only available in
* {@link module:list/listproperties~ListProperties list properties}
* ({@link module:list/listconfig~ListPropertiesStyleConfig learn more}).
*
* @default true
*/
styles?: boolean | ListPropertiesStyleConfig;
/**
* When set, the list start index feature will be enabled. It allows changing the `start` HTML attribute of the numbered lists. As a
* result, it will be possible to specify the start value of the first item in an ordered list.
*
* **Note**: This configuration does not affect bulleted and to-do lists.
*
* @default false
*/
startIndex?: boolean;
/**
* When set, the reversed list feature will be enabled. It allows changing the `reversed` HTML attribute of the numbered lists. As a
* result, it will be possible to make the list order descending instead of ascending.
*
* **Note**: This configuration does not affect bulleted and to-do lists.
*
* @default false
*/
reversed?: boolean;
}
export interface ListPropertiesStyleConfig {
/**
* When set `true`, the list style feature will use the `type` attribute of `<ul>` and `<ol>` elements instead of the `list-style-type`
* style.
*
* ```ts
* {
* list: {
* properties: {
* styles: {
* useAttribute: true
* },
*
* // ...
* }
* },
*
* // ...
* }
* ```
*
* **Note**: Due to limitations of HTML, the "Decimal with leading zero" style is impossible to set using the `type` attribute.
*
* **Note**: This configuration works only with
* {@link module:list/listproperties~ListProperties list properties}.
*
* @default false
*/
useAttribute?: boolean;
}