UNPKG

4.49 kBTypeScriptView Raw
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/listconfig
7 */
8/**
9 * The configuration of the {@link module:list/list~List list} feature
10 * and the {@link module:list/documentlist~DocumentList document list} feature.
11 *
12 * ```ts
13 * ClassicEditor
14 * .create( editorElement, {
15 * list: ... // The list feature configuration.
16 * } )
17 * .then( ... )
18 * .catch( ... );
19 * ```
20 *
21 * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
22 *
23 * @interface ListConfig
24 */
25export interface ListConfig {
26 /**
27 * The configuration of the {@link module:list/listproperties~ListProperties} feature and the
28 * {@link module:list/documentlistproperties~DocumentListProperties document list properties} feature.
29 *
30 * Read more in {@link module:list/listconfig~ListPropertiesConfig}.
31 */
32 properties?: ListPropertiesConfig;
33}
34/**
35 * The configuration of the {@link module:list/listproperties~ListProperties list properties} feature and the
36 * {@link module:list/documentlistproperties~DocumentListProperties document list properties} feature.
37 *
38 * This configuration controls the individual list properties. For instance, it enables or disables specific editor commands
39 * operating on lists ({@link module:list/listproperties/liststylecommand~ListStyleCommand `'listStyle'`},
40 * {@link module:list/listproperties/liststartcommand~ListStartCommand `'listStart'`},
41 * {@link module:list/listproperties/listreversedcommand~ListReversedCommand `'listReversed'`}, or on the document lists
42 * {@link module:list/documentlistproperties/documentliststylecommand~DocumentListStyleCommand `'listStyle'`},
43 * {@link module:list/documentlistproperties/documentliststartcommand~DocumentListStartCommand `'listStart'`},
44 * {@link module:list/documentlistproperties/documentlistreversedcommand~DocumentListReversedCommand `'listReversed'`}), the look of the UI
45 * (`'numberedList'` and `'bulletedList'` dropdowns), and the editor data pipeline (allowed HTML attributes).
46 *
47 * ```ts
48 * ClassicEditor
49 * .create( editorElement, {
50 * list: {
51 * properties: {
52 * styles: true,
53 * startIndex: true,
54 * reversed: true
55 * }
56 * }
57 * } )
58 * .then( ... )
59 * .catch( ... );
60 * ```
61 */
62export interface ListPropertiesConfig {
63 /**
64 * When set, the list style feature will be enabled.
65 * It allows changing the `list-style-type` style or the `type` HTML attribute of a list.
66 *
67 * **Note**: Styling using the `type` HTML attribute is only available in
68 * {@link module:list/documentlistproperties~DocumentListProperties document list properties}
69 * ({@link module:list/listconfig~ListPropertiesStyleConfig learn more}).
70 *
71 * @default true
72 */
73 styles?: boolean | ListPropertiesStyleConfig;
74 /**
75 * When set, the list start index feature will be enabled. It allows changing the `start` HTML attribute of the numbered lists. As a
76 * result, it will be possible to specify the start value of the first item in an ordered list.
77 *
78 * **Note**: This configuration does not affect bulleted and to-do lists.
79 *
80 * @default false
81 */
82 startIndex?: boolean;
83 /**
84 * When set, the reversed list feature will be enabled. It allows changing the `reversed` HTML attribute of the numbered lists. As a
85 * result, it will be possible to make the list order descending instead of ascending.
86 *
87 * **Note**: This configuration does not affect bulleted and to-do lists.
88 *
89 * @default false
90 */
91 reversed?: boolean;
92}
93export interface ListPropertiesStyleConfig {
94 /**
95 * When set `true`, the list style feature will use the `type` attribute of `<ul>` and `<ol>` elements instead of the `list-style-type`
96 * style.
97 *
98 * ```ts
99 * {
100 * list: {
101 * properties: {
102 * styles: {
103 * useAttribute: true
104 * },
105 *
106 * // ...
107 * }
108 * },
109 *
110 * // ...
111 * }
112 * ```
113 *
114 * **Note**: Due to limitations of HTML, the "Decimal with leading zero" style is impossible to set using the `type` attribute.
115 *
116 * **Note**: This configuration works only with
117 * {@link module:list/documentlistproperties~DocumentListProperties document list properties}.
118 *
119 * @default false
120 */
121 useAttribute?: boolean;
122}