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