@ckeditor/ckeditor5-html-support 40.0.0 → 40.1.0

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 (50) hide show
  1. package/LICENSE.md +4 -4
  2. package/build/html-support.js +1 -1
  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 +60 -60
  7. package/src/converters.js +180 -180
  8. package/src/datafilter.d.ts +304 -304
  9. package/src/datafilter.js +720 -720
  10. package/src/dataschema.d.ts +183 -183
  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 +240 -240
  16. package/src/generalhtmlsupportconfig.d.ts +77 -77
  17. package/src/generalhtmlsupportconfig.js +5 -5
  18. package/src/htmlcomment.d.ts +71 -71
  19. package/src/htmlcomment.js +218 -218
  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 +178 -178
  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 +189 -189
  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 +953 -956
  48. package/src/utils.d.ts +72 -72
  49. package/src/utils.js +139 -139
  50. package/build/html-support.js.map +0 -1
@@ -1,304 +1,304 @@
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/datafilter
7
- */
8
- import { Plugin, type Editor } from 'ckeditor5/src/core';
9
- import { type MatcherPattern, type UpcastConversionApi, type ViewElement, type MatcherObjectPattern } from 'ckeditor5/src/engine';
10
- import { Widget } from 'ckeditor5/src/widget';
11
- import { default as DataSchema, type DataSchemaDefinition } from './dataschema';
12
- import { type GHSViewAttributes } from './utils';
13
- import '../theme/datafilter.css';
14
- /**
15
- * Allows to validate elements and element attributes registered by {@link module:html-support/dataschema~DataSchema}.
16
- *
17
- * To enable registered element in the editor, use {@link module:html-support/datafilter~DataFilter#allowElement} method:
18
- *
19
- * ```ts
20
- * dataFilter.allowElement( 'section' );
21
- * ```
22
- *
23
- * You can also allow or disallow specific element attributes:
24
- *
25
- * ```ts
26
- * // Allow `data-foo` attribute on `section` element.
27
- * dataFilter.allowAttributes( {
28
- * name: 'section',
29
- * attributes: {
30
- * 'data-foo': true
31
- * }
32
- * } );
33
- *
34
- * // Disallow `color` style attribute on 'section' element.
35
- * dataFilter.disallowAttributes( {
36
- * name: 'section',
37
- * styles: {
38
- * color: /[\s\S]+/
39
- * }
40
- * } );
41
- * ```
42
- *
43
- * To apply the information about allowed and disallowed attributes in custom integration plugin,
44
- * use the {@link module:html-support/datafilter~DataFilter#processViewAttributes `processViewAttributes()`} method.
45
- */
46
- export default class DataFilter extends Plugin {
47
- /**
48
- * An instance of the {@link module:html-support/dataschema~DataSchema}.
49
- */
50
- private readonly _dataSchema;
51
- /**
52
- * {@link module:engine/view/matcher~Matcher Matcher} instance describing rules upon which
53
- * content attributes should be allowed.
54
- */
55
- private readonly _allowedAttributes;
56
- /**
57
- * {@link module:engine/view/matcher~Matcher Matcher} instance describing rules upon which
58
- * content attributes should be disallowed.
59
- */
60
- private readonly _disallowedAttributes;
61
- /**
62
- * Allowed element definitions by {@link module:html-support/datafilter~DataFilter#allowElement} method.
63
- */
64
- private readonly _allowedElements;
65
- /**
66
- * Disallowed element names by {@link module:html-support/datafilter~DataFilter#disallowElement} method.
67
- */
68
- private readonly _disallowedElements;
69
- /**
70
- * Indicates if {@link module:engine/controller/datacontroller~DataController editor's data controller}
71
- * data has been already initialized.
72
- */
73
- private _dataInitialized;
74
- /**
75
- * Cached map of coupled attributes. Keys are the feature attributes names
76
- * and values are arrays with coupled GHS attributes names.
77
- */
78
- private _coupledAttributes;
79
- constructor(editor: Editor);
80
- /**
81
- * @inheritDoc
82
- */
83
- static get pluginName(): "DataFilter";
84
- /**
85
- * @inheritDoc
86
- */
87
- static get requires(): readonly [typeof DataSchema, typeof Widget];
88
- /**
89
- * Load a configuration of one or many elements, where their attributes should be allowed.
90
- *
91
- * **Note**: Rules will be applied just before next data pipeline data init or set.
92
- *
93
- * @param config Configuration of elements that should have their attributes accepted in the editor.
94
- */
95
- loadAllowedConfig(config: Array<MatcherObjectPattern>): void;
96
- /**
97
- * Load a configuration of one or many elements, where their attributes should be disallowed.
98
- *
99
- * **Note**: Rules will be applied just before next data pipeline data init or set.
100
- *
101
- * @param config Configuration of elements that should have their attributes rejected from the editor.
102
- */
103
- loadDisallowedConfig(config: Array<MatcherObjectPattern>): void;
104
- /**
105
- * Load a configuration of one or many elements, where when empty should be allowed.
106
- *
107
- * **Note**: It modifies DataSchema so must be loaded before registering filtering rules.
108
- *
109
- * @param config Configuration of elements that should be preserved even if empty.
110
- */
111
- loadAllowedEmptyElementsConfig(config: Array<string>): void;
112
- /**
113
- * Allow the given element in the editor context.
114
- *
115
- * This method will only allow elements described by the {@link module:html-support/dataschema~DataSchema} used
116
- * to create data filter.
117
- *
118
- * **Note**: Rules will be applied just before next data pipeline data init or set.
119
- *
120
- * @param viewName String or regular expression matching view name.
121
- */
122
- allowElement(viewName: string | RegExp): void;
123
- /**
124
- * Disallow the given element in the editor context.
125
- *
126
- * This method will only disallow elements described by the {@link module:html-support/dataschema~DataSchema} used
127
- * to create data filter.
128
- *
129
- * @param viewName String or regular expression matching view name.
130
- */
131
- disallowElement(viewName: string | RegExp): void;
132
- /**
133
- * Allow the given empty element in the editor context.
134
- *
135
- * This method will only allow elements described by the {@link module:html-support/dataschema~DataSchema} used
136
- * to create data filter.
137
- *
138
- * **Note**: It modifies DataSchema so must be called before registering filtering rules.
139
- *
140
- * @param viewName String or regular expression matching view name.
141
- */
142
- allowEmptyElement(viewName: string): void;
143
- /**
144
- * Allow the given attributes for view element allowed by {@link #allowElement} method.
145
- *
146
- * @param config Pattern matching all attributes which should be allowed.
147
- */
148
- allowAttributes(config: MatcherPattern): void;
149
- /**
150
- * Disallow the given attributes for view element allowed by {@link #allowElement} method.
151
- *
152
- * @param config Pattern matching all attributes which should be disallowed.
153
- */
154
- disallowAttributes(config: MatcherPattern): void;
155
- /**
156
- * Processes all allowed and disallowed attributes on the view element by consuming them and returning the allowed ones.
157
- *
158
- * This method applies the configuration set up by {@link #allowAttributes `allowAttributes()`}
159
- * and {@link #disallowAttributes `disallowAttributes()`} over the given view element by consuming relevant attributes.
160
- * It returns the allowed attributes that were found on the given view element for further processing by integration code.
161
- *
162
- * ```ts
163
- * dispatcher.on( 'element:myElement', ( evt, data, conversionApi ) => {
164
- * // Get rid of disallowed and extract all allowed attributes from a viewElement.
165
- * const viewAttributes = dataFilter.processViewAttributes( data.viewItem, conversionApi );
166
- * // Do something with them, i.e. store inside a model as a dictionary.
167
- * if ( viewAttributes ) {
168
- * conversionApi.writer.setAttribute( 'htmlAttributesOfMyElement', viewAttributes, data.modelRange );
169
- * }
170
- * } );
171
- * ```
172
- *
173
- * @see module:engine/conversion/viewconsumable~ViewConsumable#consume
174
- *
175
- * @returns Object with following properties:
176
- * - attributes Set with matched attribute names.
177
- * - styles Set with matched style names.
178
- * - classes Set with matched class names.
179
- */
180
- processViewAttributes(viewElement: ViewElement, conversionApi: UpcastConversionApi): GHSViewAttributes | null;
181
- /**
182
- * Adds allowed element definition and fires registration event.
183
- */
184
- private _addAllowedElement;
185
- /**
186
- * Registers elements allowed by {@link module:html-support/datafilter~DataFilter#allowElement} method
187
- * once {@link module:engine/controller/datacontroller~DataController editor's data controller} is initialized.
188
- */
189
- private _registerElementsAfterInit;
190
- /**
191
- * Registers default element handlers.
192
- */
193
- private _registerElementHandlers;
194
- /**
195
- * Registers a model post-fixer that is removing coupled GHS attributes of inline elements. Those attributes
196
- * are removed if a coupled feature attribute is removed.
197
- *
198
- * For example, consider following HTML:
199
- *
200
- * ```html
201
- * <a href="foo.html" id="myId">bar</a>
202
- * ```
203
- *
204
- * Which would be upcasted to following text node in the model:
205
- *
206
- * ```html
207
- * <$text linkHref="foo.html" htmlA="{ attributes: { id: 'myId' } }">bar</$text>
208
- * ```
209
- *
210
- * When the user removes the link from that text (using UI), only `linkHref` attribute would be removed:
211
- *
212
- * ```html
213
- * <$text htmlA="{ attributes: { id: 'myId' } }">bar</$text>
214
- * ```
215
- *
216
- * The `htmlA` attribute would stay in the model and would cause GHS to generate an `<a>` element.
217
- * This is incorrect from UX point of view, as the user wanted to remove the whole link (not only `href`).
218
- */
219
- private _registerCoupledAttributesPostFixer;
220
- /**
221
- * Removes `html*Attributes` attributes from incompatible elements.
222
- *
223
- * For example, consider the following HTML:
224
- *
225
- * ```html
226
- * <heading2 htmlH2Attributes="...">foobar[]</heading2>
227
- * ```
228
- *
229
- * Pressing `enter` creates a new `paragraph` element that inherits
230
- * the `htmlH2Attributes` attribute from `heading2`.
231
- *
232
- * ```html
233
- * <heading2 htmlH2Attributes="...">foobar</heading2>
234
- * <paragraph htmlH2Attributes="...">[]</paragraph>
235
- * ```
236
- *
237
- * This postfixer ensures that this doesn't happen, and that elements can
238
- * only have `html*Attributes` associated with them,
239
- * e.g.: `htmlPAttributes` for `<p>`, `htmlDivAttributes` for `<div>`, etc.
240
- *
241
- * With it enabled, pressing `enter` at the end of `<heading2>` will create
242
- * a new paragraph without the `htmlH2Attributes` attribute.
243
- *
244
- * ```html
245
- * <heading2 htmlH2Attributes="...">foobar</heading2>
246
- * <paragraph>[]</paragraph>
247
- * ```
248
- */
249
- private _registerAssociatedHtmlAttributesPostFixer;
250
- /**
251
- * Collects the map of coupled attributes. The returned map is keyed by the feature attribute name
252
- * and coupled GHS attribute names are stored in the value array.
253
- */
254
- private _getCoupledAttributesMap;
255
- /**
256
- * Fires `register` event for the given element definition.
257
- */
258
- private _fireRegisterEvent;
259
- /**
260
- * Registers object element and attribute converters for the given data schema definition.
261
- */
262
- private _registerObjectElement;
263
- /**
264
- * Registers block element and attribute converters for the given data schema definition.
265
- */
266
- private _registerBlockElement;
267
- /**
268
- * Registers inline element and attribute converters for the given data schema definition.
269
- *
270
- * Extends `$text` model schema to allow the given definition model attribute and its properties.
271
- */
272
- private _registerInlineElement;
273
- }
274
- /**
275
- * Fired when {@link module:html-support/datafilter~DataFilter} is registering element and attribute
276
- * converters for the {@link module:html-support/dataschema~DataSchemaDefinition element definition}.
277
- *
278
- * The event also accepts {@link module:html-support/dataschema~DataSchemaDefinition#view} value
279
- * as an event namespace, e.g. `register:span`.
280
- *
281
- * ```ts
282
- * dataFilter.on( 'register', ( evt, definition ) => {
283
- * editor.model.schema.register( definition.model, definition.modelSchema );
284
- * editor.conversion.elementToElement( { model: definition.model, view: definition.view } );
285
- *
286
- * evt.stop();
287
- * } );
288
- *
289
- * dataFilter.on( 'register:span', ( evt, definition ) => {
290
- * editor.model.schema.extend( '$text', { allowAttributes: 'htmlSpan' } );
291
- *
292
- * editor.conversion.for( 'upcast' ).elementToAttribute( { view: 'span', model: 'htmlSpan' } );
293
- * editor.conversion.for( 'downcast' ).attributeToElement( { view: 'span', model: 'htmlSpan' } );
294
- *
295
- * evt.stop();
296
- * }, { priority: 'high' } )
297
- * ```
298
- *
299
- * @eventName ~DataFilter#register
300
- */
301
- export interface DataFilterRegisterEvent {
302
- name: 'register' | `register:${string}`;
303
- args: [data: DataSchemaDefinition];
304
- }
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/datafilter
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core';
9
+ import { type MatcherPattern, type UpcastConversionApi, type ViewElement, type MatcherObjectPattern } from 'ckeditor5/src/engine';
10
+ import { Widget } from 'ckeditor5/src/widget';
11
+ import { default as DataSchema, type DataSchemaDefinition } from './dataschema';
12
+ import { type GHSViewAttributes } from './utils';
13
+ import '../theme/datafilter.css';
14
+ /**
15
+ * Allows to validate elements and element attributes registered by {@link module:html-support/dataschema~DataSchema}.
16
+ *
17
+ * To enable registered element in the editor, use {@link module:html-support/datafilter~DataFilter#allowElement} method:
18
+ *
19
+ * ```ts
20
+ * dataFilter.allowElement( 'section' );
21
+ * ```
22
+ *
23
+ * You can also allow or disallow specific element attributes:
24
+ *
25
+ * ```ts
26
+ * // Allow `data-foo` attribute on `section` element.
27
+ * dataFilter.allowAttributes( {
28
+ * name: 'section',
29
+ * attributes: {
30
+ * 'data-foo': true
31
+ * }
32
+ * } );
33
+ *
34
+ * // Disallow `color` style attribute on 'section' element.
35
+ * dataFilter.disallowAttributes( {
36
+ * name: 'section',
37
+ * styles: {
38
+ * color: /[\s\S]+/
39
+ * }
40
+ * } );
41
+ * ```
42
+ *
43
+ * To apply the information about allowed and disallowed attributes in custom integration plugin,
44
+ * use the {@link module:html-support/datafilter~DataFilter#processViewAttributes `processViewAttributes()`} method.
45
+ */
46
+ export default class DataFilter extends Plugin {
47
+ /**
48
+ * An instance of the {@link module:html-support/dataschema~DataSchema}.
49
+ */
50
+ private readonly _dataSchema;
51
+ /**
52
+ * {@link module:engine/view/matcher~Matcher Matcher} instance describing rules upon which
53
+ * content attributes should be allowed.
54
+ */
55
+ private readonly _allowedAttributes;
56
+ /**
57
+ * {@link module:engine/view/matcher~Matcher Matcher} instance describing rules upon which
58
+ * content attributes should be disallowed.
59
+ */
60
+ private readonly _disallowedAttributes;
61
+ /**
62
+ * Allowed element definitions by {@link module:html-support/datafilter~DataFilter#allowElement} method.
63
+ */
64
+ private readonly _allowedElements;
65
+ /**
66
+ * Disallowed element names by {@link module:html-support/datafilter~DataFilter#disallowElement} method.
67
+ */
68
+ private readonly _disallowedElements;
69
+ /**
70
+ * Indicates if {@link module:engine/controller/datacontroller~DataController editor's data controller}
71
+ * data has been already initialized.
72
+ */
73
+ private _dataInitialized;
74
+ /**
75
+ * Cached map of coupled attributes. Keys are the feature attributes names
76
+ * and values are arrays with coupled GHS attributes names.
77
+ */
78
+ private _coupledAttributes;
79
+ constructor(editor: Editor);
80
+ /**
81
+ * @inheritDoc
82
+ */
83
+ static get pluginName(): "DataFilter";
84
+ /**
85
+ * @inheritDoc
86
+ */
87
+ static get requires(): readonly [typeof DataSchema, typeof Widget];
88
+ /**
89
+ * Load a configuration of one or many elements, where their attributes should be allowed.
90
+ *
91
+ * **Note**: Rules will be applied just before next data pipeline data init or set.
92
+ *
93
+ * @param config Configuration of elements that should have their attributes accepted in the editor.
94
+ */
95
+ loadAllowedConfig(config: Array<MatcherObjectPattern>): void;
96
+ /**
97
+ * Load a configuration of one or many elements, where their attributes should be disallowed.
98
+ *
99
+ * **Note**: Rules will be applied just before next data pipeline data init or set.
100
+ *
101
+ * @param config Configuration of elements that should have their attributes rejected from the editor.
102
+ */
103
+ loadDisallowedConfig(config: Array<MatcherObjectPattern>): void;
104
+ /**
105
+ * Load a configuration of one or many elements, where when empty should be allowed.
106
+ *
107
+ * **Note**: It modifies DataSchema so must be loaded before registering filtering rules.
108
+ *
109
+ * @param config Configuration of elements that should be preserved even if empty.
110
+ */
111
+ loadAllowedEmptyElementsConfig(config: Array<string>): void;
112
+ /**
113
+ * Allow the given element in the editor context.
114
+ *
115
+ * This method will only allow elements described by the {@link module:html-support/dataschema~DataSchema} used
116
+ * to create data filter.
117
+ *
118
+ * **Note**: Rules will be applied just before next data pipeline data init or set.
119
+ *
120
+ * @param viewName String or regular expression matching view name.
121
+ */
122
+ allowElement(viewName: string | RegExp): void;
123
+ /**
124
+ * Disallow the given element in the editor context.
125
+ *
126
+ * This method will only disallow elements described by the {@link module:html-support/dataschema~DataSchema} used
127
+ * to create data filter.
128
+ *
129
+ * @param viewName String or regular expression matching view name.
130
+ */
131
+ disallowElement(viewName: string | RegExp): void;
132
+ /**
133
+ * Allow the given empty element in the editor context.
134
+ *
135
+ * This method will only allow elements described by the {@link module:html-support/dataschema~DataSchema} used
136
+ * to create data filter.
137
+ *
138
+ * **Note**: It modifies DataSchema so must be called before registering filtering rules.
139
+ *
140
+ * @param viewName String or regular expression matching view name.
141
+ */
142
+ allowEmptyElement(viewName: string): void;
143
+ /**
144
+ * Allow the given attributes for view element allowed by {@link #allowElement} method.
145
+ *
146
+ * @param config Pattern matching all attributes which should be allowed.
147
+ */
148
+ allowAttributes(config: MatcherPattern): void;
149
+ /**
150
+ * Disallow the given attributes for view element allowed by {@link #allowElement} method.
151
+ *
152
+ * @param config Pattern matching all attributes which should be disallowed.
153
+ */
154
+ disallowAttributes(config: MatcherPattern): void;
155
+ /**
156
+ * Processes all allowed and disallowed attributes on the view element by consuming them and returning the allowed ones.
157
+ *
158
+ * This method applies the configuration set up by {@link #allowAttributes `allowAttributes()`}
159
+ * and {@link #disallowAttributes `disallowAttributes()`} over the given view element by consuming relevant attributes.
160
+ * It returns the allowed attributes that were found on the given view element for further processing by integration code.
161
+ *
162
+ * ```ts
163
+ * dispatcher.on( 'element:myElement', ( evt, data, conversionApi ) => {
164
+ * // Get rid of disallowed and extract all allowed attributes from a viewElement.
165
+ * const viewAttributes = dataFilter.processViewAttributes( data.viewItem, conversionApi );
166
+ * // Do something with them, i.e. store inside a model as a dictionary.
167
+ * if ( viewAttributes ) {
168
+ * conversionApi.writer.setAttribute( 'htmlAttributesOfMyElement', viewAttributes, data.modelRange );
169
+ * }
170
+ * } );
171
+ * ```
172
+ *
173
+ * @see module:engine/conversion/viewconsumable~ViewConsumable#consume
174
+ *
175
+ * @returns Object with following properties:
176
+ * - attributes Set with matched attribute names.
177
+ * - styles Set with matched style names.
178
+ * - classes Set with matched class names.
179
+ */
180
+ processViewAttributes(viewElement: ViewElement, conversionApi: UpcastConversionApi): GHSViewAttributes | null;
181
+ /**
182
+ * Adds allowed element definition and fires registration event.
183
+ */
184
+ private _addAllowedElement;
185
+ /**
186
+ * Registers elements allowed by {@link module:html-support/datafilter~DataFilter#allowElement} method
187
+ * once {@link module:engine/controller/datacontroller~DataController editor's data controller} is initialized.
188
+ */
189
+ private _registerElementsAfterInit;
190
+ /**
191
+ * Registers default element handlers.
192
+ */
193
+ private _registerElementHandlers;
194
+ /**
195
+ * Registers a model post-fixer that is removing coupled GHS attributes of inline elements. Those attributes
196
+ * are removed if a coupled feature attribute is removed.
197
+ *
198
+ * For example, consider following HTML:
199
+ *
200
+ * ```html
201
+ * <a href="foo.html" id="myId">bar</a>
202
+ * ```
203
+ *
204
+ * Which would be upcasted to following text node in the model:
205
+ *
206
+ * ```html
207
+ * <$text linkHref="foo.html" htmlA="{ attributes: { id: 'myId' } }">bar</$text>
208
+ * ```
209
+ *
210
+ * When the user removes the link from that text (using UI), only `linkHref` attribute would be removed:
211
+ *
212
+ * ```html
213
+ * <$text htmlA="{ attributes: { id: 'myId' } }">bar</$text>
214
+ * ```
215
+ *
216
+ * The `htmlA` attribute would stay in the model and would cause GHS to generate an `<a>` element.
217
+ * This is incorrect from UX point of view, as the user wanted to remove the whole link (not only `href`).
218
+ */
219
+ private _registerCoupledAttributesPostFixer;
220
+ /**
221
+ * Removes `html*Attributes` attributes from incompatible elements.
222
+ *
223
+ * For example, consider the following HTML:
224
+ *
225
+ * ```html
226
+ * <heading2 htmlH2Attributes="...">foobar[]</heading2>
227
+ * ```
228
+ *
229
+ * Pressing `enter` creates a new `paragraph` element that inherits
230
+ * the `htmlH2Attributes` attribute from `heading2`.
231
+ *
232
+ * ```html
233
+ * <heading2 htmlH2Attributes="...">foobar</heading2>
234
+ * <paragraph htmlH2Attributes="...">[]</paragraph>
235
+ * ```
236
+ *
237
+ * This postfixer ensures that this doesn't happen, and that elements can
238
+ * only have `html*Attributes` associated with them,
239
+ * e.g.: `htmlPAttributes` for `<p>`, `htmlDivAttributes` for `<div>`, etc.
240
+ *
241
+ * With it enabled, pressing `enter` at the end of `<heading2>` will create
242
+ * a new paragraph without the `htmlH2Attributes` attribute.
243
+ *
244
+ * ```html
245
+ * <heading2 htmlH2Attributes="...">foobar</heading2>
246
+ * <paragraph>[]</paragraph>
247
+ * ```
248
+ */
249
+ private _registerAssociatedHtmlAttributesPostFixer;
250
+ /**
251
+ * Collects the map of coupled attributes. The returned map is keyed by the feature attribute name
252
+ * and coupled GHS attribute names are stored in the value array.
253
+ */
254
+ private _getCoupledAttributesMap;
255
+ /**
256
+ * Fires `register` event for the given element definition.
257
+ */
258
+ private _fireRegisterEvent;
259
+ /**
260
+ * Registers object element and attribute converters for the given data schema definition.
261
+ */
262
+ private _registerObjectElement;
263
+ /**
264
+ * Registers block element and attribute converters for the given data schema definition.
265
+ */
266
+ private _registerBlockElement;
267
+ /**
268
+ * Registers inline element and attribute converters for the given data schema definition.
269
+ *
270
+ * Extends `$text` model schema to allow the given definition model attribute and its properties.
271
+ */
272
+ private _registerInlineElement;
273
+ }
274
+ /**
275
+ * Fired when {@link module:html-support/datafilter~DataFilter} is registering element and attribute
276
+ * converters for the {@link module:html-support/dataschema~DataSchemaDefinition element definition}.
277
+ *
278
+ * The event also accepts {@link module:html-support/dataschema~DataSchemaDefinition#view} value
279
+ * as an event namespace, e.g. `register:span`.
280
+ *
281
+ * ```ts
282
+ * dataFilter.on( 'register', ( evt, definition ) => {
283
+ * editor.model.schema.register( definition.model, definition.modelSchema );
284
+ * editor.conversion.elementToElement( { model: definition.model, view: definition.view } );
285
+ *
286
+ * evt.stop();
287
+ * } );
288
+ *
289
+ * dataFilter.on( 'register:span', ( evt, definition ) => {
290
+ * editor.model.schema.extend( '$text', { allowAttributes: 'htmlSpan' } );
291
+ *
292
+ * editor.conversion.for( 'upcast' ).elementToAttribute( { view: 'span', model: 'htmlSpan' } );
293
+ * editor.conversion.for( 'downcast' ).attributeToElement( { view: 'span', model: 'htmlSpan' } );
294
+ *
295
+ * evt.stop();
296
+ * }, { priority: 'high' } )
297
+ * ```
298
+ *
299
+ * @eventName ~DataFilter#register
300
+ */
301
+ export interface DataFilterRegisterEvent {
302
+ name: 'register' | `register:${string}`;
303
+ args: [data: DataSchemaDefinition];
304
+ }