@ckeditor/ckeditor5-html-support 36.0.1 → 37.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/README.md +2 -2
  2. package/build/html-support.js +1 -1
  3. package/ckeditor5-metadata.json +2 -2
  4. package/package.json +42 -36
  5. package/src/augmentation.d.ts +33 -0
  6. package/src/augmentation.js +5 -0
  7. package/src/conversionutils.d.ts +42 -0
  8. package/src/conversionutils.js +57 -77
  9. package/src/converters.d.ts +56 -0
  10. package/src/converters.js +104 -156
  11. package/src/datafilter.d.ts +250 -0
  12. package/src/datafilter.js +566 -782
  13. package/src/dataschema.d.ts +169 -0
  14. package/src/dataschema.js +143 -229
  15. package/src/fullpage.d.ts +21 -0
  16. package/src/fullpage.js +65 -86
  17. package/src/generalhtmlsupport.d.ts +88 -0
  18. package/src/generalhtmlsupport.js +244 -327
  19. package/src/generalhtmlsupportconfig.d.ts +67 -0
  20. package/src/generalhtmlsupportconfig.js +5 -0
  21. package/src/htmlcomment.d.ts +72 -0
  22. package/src/htmlcomment.js +175 -239
  23. package/src/htmlpagedataprocessor.d.ts +22 -0
  24. package/src/htmlpagedataprocessor.js +53 -76
  25. package/src/index.d.ts +25 -0
  26. package/src/index.js +1 -2
  27. package/src/integrations/codeblock.d.ts +22 -0
  28. package/src/integrations/codeblock.js +87 -115
  29. package/src/integrations/customelement.d.ts +25 -0
  30. package/src/integrations/customelement.js +127 -160
  31. package/src/integrations/documentlist.d.ts +26 -0
  32. package/src/integrations/documentlist.js +154 -191
  33. package/src/integrations/dualcontent.d.ts +44 -0
  34. package/src/integrations/dualcontent.js +92 -128
  35. package/src/integrations/heading.d.ts +25 -0
  36. package/src/integrations/heading.js +41 -54
  37. package/src/integrations/image.d.ts +25 -0
  38. package/src/integrations/image.js +154 -212
  39. package/src/integrations/integrationutils.d.ts +15 -0
  40. package/src/integrations/integrationutils.js +21 -0
  41. package/src/integrations/mediaembed.d.ts +25 -0
  42. package/src/integrations/mediaembed.js +101 -147
  43. package/src/integrations/script.d.ts +25 -0
  44. package/src/integrations/script.js +45 -67
  45. package/src/integrations/style.d.ts +25 -0
  46. package/src/integrations/style.js +45 -67
  47. package/src/integrations/table.d.ts +22 -0
  48. package/src/integrations/table.js +113 -160
  49. package/src/schemadefinitions.d.ts +13 -0
  50. package/src/schemadefinitions.js +846 -835
@@ -0,0 +1,25 @@
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/integrations/heading
7
+ */
8
+ import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
9
+ /**
10
+ * Provides the General HTML Support integration with {@link module:heading/heading~Heading Heading} feature.
11
+ */
12
+ export default class HeadingElementSupport extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get requires(): PluginDependencies;
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName(): 'HeadingElementSupport';
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init(): void;
25
+ }
@@ -2,67 +2,54 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module html-support/integrations/heading
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
-
12
9
  import DataSchema from '../dataschema';
13
-
14
10
  /**
15
11
  * Provides the General HTML Support integration with {@link module:heading/heading~Heading Heading} feature.
16
- *
17
- * @extends module:core/plugin~Plugin
18
12
  */
19
13
  export default class HeadingElementSupport extends Plugin {
20
- /**
21
- * @inheritDoc
22
- */
23
- static get requires() {
24
- return [ DataSchema ];
25
- }
26
-
27
- /**
28
- * @inheritDoc
29
- */
30
- static get pluginName() {
31
- return 'HeadingElementSupport';
32
- }
33
-
34
- /**
35
- * @inheritDoc
36
- */
37
- init() {
38
- const editor = this.editor;
39
-
40
- if ( !editor.plugins.has( 'HeadingEditing' ) ) {
41
- return;
42
- }
43
-
44
- const dataSchema = editor.plugins.get( DataSchema );
45
- const options = editor.config.get( 'heading.options' );
46
- const headerModels = [];
47
-
48
- // We are registering all elements supported by HeadingEditing
49
- // to enable custom attributes for those elements.
50
- for ( const option of options ) {
51
- if ( 'model' in option && 'view' in option ) {
52
- dataSchema.registerBlockElement( {
53
- view: option.view,
54
- model: option.model
55
- } );
56
-
57
- headerModels.push( option.model );
58
- }
59
- }
60
-
61
- dataSchema.extendBlockElement( {
62
- model: 'htmlHgroup',
63
- modelSchema: {
64
- allowChildren: headerModels
65
- }
66
- } );
67
- }
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get requires() {
18
+ return [DataSchema];
19
+ }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName() {
24
+ return 'HeadingElementSupport';
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init() {
30
+ const editor = this.editor;
31
+ if (!editor.plugins.has('HeadingEditing')) {
32
+ return;
33
+ }
34
+ const dataSchema = editor.plugins.get(DataSchema);
35
+ const options = editor.config.get('heading.options');
36
+ const headerModels = [];
37
+ // We are registering all elements supported by HeadingEditing
38
+ // to enable custom attributes for those elements.
39
+ for (const option of options) {
40
+ if ('model' in option && 'view' in option) {
41
+ dataSchema.registerBlockElement({
42
+ view: option.view,
43
+ model: option.model
44
+ });
45
+ headerModels.push(option.model);
46
+ }
47
+ }
48
+ dataSchema.extendBlockElement({
49
+ model: 'htmlHgroup',
50
+ modelSchema: {
51
+ allowChildren: headerModels
52
+ }
53
+ });
54
+ }
68
55
  }
@@ -0,0 +1,25 @@
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/integrations/image
7
+ */
8
+ import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
9
+ /**
10
+ * Provides the General HTML Support integration with the {@link module:image/image~Image Image} feature.
11
+ */
12
+ export default class ImageElementSupport extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get requires(): PluginDependencies;
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName(): 'ImageElementSupport';
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init(): void;
25
+ }
@@ -2,229 +2,171 @@
2
2
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module html-support/integrations/image
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
-
12
9
  import DataFilter from '../datafilter';
13
- import {
14
- setViewAttributes,
15
- updateViewAttributes
16
- } from '../conversionutils.js';
17
-
10
+ import { setViewAttributes, updateViewAttributes } from '../conversionutils';
11
+ import { getDescendantElement } from './integrationutils';
18
12
  /**
19
13
  * Provides the General HTML Support integration with the {@link module:image/image~Image Image} feature.
20
- *
21
- * @extends module:core/plugin~Plugin
22
14
  */
23
15
  export default class ImageElementSupport extends Plugin {
24
- /**
25
- * @inheritDoc
26
- */
27
- static get requires() {
28
- return [ DataFilter ];
29
- }
30
-
31
- /**
32
- * @inheritDoc
33
- */
34
- static get pluginName() {
35
- return 'ImageElementSupport';
36
- }
37
-
38
- /**
39
- * @inheritDoc
40
- */
41
- init() {
42
- const editor = this.editor;
43
-
44
- // At least one image plugin should be loaded for the integration to work properly.
45
- if ( !editor.plugins.has( 'ImageInlineEditing' ) && !editor.plugins.has( 'ImageBlockEditing' ) ) {
46
- return;
47
- }
48
-
49
- const schema = editor.model.schema;
50
- const conversion = editor.conversion;
51
- const dataFilter = editor.plugins.get( DataFilter );
52
-
53
- dataFilter.on( 'register:figure', () => {
54
- conversion.for( 'upcast' ).add( viewToModelFigureAttributeConverter( dataFilter ) );
55
- } );
56
-
57
- dataFilter.on( 'register:img', ( evt, definition ) => {
58
- if ( definition.model !== 'imageBlock' && definition.model !== 'imageInline' ) {
59
- return;
60
- }
61
-
62
- if ( schema.isRegistered( 'imageBlock' ) ) {
63
- schema.extend( 'imageBlock', {
64
- allowAttributes: [
65
- 'htmlAttributes',
66
- // Figure and Link don't have model counterpart.
67
- // We will preserve attributes on image model element using these attribute keys.
68
- 'htmlFigureAttributes',
69
- 'htmlLinkAttributes'
70
- ]
71
- } );
72
- }
73
-
74
- if ( schema.isRegistered( 'imageInline' ) ) {
75
- schema.extend( 'imageInline', {
76
- allowAttributes: [
77
- // `htmlA` is needed for standard GHS link integration.
78
- 'htmlA',
79
- 'htmlAttributes'
80
- ]
81
- } );
82
- }
83
-
84
- conversion.for( 'upcast' ).add( viewToModelImageAttributeConverter( dataFilter ) );
85
- conversion.for( 'downcast' ).add( modelToViewImageAttributeConverter() );
86
-
87
- evt.stop();
88
- } );
89
- }
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get requires() {
20
+ return [DataFilter];
21
+ }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName() {
26
+ return 'ImageElementSupport';
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init() {
32
+ const editor = this.editor;
33
+ // At least one image plugin should be loaded for the integration to work properly.
34
+ if (!editor.plugins.has('ImageInlineEditing') && !editor.plugins.has('ImageBlockEditing')) {
35
+ return;
36
+ }
37
+ const schema = editor.model.schema;
38
+ const conversion = editor.conversion;
39
+ const dataFilter = editor.plugins.get(DataFilter);
40
+ dataFilter.on('register:figure', () => {
41
+ conversion.for('upcast').add(viewToModelFigureAttributeConverter(dataFilter));
42
+ });
43
+ dataFilter.on('register:img', (evt, definition) => {
44
+ if (definition.model !== 'imageBlock' && definition.model !== 'imageInline') {
45
+ return;
46
+ }
47
+ if (schema.isRegistered('imageBlock')) {
48
+ schema.extend('imageBlock', {
49
+ allowAttributes: [
50
+ 'htmlAttributes',
51
+ // Figure and Link don't have model counterpart.
52
+ // We will preserve attributes on image model element using these attribute keys.
53
+ 'htmlFigureAttributes',
54
+ 'htmlLinkAttributes'
55
+ ]
56
+ });
57
+ }
58
+ if (schema.isRegistered('imageInline')) {
59
+ schema.extend('imageInline', {
60
+ allowAttributes: [
61
+ // `htmlA` is needed for standard GHS link integration.
62
+ 'htmlA',
63
+ 'htmlAttributes'
64
+ ]
65
+ });
66
+ }
67
+ conversion.for('upcast').add(viewToModelImageAttributeConverter(dataFilter));
68
+ conversion.for('downcast').add(modelToViewImageAttributeConverter());
69
+ evt.stop();
70
+ });
71
+ }
90
72
  }
91
-
92
- // View-to-model conversion helper preserving allowed attributes on the {@link module:image/image~Image Image}
93
- // feature model element.
94
- //
95
- // @private
96
- // @param {module:html-support/datafilter~DataFilter} dataFilter
97
- // @returns {Function} Returns a conversion callback.
98
- function viewToModelImageAttributeConverter( dataFilter ) {
99
- return dispatcher => {
100
- dispatcher.on( 'element:img', ( evt, data, conversionApi ) => {
101
- if ( !data.modelRange ) {
102
- return;
103
- }
104
-
105
- const viewImageElement = data.viewItem;
106
- const viewContainerElement = viewImageElement.parent;
107
-
108
- preserveElementAttributes( viewImageElement, 'htmlAttributes' );
109
-
110
- if ( viewContainerElement.is( 'element', 'a' ) ) {
111
- preserveLinkAttributes( viewContainerElement );
112
- }
113
-
114
- function preserveElementAttributes( viewElement, attributeName ) {
115
- const viewAttributes = dataFilter.processViewAttributes( viewElement, conversionApi );
116
-
117
- if ( viewAttributes ) {
118
- conversionApi.writer.setAttribute( attributeName, viewAttributes, data.modelRange );
119
- }
120
- }
121
-
122
- function preserveLinkAttributes( viewContainerElement ) {
123
- if ( data.modelRange && data.modelRange.getContainedElement().is( 'element', 'imageBlock' ) ) {
124
- preserveElementAttributes( viewContainerElement, 'htmlLinkAttributes' );
125
- }
126
- }
127
- }, { priority: 'low' } );
128
- };
73
+ /**
74
+ * View-to-model conversion helper preserving allowed attributes on the {@link module:image/image~Image Image}
75
+ * feature model element.
76
+ *
77
+ * @returns Returns a conversion callback.
78
+ */
79
+ function viewToModelImageAttributeConverter(dataFilter) {
80
+ return (dispatcher) => {
81
+ dispatcher.on('element:img', (evt, data, conversionApi) => {
82
+ if (!data.modelRange) {
83
+ return;
84
+ }
85
+ const viewImageElement = data.viewItem;
86
+ const viewContainerElement = viewImageElement.parent;
87
+ preserveElementAttributes(viewImageElement, 'htmlAttributes');
88
+ if (viewContainerElement.is('element', 'a')) {
89
+ preserveLinkAttributes(viewContainerElement);
90
+ }
91
+ function preserveElementAttributes(viewElement, attributeName) {
92
+ const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);
93
+ if (viewAttributes) {
94
+ conversionApi.writer.setAttribute(attributeName, viewAttributes, data.modelRange);
95
+ }
96
+ }
97
+ function preserveLinkAttributes(viewContainerElement) {
98
+ if (data.modelRange && data.modelRange.getContainedElement().is('element', 'imageBlock')) {
99
+ preserveElementAttributes(viewContainerElement, 'htmlLinkAttributes');
100
+ }
101
+ }
102
+ }, { priority: 'low' });
103
+ };
129
104
  }
130
-
131
- // View-to-model conversion helper preserving allowed attributes on {@link module:image/image~Image Image}
132
- // feature model element from figure view element.
133
- //
134
- // @private
135
- // @param {module:html-support/datafilter~DataFilter} dataFilter
136
- // @returns {Function} Returns a conversion callback.
137
- function viewToModelFigureAttributeConverter( dataFilter ) {
138
- return dispatcher => {
139
- dispatcher.on( 'element:figure', ( evt, data, conversionApi ) => {
140
- const viewFigureElement = data.viewItem;
141
-
142
- if ( !data.modelRange || !viewFigureElement.hasClass( 'image' ) ) {
143
- return;
144
- }
145
-
146
- const viewAttributes = dataFilter.processViewAttributes( viewFigureElement, conversionApi );
147
-
148
- if ( viewAttributes ) {
149
- conversionApi.writer.setAttribute( 'htmlFigureAttributes', viewAttributes, data.modelRange );
150
- }
151
- }, { priority: 'low' } );
152
- };
105
+ /**
106
+ * View-to-model conversion helper preserving allowed attributes on {@link module:image/image~Image Image}
107
+ * feature model element from figure view element.
108
+ *
109
+ * @returns Returns a conversion callback.
110
+ */
111
+ function viewToModelFigureAttributeConverter(dataFilter) {
112
+ return (dispatcher) => {
113
+ dispatcher.on('element:figure', (evt, data, conversionApi) => {
114
+ const viewFigureElement = data.viewItem;
115
+ if (!data.modelRange || !viewFigureElement.hasClass('image')) {
116
+ return;
117
+ }
118
+ const viewAttributes = dataFilter.processViewAttributes(viewFigureElement, conversionApi);
119
+ if (viewAttributes) {
120
+ conversionApi.writer.setAttribute('htmlFigureAttributes', viewAttributes, data.modelRange);
121
+ }
122
+ }, { priority: 'low' });
123
+ };
153
124
  }
154
-
155
- // A model-to-view conversion helper applying attributes from the {@link module:image/image~Image Image}
156
- // feature.
157
- //
158
- // @private
159
- // @returns {Function} Returns a conversion callback.
125
+ /**
126
+ * A model-to-view conversion helper applying attributes from the {@link module:image/image~Image Image}
127
+ * feature.
128
+ * @returns Returns a conversion callback.
129
+ */
160
130
  function modelToViewImageAttributeConverter() {
161
- return dispatcher => {
162
- addInlineAttributeConversion( 'htmlAttributes' );
163
-
164
- addBlockAttributeConversion( 'img', 'htmlAttributes' );
165
- addBlockAttributeConversion( 'figure', 'htmlFigureAttributes' );
166
- addBlockAttributeConversion( 'a', 'htmlLinkAttributes' );
167
-
168
- function addInlineAttributeConversion( attributeName ) {
169
- dispatcher.on( `attribute:${ attributeName }:imageInline`, ( evt, data, conversionApi ) => {
170
- if ( !conversionApi.consumable.consume( data.item, evt.name ) ) {
171
- return;
172
- }
173
-
174
- const { attributeOldValue, attributeNewValue } = data;
175
- const viewElement = conversionApi.mapper.toViewElement( data.item );
176
-
177
- updateViewAttributes( conversionApi.writer, attributeOldValue, attributeNewValue, viewElement );
178
- }, { priority: 'low' } );
179
- }
180
-
181
- function addBlockAttributeConversion( elementName, attributeName ) {
182
- dispatcher.on( `attribute:${ attributeName }:imageBlock`, ( evt, data, conversionApi ) => {
183
- if ( !conversionApi.consumable.test( data.item, evt.name ) ) {
184
- return;
185
- }
186
-
187
- const { attributeOldValue, attributeNewValue } = data;
188
- const containerElement = conversionApi.mapper.toViewElement( data.item );
189
- const viewElement = getDescendantElement( conversionApi.writer, containerElement, elementName );
190
-
191
- if ( viewElement ) {
192
- updateViewAttributes( conversionApi.writer, attributeOldValue, attributeNewValue, viewElement );
193
- conversionApi.consumable.consume( data.item, evt.name );
194
- }
195
- }, { priority: 'low' } );
196
-
197
- if ( elementName === 'a' ) {
198
- // To have a link element in the view, we need to attach a converter to the `linkHref` attribute as well.
199
- dispatcher.on( 'attribute:linkHref:imageBlock', ( evt, data, conversionApi ) => {
200
- if ( !conversionApi.consumable.consume( data.item, 'attribute:htmlLinkAttributes:imageBlock' ) ) {
201
- return;
202
- }
203
-
204
- const containerElement = conversionApi.mapper.toViewElement( data.item );
205
- const viewElement = getDescendantElement( conversionApi.writer, containerElement, 'a' );
206
-
207
- setViewAttributes( conversionApi.writer, data.item.getAttribute( 'htmlLinkAttributes' ), viewElement );
208
- }, { priority: 'low' } );
209
- }
210
- }
211
- };
212
- }
213
-
214
- // Returns the first view element descendant matching the given view name.
215
- // Includes view element itself.
216
- //
217
- // @private
218
- // @param {module:engine/view/downcastwriter~DowncastWriter} writer
219
- // @param {module:engine/view/element~Element} containerElement
220
- // @param {String} elementName
221
- // @returns {module:engine/view/element~Element|null}
222
- function getDescendantElement( writer, containerElement, elementName ) {
223
- const range = writer.createRangeOn( containerElement );
224
-
225
- for ( const { item } of range.getWalker() ) {
226
- if ( item.is( 'element', elementName ) ) {
227
- return item;
228
- }
229
- }
131
+ return (dispatcher) => {
132
+ addInlineAttributeConversion('htmlAttributes');
133
+ addBlockAttributeConversion('img', 'htmlAttributes');
134
+ addBlockAttributeConversion('figure', 'htmlFigureAttributes');
135
+ addBlockAttributeConversion('a', 'htmlLinkAttributes');
136
+ function addInlineAttributeConversion(attributeName) {
137
+ dispatcher.on(`attribute:${attributeName}:imageInline`, (evt, data, conversionApi) => {
138
+ if (!conversionApi.consumable.consume(data.item, evt.name)) {
139
+ return;
140
+ }
141
+ const { attributeOldValue, attributeNewValue } = data;
142
+ const viewElement = conversionApi.mapper.toViewElement(data.item);
143
+ updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);
144
+ }, { priority: 'low' });
145
+ }
146
+ function addBlockAttributeConversion(elementName, attributeName) {
147
+ dispatcher.on(`attribute:${attributeName}:imageBlock`, (evt, data, conversionApi) => {
148
+ if (!conversionApi.consumable.test(data.item, evt.name)) {
149
+ return;
150
+ }
151
+ const { attributeOldValue, attributeNewValue } = data;
152
+ const containerElement = conversionApi.mapper.toViewElement(data.item);
153
+ const viewElement = getDescendantElement(conversionApi.writer, containerElement, elementName);
154
+ if (viewElement) {
155
+ updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);
156
+ conversionApi.consumable.consume(data.item, evt.name);
157
+ }
158
+ }, { priority: 'low' });
159
+ if (elementName === 'a') {
160
+ // To have a link element in the view, we need to attach a converter to the `linkHref` attribute as well.
161
+ dispatcher.on('attribute:linkHref:imageBlock', (evt, data, conversionApi) => {
162
+ if (!conversionApi.consumable.consume(data.item, 'attribute:htmlLinkAttributes:imageBlock')) {
163
+ return;
164
+ }
165
+ const containerElement = conversionApi.mapper.toViewElement(data.item);
166
+ const viewElement = getDescendantElement(conversionApi.writer, containerElement, 'a');
167
+ setViewAttributes(conversionApi.writer, data.item.getAttribute('htmlLinkAttributes'), viewElement);
168
+ }, { priority: 'low' });
169
+ }
170
+ }
171
+ };
230
172
  }
@@ -0,0 +1,15 @@
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
+ import type { DowncastWriter, ViewElement } from 'ckeditor5/src/engine';
6
+ /**
7
+ * @module html-support/integrations/integrationutils
8
+ */
9
+ /**
10
+ * Returns the first view element descendant matching the given view name.
11
+ * Includes view element itself.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare function getDescendantElement(writer: DowncastWriter, containerElement: ViewElement, elementName: string): ViewElement | undefined;
@@ -0,0 +1,21 @@
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/integrations/integrationutils
7
+ */
8
+ /**
9
+ * Returns the first view element descendant matching the given view name.
10
+ * Includes view element itself.
11
+ *
12
+ * @internal
13
+ */
14
+ export function getDescendantElement(writer, containerElement, elementName) {
15
+ const range = writer.createRangeOn(containerElement);
16
+ for (const { item } of range.getWalker()) {
17
+ if (item.is('element', elementName)) {
18
+ return item;
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,25 @@
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/integrations/mediaembed
7
+ */
8
+ import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
9
+ /**
10
+ * Provides the General HTML Support integration with {@link module:media-embed/mediaembed~MediaEmbed Media Embed} feature.
11
+ */
12
+ export default class MediaEmbedElementSupport extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get requires(): PluginDependencies;
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName(): 'MediaEmbedElementSupport';
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ init(): void;
25
+ }