@ckeditor/ckeditor5-html-support 38.1.0 → 38.1.1

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.
Files changed (49) hide show
  1. package/build/html-support.js +1 -1
  2. package/build/html-support.js.map +1 -0
  3. package/package.json +2 -2
  4. package/src/augmentation.d.ts +33 -33
  5. package/src/augmentation.js +5 -5
  6. package/src/converters.d.ts +56 -56
  7. package/src/converters.js +149 -149
  8. package/src/datafilter.d.ts +285 -285
  9. package/src/datafilter.js +661 -661
  10. package/src/dataschema.d.ts +179 -179
  11. package/src/dataschema.js +196 -196
  12. package/src/fullpage.d.ts +21 -21
  13. package/src/fullpage.js +80 -80
  14. package/src/generalhtmlsupport.d.ts +98 -98
  15. package/src/generalhtmlsupport.js +237 -237
  16. package/src/generalhtmlsupportconfig.d.ts +67 -67
  17. package/src/generalhtmlsupportconfig.js +5 -5
  18. package/src/htmlcomment.d.ts +72 -72
  19. package/src/htmlcomment.js +220 -220
  20. package/src/htmlpagedataprocessor.d.ts +22 -22
  21. package/src/htmlpagedataprocessor.js +67 -67
  22. package/src/index.d.ts +25 -25
  23. package/src/index.js +14 -14
  24. package/src/integrations/codeblock.d.ts +23 -23
  25. package/src/integrations/codeblock.js +101 -101
  26. package/src/integrations/customelement.d.ts +27 -27
  27. package/src/integrations/customelement.js +146 -146
  28. package/src/integrations/documentlist.d.ts +27 -27
  29. package/src/integrations/documentlist.js +203 -203
  30. package/src/integrations/dualcontent.d.ts +45 -45
  31. package/src/integrations/dualcontent.js +119 -119
  32. package/src/integrations/heading.d.ts +31 -31
  33. package/src/integrations/heading.js +60 -60
  34. package/src/integrations/image.d.ts +26 -26
  35. package/src/integrations/image.js +172 -172
  36. package/src/integrations/integrationutils.d.ts +15 -15
  37. package/src/integrations/integrationutils.js +21 -21
  38. package/src/integrations/mediaembed.d.ts +26 -26
  39. package/src/integrations/mediaembed.js +119 -119
  40. package/src/integrations/script.d.ts +26 -26
  41. package/src/integrations/script.js +59 -59
  42. package/src/integrations/style.d.ts +26 -26
  43. package/src/integrations/style.js +59 -59
  44. package/src/integrations/table.d.ts +23 -23
  45. package/src/integrations/table.js +163 -163
  46. package/src/schemadefinitions.d.ts +13 -13
  47. package/src/schemadefinitions.js +956 -956
  48. package/src/utils.d.ts +72 -72
  49. package/src/utils.js +139 -139
@@ -1,179 +1,179 @@
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 html-support/dataschema
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import type { AttributeProperties, SchemaItemDefinition } from 'ckeditor5/src/engine';
10
- /**
11
- * Holds representation of the extended HTML document type definitions to be used by the
12
- * editor in HTML support.
13
- *
14
- * Data schema is represented by data schema definitions.
15
- *
16
- * To add new definition for block element,
17
- * use {@link module:html-support/dataschema~DataSchema#registerBlockElement} method:
18
- *
19
- * ```ts
20
- * dataSchema.registerBlockElement( {
21
- * view: 'section',
22
- * model: 'my-section',
23
- * modelSchema: {
24
- * inheritAllFrom: '$block'
25
- * }
26
- * } );
27
- * ```
28
- *
29
- * To add new definition for inline element,
30
- * use {@link module:html-support/dataschema~DataSchema#registerInlineElement} method:
31
- *
32
- * ```
33
- * dataSchema.registerInlineElement( {
34
- * view: 'span',
35
- * model: 'my-span',
36
- * attributeProperties: {
37
- * copyOnEnter: true
38
- * }
39
- * } );
40
- * ```
41
- */
42
- export default class DataSchema extends Plugin {
43
- /**
44
- * A map of registered data schema definitions.
45
- */
46
- private readonly _definitions;
47
- /**
48
- * @inheritDoc
49
- */
50
- static get pluginName(): "DataSchema";
51
- /**
52
- * @inheritDoc
53
- */
54
- init(): void;
55
- /**
56
- * Add new data schema definition describing block element.
57
- */
58
- registerBlockElement(definition: DataSchemaBlockElementDefinition): void;
59
- /**
60
- * Add new data schema definition describing inline element.
61
- */
62
- registerInlineElement(definition: DataSchemaInlineElementDefinition): void;
63
- /**
64
- * Updates schema definition describing block element with new properties.
65
- *
66
- * Creates new scheme if it doesn't exist.
67
- * Array properties are concatenated with original values.
68
- *
69
- * @param definition Definition update.
70
- */
71
- extendBlockElement(definition: DataSchemaBlockElementDefinition): void;
72
- /**
73
- * Updates schema definition describing inline element with new properties.
74
- *
75
- * Creates new scheme if it doesn't exist.
76
- * Array properties are concatenated with original values.
77
- *
78
- * @param definition Definition update.
79
- */
80
- extendInlineElement(definition: DataSchemaInlineElementDefinition): void;
81
- /**
82
- * Returns all definitions matching the given view name.
83
- *
84
- * @param includeReferences Indicates if this method should also include definitions of referenced models.
85
- */
86
- getDefinitionsForView(viewName: string | RegExp, includeReferences?: boolean): Set<DataSchemaDefinition>;
87
- /**
88
- * Returns definitions matching the given model name.
89
- */
90
- getDefinitionsForModel(modelName: string): Array<DataSchemaDefinition>;
91
- /**
92
- * Returns definitions matching the given view name.
93
- */
94
- private _getMatchingViewDefinitions;
95
- /**
96
- * Resolves all definition references registered for the given data schema definition.
97
- *
98
- * @param modelName Data schema model name.
99
- */
100
- private _getReferences;
101
- /**
102
- * Updates schema definition with new properties.
103
- *
104
- * Creates new scheme if it doesn't exist.
105
- * Array properties are concatenated with original values.
106
- *
107
- * @param definition Definition update.
108
- */
109
- private _extendDefinition;
110
- }
111
- /**
112
- * A base definition of {@link module:html-support/dataschema~DataSchema data schema}.
113
- */
114
- export interface DataSchemaDefinition {
115
- /**
116
- * Name of the model.
117
- */
118
- model: string;
119
- /**
120
- * Name of the view element.
121
- */
122
- view?: string;
123
- /**
124
- * Indicates that the definition describes object element.
125
- */
126
- isObject?: boolean;
127
- /**
128
- * The model schema item definition describing registered model.
129
- */
130
- modelSchema?: SchemaItemDefinition;
131
- /**
132
- * Indicates that the definition describes block element.
133
- * Set by {@link module:html-support/dataschema~DataSchema#registerBlockElement} method.
134
- */
135
- isBlock?: boolean;
136
- /**
137
- * Indicates that the definition describes inline element.
138
- */
139
- isInline?: boolean;
140
- }
141
- /**
142
- * A definition of {@link module:html-support/dataschema~DataSchema data schema} for block elements.
143
- */
144
- export interface DataSchemaBlockElementDefinition extends DataSchemaDefinition {
145
- /**
146
- * Should be used when an element can behave both as a sectioning element (e.g. article) and
147
- * element accepting only inline content (e.g. paragraph).
148
- * If an element contains only inline content, this option will be used as a model name.
149
- */
150
- paragraphLikeModel?: string;
151
- }
152
- /**
153
- * A definition of {@link module:html-support/dataschema~DataSchema data schema} for inline elements.
154
- */
155
- export interface DataSchemaInlineElementDefinition extends DataSchemaDefinition {
156
- /**
157
- * Additional metadata describing the model attribute.
158
- */
159
- attributeProperties?: AttributeProperties;
160
- /**
161
- * Element priority. Decides in what order elements are wrapped by
162
- * {@link module:engine/view/downcastwriter~DowncastWriter}.
163
- * Set by {@link module:html-support/dataschema~DataSchema#registerInlineElement} method.
164
- */
165
- priority?: number;
166
- /**
167
- * The name of the model attribute that generates the same view element. GHS inline attribute
168
- * will be removed from the model tree as soon as the coupled attribute is removed. See
169
- * {@link module:html-support/datafilter~DataFilter#_registerCoupledAttributesPostFixer GHS post-fixer} for more details.
170
- */
171
- coupledAttribute?: string;
172
- /**
173
- * Indicates that element should not be converted as a model text attribute.
174
- * It is used to map view elements that do not have a separate model element but their data is stored in a model attribute.
175
- * For example `<tbody>` element does not have a dedicated model element and GHS stores attributes of `<tbody>`
176
- * in the `htmlTbodyAttributes` model attribute of the `table` model element.
177
- */
178
- appliesToBlock?: boolean | string;
179
- }
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 html-support/dataschema
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import type { AttributeProperties, SchemaItemDefinition } from 'ckeditor5/src/engine';
10
+ /**
11
+ * Holds representation of the extended HTML document type definitions to be used by the
12
+ * editor in HTML support.
13
+ *
14
+ * Data schema is represented by data schema definitions.
15
+ *
16
+ * To add new definition for block element,
17
+ * use {@link module:html-support/dataschema~DataSchema#registerBlockElement} method:
18
+ *
19
+ * ```ts
20
+ * dataSchema.registerBlockElement( {
21
+ * view: 'section',
22
+ * model: 'my-section',
23
+ * modelSchema: {
24
+ * inheritAllFrom: '$block'
25
+ * }
26
+ * } );
27
+ * ```
28
+ *
29
+ * To add new definition for inline element,
30
+ * use {@link module:html-support/dataschema~DataSchema#registerInlineElement} method:
31
+ *
32
+ * ```
33
+ * dataSchema.registerInlineElement( {
34
+ * view: 'span',
35
+ * model: 'my-span',
36
+ * attributeProperties: {
37
+ * copyOnEnter: true
38
+ * }
39
+ * } );
40
+ * ```
41
+ */
42
+ export default class DataSchema extends Plugin {
43
+ /**
44
+ * A map of registered data schema definitions.
45
+ */
46
+ private readonly _definitions;
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ static get pluginName(): "DataSchema";
51
+ /**
52
+ * @inheritDoc
53
+ */
54
+ init(): void;
55
+ /**
56
+ * Add new data schema definition describing block element.
57
+ */
58
+ registerBlockElement(definition: DataSchemaBlockElementDefinition): void;
59
+ /**
60
+ * Add new data schema definition describing inline element.
61
+ */
62
+ registerInlineElement(definition: DataSchemaInlineElementDefinition): void;
63
+ /**
64
+ * Updates schema definition describing block element with new properties.
65
+ *
66
+ * Creates new scheme if it doesn't exist.
67
+ * Array properties are concatenated with original values.
68
+ *
69
+ * @param definition Definition update.
70
+ */
71
+ extendBlockElement(definition: DataSchemaBlockElementDefinition): void;
72
+ /**
73
+ * Updates schema definition describing inline element with new properties.
74
+ *
75
+ * Creates new scheme if it doesn't exist.
76
+ * Array properties are concatenated with original values.
77
+ *
78
+ * @param definition Definition update.
79
+ */
80
+ extendInlineElement(definition: DataSchemaInlineElementDefinition): void;
81
+ /**
82
+ * Returns all definitions matching the given view name.
83
+ *
84
+ * @param includeReferences Indicates if this method should also include definitions of referenced models.
85
+ */
86
+ getDefinitionsForView(viewName: string | RegExp, includeReferences?: boolean): Set<DataSchemaDefinition>;
87
+ /**
88
+ * Returns definitions matching the given model name.
89
+ */
90
+ getDefinitionsForModel(modelName: string): Array<DataSchemaDefinition>;
91
+ /**
92
+ * Returns definitions matching the given view name.
93
+ */
94
+ private _getMatchingViewDefinitions;
95
+ /**
96
+ * Resolves all definition references registered for the given data schema definition.
97
+ *
98
+ * @param modelName Data schema model name.
99
+ */
100
+ private _getReferences;
101
+ /**
102
+ * Updates schema definition with new properties.
103
+ *
104
+ * Creates new scheme if it doesn't exist.
105
+ * Array properties are concatenated with original values.
106
+ *
107
+ * @param definition Definition update.
108
+ */
109
+ private _extendDefinition;
110
+ }
111
+ /**
112
+ * A base definition of {@link module:html-support/dataschema~DataSchema data schema}.
113
+ */
114
+ export interface DataSchemaDefinition {
115
+ /**
116
+ * Name of the model.
117
+ */
118
+ model: string;
119
+ /**
120
+ * Name of the view element.
121
+ */
122
+ view?: string;
123
+ /**
124
+ * Indicates that the definition describes object element.
125
+ */
126
+ isObject?: boolean;
127
+ /**
128
+ * The model schema item definition describing registered model.
129
+ */
130
+ modelSchema?: SchemaItemDefinition;
131
+ /**
132
+ * Indicates that the definition describes block element.
133
+ * Set by {@link module:html-support/dataschema~DataSchema#registerBlockElement} method.
134
+ */
135
+ isBlock?: boolean;
136
+ /**
137
+ * Indicates that the definition describes inline element.
138
+ */
139
+ isInline?: boolean;
140
+ }
141
+ /**
142
+ * A definition of {@link module:html-support/dataschema~DataSchema data schema} for block elements.
143
+ */
144
+ export interface DataSchemaBlockElementDefinition extends DataSchemaDefinition {
145
+ /**
146
+ * Should be used when an element can behave both as a sectioning element (e.g. article) and
147
+ * element accepting only inline content (e.g. paragraph).
148
+ * If an element contains only inline content, this option will be used as a model name.
149
+ */
150
+ paragraphLikeModel?: string;
151
+ }
152
+ /**
153
+ * A definition of {@link module:html-support/dataschema~DataSchema data schema} for inline elements.
154
+ */
155
+ export interface DataSchemaInlineElementDefinition extends DataSchemaDefinition {
156
+ /**
157
+ * Additional metadata describing the model attribute.
158
+ */
159
+ attributeProperties?: AttributeProperties;
160
+ /**
161
+ * Element priority. Decides in what order elements are wrapped by
162
+ * {@link module:engine/view/downcastwriter~DowncastWriter}.
163
+ * Set by {@link module:html-support/dataschema~DataSchema#registerInlineElement} method.
164
+ */
165
+ priority?: number;
166
+ /**
167
+ * The name of the model attribute that generates the same view element. GHS inline attribute
168
+ * will be removed from the model tree as soon as the coupled attribute is removed. See
169
+ * {@link module:html-support/datafilter~DataFilter#_registerCoupledAttributesPostFixer GHS post-fixer} for more details.
170
+ */
171
+ coupledAttribute?: string;
172
+ /**
173
+ * Indicates that element should not be converted as a model text attribute.
174
+ * It is used to map view elements that do not have a separate model element but their data is stored in a model attribute.
175
+ * For example `<tbody>` element does not have a dedicated model element and GHS stores attributes of `<tbody>`
176
+ * in the `htmlTbodyAttributes` model attribute of the `table` model element.
177
+ */
178
+ appliesToBlock?: boolean | string;
179
+ }