UNPKG

4.7 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2024, 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/legacylist~LegacyList legacy 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/legacylistproperties~LegacyListProperties legacy list properties} feature.
29 *
30 * Read more in {@link module:list/listconfig~ListPropertiesConfig}.
31 */
32 properties?: ListPropertiesConfig;
33 /**
34 * Allows multiple blocks in single list item.
35 *
36 * With this option enabled you can have block widgets, for example images or even tables, within a list item.
37 *
38 * **Note:** This is enabled by default.
39 *
40 * @default true
41 */
42 multiBlock?: boolean;
43}
44/**
45 * The configuration of the {@link module:list/listproperties~ListProperties list properties} feature and the
46 * {@link module:list/legacylistproperties~LegacyListProperties legacy list properties} feature.
47 *
48 * This configuration controls the individual list properties. For instance, it enables or disables specific editor commands
49 * operating on lists ({@link module:list/listproperties/liststylecommand~ListStyleCommand `'listStyle'`},
50 * {@link module:list/listproperties/liststartcommand~ListStartCommand `'listStart'`},
51 * {@link module:list/listproperties/listreversedcommand~ListReversedCommand `'listReversed'`}, or on the legacy lists
52 * {@link module:list/legacylistproperties/legacyliststylecommand~LegacyListStyleCommand `'listStyle'`},
53 * {@link module:list/legacylistproperties/legacyliststartcommand~LegacyListStartCommand `'listStart'`},
54 * {@link module:list/legacylistproperties/legacylistreversedcommand~LegacyListReversedCommand `'listReversed'`}), the look of the UI
55 * (`'numberedList'` and `'bulletedList'` dropdowns), and the editor data pipeline (allowed HTML attributes).
56 *
57 * ```ts
58 * ClassicEditor
59 * .create( editorElement, {
60 * list: {
61 * properties: {
62 * styles: true,
63 * startIndex: true,
64 * reversed: true
65 * }
66 * }
67 * } )
68 * .then( ... )
69 * .catch( ... );
70 * ```
71 */
72export interface ListPropertiesConfig {
73 /**
74 * When set, the list style feature will be enabled.
75 * It allows changing the `list-style-type` style or the `type` HTML attribute of a list.
76 *
77 * **Note**: Styling using the `type` HTML attribute is only available in
78 * {@link module:list/listproperties~ListProperties list properties}
79 * ({@link module:list/listconfig~ListPropertiesStyleConfig learn more}).
80 *
81 * @default true
82 */
83 styles?: boolean | ListPropertiesStyleConfig;
84 /**
85 * When set, the list start index feature will be enabled. It allows changing the `start` HTML attribute of the numbered lists. As a
86 * result, it will be possible to specify the start value of the first item in an ordered list.
87 *
88 * **Note**: This configuration does not affect bulleted and to-do lists.
89 *
90 * @default false
91 */
92 startIndex?: boolean;
93 /**
94 * When set, the reversed list feature will be enabled. It allows changing the `reversed` HTML attribute of the numbered lists. As a
95 * result, it will be possible to make the list order descending instead of ascending.
96 *
97 * **Note**: This configuration does not affect bulleted and to-do lists.
98 *
99 * @default false
100 */
101 reversed?: boolean;
102}
103export interface ListPropertiesStyleConfig {
104 /**
105 * When set `true`, the list style feature will use the `type` attribute of `<ul>` and `<ol>` elements instead of the `list-style-type`
106 * style.
107 *
108 * ```ts
109 * {
110 * list: {
111 * properties: {
112 * styles: {
113 * useAttribute: true
114 * },
115 *
116 * // ...
117 * }
118 * },
119 *
120 * // ...
121 * }
122 * ```
123 *
124 * **Note**: Due to limitations of HTML, the "Decimal with leading zero" style is impossible to set using the `type` attribute.
125 *
126 * **Note**: This configuration works only with
127 * {@link module:list/listproperties~ListProperties list properties}.
128 *
129 * @default false
130 */
131 useAttribute?: boolean;
132}