@ckeditor/ckeditor5-html-support 45.2.1 → 46.0.0-alpha.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 (50) hide show
  1. package/build/html-support.js +2 -2
  2. package/dist/index.js +110 -54
  3. package/dist/index.js.map +1 -1
  4. package/package.json +13 -12
  5. package/src/converters.d.ts +21 -11
  6. package/src/converters.js +10 -0
  7. package/src/datafilter.d.ts +6 -6
  8. package/src/datafilter.js +7 -5
  9. package/src/dataschema.d.ts +14 -14
  10. package/src/dataschema.js +2 -2
  11. package/src/emptyblock.d.ts +1 -1
  12. package/src/emptyblock.js +1 -1
  13. package/src/fullpage.d.ts +1 -1
  14. package/src/fullpage.js +4 -4
  15. package/src/generalhtmlsupport.d.ts +20 -16
  16. package/src/generalhtmlsupport.js +21 -14
  17. package/src/generalhtmlsupportconfig.d.ts +5 -5
  18. package/src/htmlcomment.d.ts +6 -6
  19. package/src/htmlcomment.js +1 -1
  20. package/src/htmlpagedataprocessor.d.ts +1 -1
  21. package/src/htmlpagedataprocessor.js +3 -3
  22. package/src/index.d.ts +23 -19
  23. package/src/index.js +11 -7
  24. package/src/integrations/codeblock.d.ts +2 -2
  25. package/src/integrations/codeblock.js +2 -2
  26. package/src/integrations/customelement.d.ts +3 -3
  27. package/src/integrations/customelement.js +7 -6
  28. package/src/integrations/dualcontent.d.ts +6 -5
  29. package/src/integrations/dualcontent.js +6 -5
  30. package/src/integrations/heading.d.ts +2 -2
  31. package/src/integrations/heading.js +2 -2
  32. package/src/integrations/horizontalline.d.ts +2 -2
  33. package/src/integrations/horizontalline.js +2 -2
  34. package/src/integrations/image.d.ts +2 -2
  35. package/src/integrations/image.js +2 -2
  36. package/src/integrations/integrationutils.d.ts +2 -2
  37. package/src/integrations/list.d.ts +2 -2
  38. package/src/integrations/list.js +2 -2
  39. package/src/integrations/mediaembed.d.ts +2 -2
  40. package/src/integrations/mediaembed.js +3 -3
  41. package/src/integrations/script.d.ts +2 -2
  42. package/src/integrations/script.js +4 -3
  43. package/src/integrations/style.d.ts +2 -2
  44. package/src/integrations/style.js +4 -3
  45. package/src/integrations/table.d.ts +2 -2
  46. package/src/integrations/table.js +2 -2
  47. package/src/schemadefinitions.d.ts +49 -5
  48. package/src/schemadefinitions.js +50 -43
  49. package/src/utils.d.ts +26 -7
  50. package/src/utils.js +30 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-html-support",
3
- "version": "45.2.1",
3
+ "version": "46.0.0-alpha.1",
4
4
  "description": "HTML Support feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -17,17 +17,18 @@
17
17
  "type": "module",
18
18
  "main": "src/index.js",
19
19
  "dependencies": {
20
- "@ckeditor/ckeditor5-core": "45.2.1",
21
- "@ckeditor/ckeditor5-engine": "45.2.1",
22
- "@ckeditor/ckeditor5-enter": "45.2.1",
23
- "@ckeditor/ckeditor5-heading": "45.2.1",
24
- "@ckeditor/ckeditor5-image": "45.2.1",
25
- "@ckeditor/ckeditor5-list": "45.2.1",
26
- "@ckeditor/ckeditor5-table": "45.2.1",
27
- "@ckeditor/ckeditor5-utils": "45.2.1",
28
- "@ckeditor/ckeditor5-widget": "45.2.1",
29
- "ckeditor5": "45.2.1",
30
- "es-toolkit": "1.32.0"
20
+ "@ckeditor/ckeditor5-core": "46.0.0-alpha.1",
21
+ "@ckeditor/ckeditor5-engine": "46.0.0-alpha.1",
22
+ "@ckeditor/ckeditor5-enter": "46.0.0-alpha.1",
23
+ "@ckeditor/ckeditor5-heading": "46.0.0-alpha.1",
24
+ "@ckeditor/ckeditor5-image": "46.0.0-alpha.1",
25
+ "@ckeditor/ckeditor5-list": "46.0.0-alpha.1",
26
+ "@ckeditor/ckeditor5-remove-format": "46.0.0-alpha.1",
27
+ "@ckeditor/ckeditor5-table": "46.0.0-alpha.1",
28
+ "@ckeditor/ckeditor5-utils": "46.0.0-alpha.1",
29
+ "@ckeditor/ckeditor5-widget": "46.0.0-alpha.1",
30
+ "ckeditor5": "46.0.0-alpha.1",
31
+ "es-toolkit": "1.39.5"
31
32
  },
32
33
  "author": "CKSource (http://cksource.com/)",
33
34
  "license": "SEE LICENSE IN LICENSE.md",
@@ -6,55 +6,65 @@
6
6
  * @module html-support/converters
7
7
  */
8
8
  import type { Editor } from 'ckeditor5/src/core.js';
9
- import type { AttributeElement, DowncastConversionApi, DowncastDispatcher, DowncastWriter, Element, ElementCreatorFunction, UpcastConversionApi, UpcastDispatcher, ViewElement } from 'ckeditor5/src/engine.js';
10
- import type DataFilter from './datafilter.js';
11
- import type { DataSchemaBlockElementDefinition, DataSchemaDefinition, DataSchemaInlineElementDefinition } from './dataschema.js';
9
+ import type { ViewAttributeElement, DowncastConversionApi, DowncastDispatcher, ViewDowncastWriter, ModelElement, DowncastElementCreatorFunction, UpcastConversionApi, UpcastDispatcher, ViewElement } from 'ckeditor5/src/engine.js';
10
+ import { type DataFilter } from './datafilter.js';
11
+ import type { HtmlSupportDataSchemaBlockElementDefinition, HtmlSupportDataSchemaDefinition, HtmlSupportDataSchemaInlineElementDefinition } from './dataschema.js';
12
12
  /**
13
13
  * View-to-model conversion helper for object elements.
14
14
  *
15
15
  * Preserves object element content in `htmlContent` attribute.
16
16
  *
17
17
  * @returns Returns a conversion callback.
18
+ * @internal
18
19
  */
19
- export declare function viewToModelObjectConverter({ model: modelName }: DataSchemaDefinition): (viewElement: ViewElement, conversionApi: UpcastConversionApi) => Element;
20
+ export declare function viewToModelObjectConverter({ model: modelName }: HtmlSupportDataSchemaDefinition): (viewElement: ViewElement, conversionApi: UpcastConversionApi) => ModelElement;
20
21
  /**
21
22
  * Conversion helper converting an object element to an HTML object widget.
22
23
  *
23
24
  * @returns Returns a conversion callback.
25
+ * @internal
24
26
  */
25
- export declare function toObjectWidgetConverter(editor: Editor, { view: viewName, isInline }: DataSchemaInlineElementDefinition): ElementCreatorFunction;
27
+ export declare function toObjectWidgetConverter(editor: Editor, { view: viewName, isInline }: HtmlSupportDataSchemaInlineElementDefinition): DowncastElementCreatorFunction;
26
28
  /**
27
29
  * Creates object view element from the given model element.
30
+ *
31
+ * @internal
28
32
  */
29
- export declare function createObjectView(viewName: string, modelElement: Element, writer: DowncastWriter): ViewElement;
33
+ export declare function createObjectView(viewName: string, modelElement: ModelElement, writer: ViewDowncastWriter): ViewElement;
30
34
  /**
31
35
  * View-to-attribute conversion helper preserving inline element attributes on `$text`.
32
36
  *
33
37
  * @returns Returns a conversion callback.
38
+ * @internal
34
39
  */
35
- export declare function viewToAttributeInlineConverter({ view: viewName, model: attributeKey, allowEmpty }: DataSchemaInlineElementDefinition, dataFilter: DataFilter): (dispatcher: UpcastDispatcher) => void;
40
+ export declare function viewToAttributeInlineConverter({ view: viewName, model: attributeKey, allowEmpty }: HtmlSupportDataSchemaInlineElementDefinition, dataFilter: DataFilter): (dispatcher: UpcastDispatcher) => void;
36
41
  /**
37
42
  * Conversion helper converting an empty inline model element to an HTML element or widget.
43
+ *
44
+ * @internal
38
45
  */
39
- export declare function emptyInlineModelElementToViewConverter({ model: attributeKey, view: viewName }: DataSchemaInlineElementDefinition, asWidget?: boolean): ElementCreatorFunction;
46
+ export declare function emptyInlineModelElementToViewConverter({ model: attributeKey, view: viewName }: HtmlSupportDataSchemaInlineElementDefinition, asWidget?: boolean): DowncastElementCreatorFunction;
40
47
  /**
41
48
  * Attribute-to-view conversion helper applying attributes to view element preserved on `$text`.
42
49
  *
43
50
  * @returns Returns a conversion callback.
51
+ * @internal
44
52
  */
45
- export declare function attributeToViewInlineConverter({ priority, view: viewName }: DataSchemaInlineElementDefinition): (attributeValue: any, conversionApi: DowncastConversionApi) => AttributeElement | undefined;
53
+ export declare function attributeToViewInlineConverter({ priority, view: viewName }: HtmlSupportDataSchemaInlineElementDefinition): (attributeValue: any, conversionApi: DowncastConversionApi) => ViewAttributeElement | undefined;
46
54
  /**
47
55
  * View-to-model conversion helper preserving allowed attributes on block element.
48
56
  *
49
57
  * All matched attributes will be preserved on `html*Attributes` attribute.
50
58
  *
51
59
  * @returns Returns a conversion callback.
60
+ * @internal
52
61
  */
53
- export declare function viewToModelBlockAttributeConverter({ view: viewName }: DataSchemaBlockElementDefinition, dataFilter: DataFilter): (dispatcher: UpcastDispatcher) => void;
62
+ export declare function viewToModelBlockAttributeConverter({ view: viewName }: HtmlSupportDataSchemaBlockElementDefinition, dataFilter: DataFilter): (dispatcher: UpcastDispatcher) => void;
54
63
  /**
55
64
  * Model-to-view conversion helper applying attributes preserved in `html*Attributes` attribute
56
65
  * for block elements.
57
66
  *
58
67
  * @returns Returns a conversion callback.
68
+ * @internal
59
69
  */
60
- export declare function modelToViewBlockAttributeConverter({ view: viewName, model: modelName }: DataSchemaBlockElementDefinition): (dispatcher: DowncastDispatcher) => void;
70
+ export declare function modelToViewBlockAttributeConverter({ view: viewName, model: modelName }: HtmlSupportDataSchemaBlockElementDefinition): (dispatcher: DowncastDispatcher) => void;
package/src/converters.js CHANGED
@@ -10,6 +10,7 @@ import { setViewAttributes, mergeViewElementAttributes, updateViewAttributes, ge
10
10
  * Preserves object element content in `htmlContent` attribute.
11
11
  *
12
12
  * @returns Returns a conversion callback.
13
+ * @internal
13
14
  */
14
15
  export function viewToModelObjectConverter({ model: modelName }) {
15
16
  return (viewElement, conversionApi) => {
@@ -23,6 +24,7 @@ export function viewToModelObjectConverter({ model: modelName }) {
23
24
  * Conversion helper converting an object element to an HTML object widget.
24
25
  *
25
26
  * @returns Returns a conversion callback.
27
+ * @internal
26
28
  */
27
29
  export function toObjectWidgetConverter(editor, { view: viewName, isInline }) {
28
30
  const t = editor.t;
@@ -45,6 +47,8 @@ export function toObjectWidgetConverter(editor, { view: viewName, isInline }) {
45
47
  }
46
48
  /**
47
49
  * Creates object view element from the given model element.
50
+ *
51
+ * @internal
48
52
  */
49
53
  export function createObjectView(viewName, modelElement, writer) {
50
54
  return writer.createRawElement(viewName, null, (domElement, domConverter) => {
@@ -55,6 +59,7 @@ export function createObjectView(viewName, modelElement, writer) {
55
59
  * View-to-attribute conversion helper preserving inline element attributes on `$text`.
56
60
  *
57
61
  * @returns Returns a conversion callback.
62
+ * @internal
58
63
  */
59
64
  export function viewToAttributeInlineConverter({ view: viewName, model: attributeKey, allowEmpty }, dataFilter) {
60
65
  return dispatcher => {
@@ -104,6 +109,8 @@ export function viewToAttributeInlineConverter({ view: viewName, model: attribut
104
109
  }
105
110
  /**
106
111
  * Conversion helper converting an empty inline model element to an HTML element or widget.
112
+ *
113
+ * @internal
107
114
  */
108
115
  export function emptyInlineModelElementToViewConverter({ model: attributeKey, view: viewName }, asWidget) {
109
116
  return (item, { writer, consumable }) => {
@@ -122,6 +129,7 @@ export function emptyInlineModelElementToViewConverter({ model: attributeKey, vi
122
129
  * Attribute-to-view conversion helper applying attributes to view element preserved on `$text`.
123
130
  *
124
131
  * @returns Returns a conversion callback.
132
+ * @internal
125
133
  */
126
134
  export function attributeToViewInlineConverter({ priority, view: viewName }) {
127
135
  return (attributeValue, conversionApi) => {
@@ -140,6 +148,7 @@ export function attributeToViewInlineConverter({ priority, view: viewName }) {
140
148
  * All matched attributes will be preserved on `html*Attributes` attribute.
141
149
  *
142
150
  * @returns Returns a conversion callback.
151
+ * @internal
143
152
  */
144
153
  export function viewToModelBlockAttributeConverter({ view: viewName }, dataFilter) {
145
154
  return (dispatcher) => {
@@ -164,6 +173,7 @@ export function viewToModelBlockAttributeConverter({ view: viewName }, dataFilte
164
173
  * for block elements.
165
174
  *
166
175
  * @returns Returns a conversion callback.
176
+ * @internal
167
177
  */
168
178
  export function modelToViewBlockAttributeConverter({ view: viewName, model: modelName }) {
169
179
  return (dispatcher) => {
@@ -8,7 +8,7 @@
8
8
  import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
9
  import { type MatcherPattern, type UpcastConversionApi, type ViewElement, type MatcherObjectPattern } from 'ckeditor5/src/engine.js';
10
10
  import { Widget } from 'ckeditor5/src/widget.js';
11
- import { default as DataSchema, type DataSchemaDefinition } from './dataschema.js';
11
+ import { DataSchema, type HtmlSupportDataSchemaDefinition } from './dataschema.js';
12
12
  import { type GHSViewAttributes } from './utils.js';
13
13
  import '../theme/datafilter.css';
14
14
  /**
@@ -43,7 +43,7 @@ import '../theme/datafilter.css';
43
43
  * To apply the information about allowed and disallowed attributes in custom integration plugin,
44
44
  * use the {@link module:html-support/datafilter~DataFilter#processViewAttributes `processViewAttributes()`} method.
45
45
  */
46
- export default class DataFilter extends Plugin {
46
+ export declare class DataFilter extends Plugin {
47
47
  /**
48
48
  * An instance of the {@link module:html-support/dataschema~DataSchema}.
49
49
  */
@@ -277,9 +277,9 @@ export default class DataFilter extends Plugin {
277
277
  }
278
278
  /**
279
279
  * Fired when {@link module:html-support/datafilter~DataFilter} is registering element and attribute
280
- * converters for the {@link module:html-support/dataschema~DataSchemaDefinition element definition}.
280
+ * converters for the {@link module:html-support/dataschema~HtmlSupportDataSchemaDefinition element definition}.
281
281
  *
282
- * The event also accepts {@link module:html-support/dataschema~DataSchemaDefinition#view} value
282
+ * The event also accepts {@link module:html-support/dataschema~HtmlSupportDataSchemaDefinition#view} value
283
283
  * as an event namespace, e.g. `register:span`.
284
284
  *
285
285
  * ```ts
@@ -302,7 +302,7 @@ export default class DataFilter extends Plugin {
302
302
  *
303
303
  * @eventName ~DataFilter#register
304
304
  */
305
- export interface DataFilterRegisterEvent {
305
+ export interface HtmlSupportDataFilterRegisterEvent {
306
306
  name: 'register' | `register:${string}`;
307
- args: [data: DataSchemaDefinition];
307
+ args: [data: HtmlSupportDataSchemaDefinition];
308
308
  }
package/src/datafilter.js CHANGED
@@ -10,7 +10,7 @@ import { Matcher, StylesMap } from 'ckeditor5/src/engine.js';
10
10
  import { CKEditorError, priorities, isValidAttributeName } from 'ckeditor5/src/utils.js';
11
11
  import { Widget } from 'ckeditor5/src/widget.js';
12
12
  import { viewToModelObjectConverter, toObjectWidgetConverter, createObjectView, viewToAttributeInlineConverter, attributeToViewInlineConverter, emptyInlineModelElementToViewConverter, viewToModelBlockAttributeConverter, modelToViewBlockAttributeConverter } from './converters.js';
13
- import { default as DataSchema } from './dataschema.js';
13
+ import { DataSchema } from './dataschema.js';
14
14
  import { getHtmlAttributeName } from './utils.js';
15
15
  import { isPlainObject } from 'es-toolkit/compat';
16
16
  import '../theme/datafilter.css';
@@ -46,7 +46,7 @@ import '../theme/datafilter.css';
46
46
  * To apply the information about allowed and disallowed attributes in custom integration plugin,
47
47
  * use the {@link module:html-support/datafilter~DataFilter#processViewAttributes `processViewAttributes()`} method.
48
48
  */
49
- export default class DataFilter extends Plugin {
49
+ export class DataFilter extends Plugin {
50
50
  /**
51
51
  * An instance of the {@link module:html-support/dataschema~DataSchema}.
52
52
  */
@@ -535,7 +535,8 @@ export default class DataFilter extends Plugin {
535
535
  // `+ 2` is used to take priority over `_addDefaultH1Conversion` in the Heading plugin.
536
536
  converterPriority: priorities.low + 2
537
537
  });
538
- conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, this));
538
+ conversion.for('upcast')
539
+ .add(viewToModelBlockAttributeConverter(definition, this));
539
540
  conversion.for('editingDowncast').elementToStructure({
540
541
  model: {
541
542
  name: modelName,
@@ -549,7 +550,8 @@ export default class DataFilter extends Plugin {
549
550
  return createObjectView(viewName, modelElement, writer);
550
551
  }
551
552
  });
552
- conversion.for('dataDowncast').add(modelToViewBlockAttributeConverter(definition));
553
+ conversion.for('dataDowncast')
554
+ .add(modelToViewBlockAttributeConverter(definition));
553
555
  }
554
556
  /**
555
557
  * Registers block element and attribute converters for the given data schema definition.
@@ -603,7 +605,7 @@ export default class DataFilter extends Plugin {
603
605
  const schema = editor.model.schema;
604
606
  const conversion = editor.conversion;
605
607
  const attributeKey = definition.model;
606
- // This element is stored in the model as an attribute on a block element, for example DocumentLists.
608
+ // This element is stored in the model as an attribute on a block element, for example Lists.
607
609
  if (definition.appliesToBlock) {
608
610
  return;
609
611
  }
@@ -6,7 +6,7 @@
6
6
  * @module html-support/dataschema
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import type { AttributeProperties, SchemaItemDefinition } from 'ckeditor5/src/engine.js';
9
+ import type { ModelAttributeProperties, ModelSchemaItemDefinition } from 'ckeditor5/src/engine.js';
10
10
  /**
11
11
  * Holds representation of the extended HTML document type definitions to be used by the
12
12
  * editor in HTML support.
@@ -39,7 +39,7 @@ import type { AttributeProperties, SchemaItemDefinition } from 'ckeditor5/src/en
39
39
  * } );
40
40
  * ```
41
41
  */
42
- export default class DataSchema extends Plugin {
42
+ export declare class DataSchema extends Plugin {
43
43
  /**
44
44
  * A map of registered data schema definitions.
45
45
  */
@@ -59,11 +59,11 @@ export default class DataSchema extends Plugin {
59
59
  /**
60
60
  * Add new data schema definition describing block element.
61
61
  */
62
- registerBlockElement(definition: DataSchemaBlockElementDefinition): void;
62
+ registerBlockElement(definition: HtmlSupportDataSchemaBlockElementDefinition): void;
63
63
  /**
64
64
  * Add new data schema definition describing inline element.
65
65
  */
66
- registerInlineElement(definition: DataSchemaInlineElementDefinition): void;
66
+ registerInlineElement(definition: HtmlSupportDataSchemaInlineElementDefinition): void;
67
67
  /**
68
68
  * Updates schema definition describing block element with new properties.
69
69
  *
@@ -72,7 +72,7 @@ export default class DataSchema extends Plugin {
72
72
  *
73
73
  * @param definition Definition update.
74
74
  */
75
- extendBlockElement(definition: DataSchemaBlockElementDefinition): void;
75
+ extendBlockElement(definition: HtmlSupportDataSchemaBlockElementDefinition): void;
76
76
  /**
77
77
  * Updates schema definition describing inline element with new properties.
78
78
  *
@@ -81,17 +81,17 @@ export default class DataSchema extends Plugin {
81
81
  *
82
82
  * @param definition Definition update.
83
83
  */
84
- extendInlineElement(definition: DataSchemaInlineElementDefinition): void;
84
+ extendInlineElement(definition: HtmlSupportDataSchemaInlineElementDefinition): void;
85
85
  /**
86
86
  * Returns all definitions matching the given view name.
87
87
  *
88
88
  * @param includeReferences Indicates if this method should also include definitions of referenced models.
89
89
  */
90
- getDefinitionsForView(viewName: string | RegExp, includeReferences?: boolean): Set<DataSchemaDefinition>;
90
+ getDefinitionsForView(viewName: string | RegExp, includeReferences?: boolean): Set<HtmlSupportDataSchemaDefinition>;
91
91
  /**
92
92
  * Returns definitions matching the given model name.
93
93
  */
94
- getDefinitionsForModel(modelName: string): Array<DataSchemaDefinition>;
94
+ getDefinitionsForModel(modelName: string): Array<HtmlSupportDataSchemaDefinition>;
95
95
  /**
96
96
  * Returns definitions matching the given view name.
97
97
  */
@@ -115,7 +115,7 @@ export default class DataSchema extends Plugin {
115
115
  /**
116
116
  * A base definition of {@link module:html-support/dataschema~DataSchema data schema}.
117
117
  */
118
- export interface DataSchemaDefinition {
118
+ export interface HtmlSupportDataSchemaDefinition {
119
119
  /**
120
120
  * Name of the model.
121
121
  */
@@ -131,7 +131,7 @@ export interface DataSchemaDefinition {
131
131
  /**
132
132
  * The model schema item definition describing registered model.
133
133
  */
134
- modelSchema?: SchemaItemDefinition;
134
+ modelSchema?: ModelSchemaItemDefinition;
135
135
  /**
136
136
  * Indicates that the definition describes block element.
137
137
  * Set by {@link module:html-support/dataschema~DataSchema#registerBlockElement} method.
@@ -149,7 +149,7 @@ export interface DataSchemaDefinition {
149
149
  /**
150
150
  * A definition of {@link module:html-support/dataschema~DataSchema data schema} for block elements.
151
151
  */
152
- export interface DataSchemaBlockElementDefinition extends DataSchemaDefinition {
152
+ export interface HtmlSupportDataSchemaBlockElementDefinition extends HtmlSupportDataSchemaDefinition {
153
153
  /**
154
154
  * Should be used when an element can behave both as a sectioning element (e.g. article) and
155
155
  * element accepting only inline content (e.g. paragraph).
@@ -160,14 +160,14 @@ export interface DataSchemaBlockElementDefinition extends DataSchemaDefinition {
160
160
  /**
161
161
  * A definition of {@link module:html-support/dataschema~DataSchema data schema} for inline elements.
162
162
  */
163
- export interface DataSchemaInlineElementDefinition extends DataSchemaDefinition {
163
+ export interface HtmlSupportDataSchemaInlineElementDefinition extends HtmlSupportDataSchemaDefinition {
164
164
  /**
165
165
  * Additional metadata describing the model attribute.
166
166
  */
167
- attributeProperties?: AttributeProperties;
167
+ attributeProperties?: ModelAttributeProperties;
168
168
  /**
169
169
  * Element priority. Decides in what order elements are wrapped by
170
- * {@link module:engine/view/downcastwriter~DowncastWriter}.
170
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
171
171
  * Set by {@link module:html-support/dataschema~DataSchema#registerInlineElement} method.
172
172
  */
173
173
  priority?: number;
package/src/dataschema.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { toArray } from 'ckeditor5/src/utils.js';
10
- import defaultConfig from './schemadefinitions.js';
10
+ import { defaultConfig } from './schemadefinitions.js';
11
11
  import { mergeWith } from 'es-toolkit/compat';
12
12
  /**
13
13
  * Holds representation of the extended HTML document type definitions to be used by the
@@ -41,7 +41,7 @@ import { mergeWith } from 'es-toolkit/compat';
41
41
  * } );
42
42
  * ```
43
43
  */
44
- export default class DataSchema extends Plugin {
44
+ export class DataSchema extends Plugin {
45
45
  /**
46
46
  * A map of registered data schema definitions.
47
47
  */
@@ -34,7 +34,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
34
34
  * <td>&nbsp;</td>
35
35
  * ```
36
36
  */
37
- export default class EmptyBlock extends Plugin {
37
+ export declare class EmptyBlock extends Plugin {
38
38
  /**
39
39
  * @inheritDoc
40
40
  */
package/src/emptyblock.js CHANGED
@@ -35,7 +35,7 @@ const EMPTY_BLOCK_MODEL_ATTRIBUTE = 'htmlEmptyBlock';
35
35
  * <td>&nbsp;</td>
36
36
  * ```
37
37
  */
38
- export default class EmptyBlock extends Plugin {
38
+ export class EmptyBlock extends Plugin {
39
39
  /**
40
40
  * @inheritDoc
41
41
  */
package/src/fullpage.d.ts CHANGED
@@ -9,7 +9,7 @@ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
9
  /**
10
10
  * The full page editing feature. It preserves the whole HTML page in the editor data.
11
11
  */
12
- export default class FullPage extends Plugin {
12
+ export declare class FullPage extends Plugin {
13
13
  /**
14
14
  * @inheritDoc
15
15
  */
package/src/fullpage.js CHANGED
@@ -7,12 +7,12 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { logWarning, global } from 'ckeditor5/src/utils.js';
10
- import { UpcastWriter } from 'ckeditor5/src/engine.js';
11
- import HtmlPageDataProcessor from './htmlpagedataprocessor.js';
10
+ import { ViewUpcastWriter } from 'ckeditor5/src/engine.js';
11
+ import { HtmlPageDataProcessor } from './htmlpagedataprocessor.js';
12
12
  /**
13
13
  * The full page editing feature. It preserves the whole HTML page in the editor data.
14
14
  */
15
- export default class FullPage extends Plugin {
15
+ export class FullPage extends Plugin {
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
@@ -85,7 +85,7 @@ export default class FullPage extends Plugin {
85
85
  if (!root.hasAttribute('$fullPageDocument')) {
86
86
  return;
87
87
  }
88
- const writer = new UpcastWriter(viewFragment.document);
88
+ const writer = new ViewUpcastWriter(viewFragment.document);
89
89
  for (const name of properties) {
90
90
  const value = root.getAttribute(name);
91
91
  if (value) {
@@ -7,26 +7,26 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { type ArrayOrItem } from 'ckeditor5/src/utils.js';
10
- import DataFilter from './datafilter.js';
11
- import CodeBlockElementSupport from './integrations/codeblock.js';
12
- import DualContentModelElementSupport from './integrations/dualcontent.js';
13
- import HeadingElementSupport from './integrations/heading.js';
14
- import ImageElementSupport from './integrations/image.js';
15
- import MediaEmbedElementSupport from './integrations/mediaembed.js';
16
- import ScriptElementSupport from './integrations/script.js';
17
- import TableElementSupport from './integrations/table.js';
18
- import StyleElementSupport from './integrations/style.js';
19
- import ListElementSupport from './integrations/list.js';
20
- import HorizontalLineElementSupport from './integrations/horizontalline.js';
21
- import CustomElementSupport from './integrations/customelement.js';
22
- import type { Selectable } from 'ckeditor5/src/engine.js';
10
+ import { DataFilter } from './datafilter.js';
11
+ import { CodeBlockElementSupport } from './integrations/codeblock.js';
12
+ import { DualContentModelElementSupport } from './integrations/dualcontent.js';
13
+ import { HeadingElementSupport } from './integrations/heading.js';
14
+ import { ImageElementSupport } from './integrations/image.js';
15
+ import { MediaEmbedElementSupport } from './integrations/mediaembed.js';
16
+ import { ScriptElementSupport } from './integrations/script.js';
17
+ import { TableElementSupport } from './integrations/table.js';
18
+ import { StyleElementSupport } from './integrations/style.js';
19
+ import { ListElementSupport } from './integrations/list.js';
20
+ import { HorizontalLineElementSupport } from './integrations/horizontalline.js';
21
+ import { CustomElementSupport } from './integrations/customelement.js';
22
+ import type { ModelSelectable } from 'ckeditor5/src/engine.js';
23
23
  /**
24
24
  * The General HTML Support feature.
25
25
  *
26
26
  * This is a "glue" plugin which initializes the {@link module:html-support/datafilter~DataFilter data filter} configuration
27
27
  * and features integration with the General HTML Support.
28
28
  */
29
- export default class GeneralHtmlSupport extends Plugin {
29
+ export declare class GeneralHtmlSupport extends Plugin {
30
30
  /**
31
31
  * @inheritDoc
32
32
  */
@@ -43,6 +43,10 @@ export default class GeneralHtmlSupport extends Plugin {
43
43
  * @inheritDoc
44
44
  */
45
45
  init(): void;
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ afterInit(): void;
46
50
  /**
47
51
  * Returns a GHS model attribute name related to a given view element name.
48
52
  *
@@ -58,7 +62,7 @@ export default class GeneralHtmlSupport extends Plugin {
58
62
  * @param className The css class to add.
59
63
  * @param selectable The selection or element to update.
60
64
  */
61
- addModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: Selectable): void;
65
+ addModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: ModelSelectable): void;
62
66
  /**
63
67
  * Updates GHS model attribute for a specified view element name, so it does not include the given class name.
64
68
  *
@@ -67,7 +71,7 @@ export default class GeneralHtmlSupport extends Plugin {
67
71
  * @param className The css class to remove.
68
72
  * @param selectable The selection or element to update.
69
73
  */
70
- removeModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: Selectable): void;
74
+ removeModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: ModelSelectable): void;
71
75
  /**
72
76
  * Updates GHS model attribute for a specified view element name, so it includes the given attribute.
73
77
  *
@@ -7,26 +7,26 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { toArray } from 'ckeditor5/src/utils.js';
10
- import DataFilter from './datafilter.js';
11
- import CodeBlockElementSupport from './integrations/codeblock.js';
12
- import DualContentModelElementSupport from './integrations/dualcontent.js';
13
- import HeadingElementSupport from './integrations/heading.js';
14
- import ImageElementSupport from './integrations/image.js';
15
- import MediaEmbedElementSupport from './integrations/mediaembed.js';
16
- import ScriptElementSupport from './integrations/script.js';
17
- import TableElementSupport from './integrations/table.js';
18
- import StyleElementSupport from './integrations/style.js';
19
- import ListElementSupport from './integrations/list.js';
20
- import HorizontalLineElementSupport from './integrations/horizontalline.js';
21
- import CustomElementSupport from './integrations/customelement.js';
22
- import { getHtmlAttributeName, modifyGhsAttribute } from './utils.js';
10
+ import { DataFilter } from './datafilter.js';
11
+ import { CodeBlockElementSupport } from './integrations/codeblock.js';
12
+ import { DualContentModelElementSupport } from './integrations/dualcontent.js';
13
+ import { HeadingElementSupport } from './integrations/heading.js';
14
+ import { ImageElementSupport } from './integrations/image.js';
15
+ import { MediaEmbedElementSupport } from './integrations/mediaembed.js';
16
+ import { ScriptElementSupport } from './integrations/script.js';
17
+ import { TableElementSupport } from './integrations/table.js';
18
+ import { StyleElementSupport } from './integrations/style.js';
19
+ import { ListElementSupport } from './integrations/list.js';
20
+ import { HorizontalLineElementSupport } from './integrations/horizontalline.js';
21
+ import { CustomElementSupport } from './integrations/customelement.js';
22
+ import { getHtmlAttributeName, modifyGhsAttribute, removeFormatting } from './utils.js';
23
23
  /**
24
24
  * The General HTML Support feature.
25
25
  *
26
26
  * This is a "glue" plugin which initializes the {@link module:html-support/datafilter~DataFilter data filter} configuration
27
27
  * and features integration with the General HTML Support.
28
28
  */
29
- export default class GeneralHtmlSupport extends Plugin {
29
+ export class GeneralHtmlSupport extends Plugin {
30
30
  /**
31
31
  * @inheritDoc
32
32
  */
@@ -71,6 +71,13 @@ export default class GeneralHtmlSupport extends Plugin {
71
71
  dataFilter.loadAllowedConfig(editor.config.get('htmlSupport.allow') || []);
72
72
  dataFilter.loadDisallowedConfig(editor.config.get('htmlSupport.disallow') || []);
73
73
  }
74
+ /**
75
+ * @inheritDoc
76
+ */
77
+ afterInit() {
78
+ const removeFormatCommand = this.editor.commands.get('removeFormat');
79
+ removeFormatCommand?.registerCustomAttribute(attributeName => attributeName.startsWith('html') && attributeName.endsWith('Attributes'), removeFormatting);
80
+ }
74
81
  /**
75
82
  * Returns a GHS model attribute name related to a given view element name.
76
83
  *
@@ -101,12 +101,12 @@ export interface GeneralHtmlSupportConfig {
101
101
  * .catch( ... );
102
102
  * ```
103
103
  */
104
- fullPage?: FullPageConfig;
104
+ fullPage?: GHSFullPageConfig;
105
105
  }
106
106
  /**
107
107
  * The configuration of the Full page editing feature.
108
108
  */
109
- export interface FullPageConfig {
109
+ export interface GHSFullPageConfig {
110
110
  /**
111
111
  * Whether the feature should allow the editor to render styles from the `<head>` section of editor data content.
112
112
  *
@@ -135,7 +135,7 @@ export interface FullPageConfig {
135
135
  * We strongly recommend overwriting the default function to avoid XSS vulnerabilities.
136
136
  *
137
137
  * The function receives the CSS (as a string), and should return an object
138
- * that matches the {@link module:html-support/generalhtmlsupportconfig~CssSanitizeOutput} interface.
138
+ * that matches the {@link module:html-support/generalhtmlsupportconfig~GHSCssSanitizeOutput} interface.
139
139
  *
140
140
  * ```ts
141
141
  * ClassicEditor
@@ -161,9 +161,9 @@ export interface FullPageConfig {
161
161
  * ```
162
162
  *
163
163
  */
164
- sanitizeCss?: (css: string) => CssSanitizeOutput;
164
+ sanitizeCss?: (css: string) => GHSCssSanitizeOutput;
165
165
  }
166
- export interface CssSanitizeOutput {
166
+ export interface GHSCssSanitizeOutput {
167
167
  /**
168
168
  * An output (safe) CSS that will be inserted into the document.
169
169
  */