@ckeditor/ckeditor5-media-embed 48.2.0-alpha.7 → 48.3.0-alpha.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 (183) hide show
  1. package/ckeditor5-metadata.json +1 -1
  2. package/dist/augmentation.d.ts +33 -31
  3. package/dist/automediaembed.d.ts +50 -50
  4. package/dist/converters.d.ts +37 -37
  5. package/dist/index-editor.css +26 -0
  6. package/dist/index.css +26 -0
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.d.ts +29 -26
  9. package/dist/index.js +2601 -1956
  10. package/dist/index.js.map +1 -1
  11. package/dist/mediaembed.d.ts +33 -33
  12. package/dist/mediaembedcommand.d.ts +32 -32
  13. package/dist/mediaembedconfig.d.ts +564 -483
  14. package/dist/mediaembedediting.d.ts +30 -30
  15. package/dist/mediaembedresize/constants.d.ts +13 -13
  16. package/dist/mediaembedresize/mediaembedcustomresizeui.d.ts +64 -0
  17. package/dist/mediaembedresize/mediaembedresizebuttons.d.ts +54 -0
  18. package/dist/mediaembedresize/mediaembedresizeediting.d.ts +47 -43
  19. package/dist/mediaembedresize/mediaembedresizehandles.d.ts +38 -38
  20. package/dist/mediaembedresize/resizemediaembedcommand.d.ts +35 -35
  21. package/dist/mediaembedresize/ui/mediaembedcustomresizeformview.d.ts +118 -0
  22. package/dist/mediaembedresize/utils/getselectedmediaembededitornodes.d.ts +23 -0
  23. package/dist/mediaembedresize/utils/getselectedmediaembedpossibleresizerange.d.ts +25 -0
  24. package/dist/mediaembedresize/utils/getselectedmediaembedwidthinunits.d.ts +21 -0
  25. package/dist/mediaembedresize.d.ts +28 -25
  26. package/dist/mediaembedstyle/constants.d.ts +22 -22
  27. package/dist/mediaembedstyle/mediaembedstylecommand.d.ts +67 -67
  28. package/dist/mediaembedstyle/mediaembedstyleediting.d.ts +39 -39
  29. package/dist/mediaembedstyle/mediaembedstyleui.d.ts +76 -76
  30. package/dist/mediaembedstyle/utils.d.ts +18 -18
  31. package/dist/mediaembedstyle.d.ts +29 -29
  32. package/dist/mediaembedtoolbar.d.ts +28 -28
  33. package/dist/mediaembedui.d.ts +33 -33
  34. package/dist/mediaregistry.d.ts +59 -59
  35. package/dist/translations/af.js +1 -1
  36. package/dist/translations/af.umd.js +1 -1
  37. package/dist/translations/ar.js +1 -1
  38. package/dist/translations/ar.umd.js +1 -1
  39. package/dist/translations/ast.js +1 -1
  40. package/dist/translations/ast.umd.js +1 -1
  41. package/dist/translations/az.js +1 -1
  42. package/dist/translations/az.umd.js +1 -1
  43. package/dist/translations/be.js +1 -1
  44. package/dist/translations/be.umd.js +1 -1
  45. package/dist/translations/bg.js +1 -1
  46. package/dist/translations/bg.umd.js +1 -1
  47. package/dist/translations/bn.js +1 -1
  48. package/dist/translations/bn.umd.js +1 -1
  49. package/dist/translations/bs.js +1 -1
  50. package/dist/translations/bs.umd.js +1 -1
  51. package/dist/translations/ca.js +1 -1
  52. package/dist/translations/ca.umd.js +1 -1
  53. package/dist/translations/cs.js +1 -1
  54. package/dist/translations/cs.umd.js +1 -1
  55. package/dist/translations/da.js +1 -1
  56. package/dist/translations/da.umd.js +1 -1
  57. package/dist/translations/de-ch.js +1 -1
  58. package/dist/translations/de-ch.umd.js +1 -1
  59. package/dist/translations/de.js +1 -1
  60. package/dist/translations/de.umd.js +1 -1
  61. package/dist/translations/el.js +1 -1
  62. package/dist/translations/el.umd.js +1 -1
  63. package/dist/translations/en-au.js +1 -1
  64. package/dist/translations/en-au.umd.js +1 -1
  65. package/dist/translations/en-gb.js +1 -1
  66. package/dist/translations/en-gb.umd.js +1 -1
  67. package/dist/translations/en.js +1 -1
  68. package/dist/translations/en.umd.js +1 -1
  69. package/dist/translations/eo.js +1 -1
  70. package/dist/translations/eo.umd.js +1 -1
  71. package/dist/translations/es-co.js +1 -1
  72. package/dist/translations/es-co.umd.js +1 -1
  73. package/dist/translations/es.js +1 -1
  74. package/dist/translations/es.umd.js +1 -1
  75. package/dist/translations/et.js +1 -1
  76. package/dist/translations/et.umd.js +1 -1
  77. package/dist/translations/eu.js +1 -1
  78. package/dist/translations/eu.umd.js +1 -1
  79. package/dist/translations/fa.js +1 -1
  80. package/dist/translations/fa.umd.js +1 -1
  81. package/dist/translations/fi.js +1 -1
  82. package/dist/translations/fi.umd.js +1 -1
  83. package/dist/translations/fr.js +1 -1
  84. package/dist/translations/fr.umd.js +1 -1
  85. package/dist/translations/gl.js +1 -1
  86. package/dist/translations/gl.umd.js +1 -1
  87. package/dist/translations/gu.js +1 -1
  88. package/dist/translations/gu.umd.js +1 -1
  89. package/dist/translations/he.js +1 -1
  90. package/dist/translations/he.umd.js +1 -1
  91. package/dist/translations/hi.js +1 -1
  92. package/dist/translations/hi.umd.js +1 -1
  93. package/dist/translations/hr.js +1 -1
  94. package/dist/translations/hr.umd.js +1 -1
  95. package/dist/translations/hu.js +1 -1
  96. package/dist/translations/hu.umd.js +1 -1
  97. package/dist/translations/hy.js +1 -1
  98. package/dist/translations/hy.umd.js +1 -1
  99. package/dist/translations/id.js +1 -1
  100. package/dist/translations/id.umd.js +1 -1
  101. package/dist/translations/it.js +1 -1
  102. package/dist/translations/it.umd.js +1 -1
  103. package/dist/translations/ja.js +1 -1
  104. package/dist/translations/ja.umd.js +1 -1
  105. package/dist/translations/jv.js +1 -1
  106. package/dist/translations/jv.umd.js +1 -1
  107. package/dist/translations/kk.js +1 -1
  108. package/dist/translations/kk.umd.js +1 -1
  109. package/dist/translations/km.js +1 -1
  110. package/dist/translations/km.umd.js +1 -1
  111. package/dist/translations/kn.js +1 -1
  112. package/dist/translations/kn.umd.js +1 -1
  113. package/dist/translations/ko.js +1 -1
  114. package/dist/translations/ko.umd.js +1 -1
  115. package/dist/translations/ku.js +1 -1
  116. package/dist/translations/ku.umd.js +1 -1
  117. package/dist/translations/lt.js +1 -1
  118. package/dist/translations/lt.umd.js +1 -1
  119. package/dist/translations/lv.js +1 -1
  120. package/dist/translations/lv.umd.js +1 -1
  121. package/dist/translations/ms.js +1 -1
  122. package/dist/translations/ms.umd.js +1 -1
  123. package/dist/translations/nb.js +1 -1
  124. package/dist/translations/nb.umd.js +1 -1
  125. package/dist/translations/ne.js +1 -1
  126. package/dist/translations/ne.umd.js +1 -1
  127. package/dist/translations/nl.js +1 -1
  128. package/dist/translations/nl.umd.js +1 -1
  129. package/dist/translations/no.js +1 -1
  130. package/dist/translations/no.umd.js +1 -1
  131. package/dist/translations/oc.js +1 -1
  132. package/dist/translations/oc.umd.js +1 -1
  133. package/dist/translations/pl.js +1 -1
  134. package/dist/translations/pl.umd.js +1 -1
  135. package/dist/translations/pt-br.js +1 -1
  136. package/dist/translations/pt-br.umd.js +1 -1
  137. package/dist/translations/pt.js +1 -1
  138. package/dist/translations/pt.umd.js +1 -1
  139. package/dist/translations/ro.js +1 -1
  140. package/dist/translations/ro.umd.js +1 -1
  141. package/dist/translations/ru.js +1 -1
  142. package/dist/translations/ru.umd.js +1 -1
  143. package/dist/translations/si.js +1 -1
  144. package/dist/translations/si.umd.js +1 -1
  145. package/dist/translations/sk.js +1 -1
  146. package/dist/translations/sk.umd.js +1 -1
  147. package/dist/translations/sl.js +1 -1
  148. package/dist/translations/sl.umd.js +1 -1
  149. package/dist/translations/sq.js +1 -1
  150. package/dist/translations/sq.umd.js +1 -1
  151. package/dist/translations/sr-latn.js +1 -1
  152. package/dist/translations/sr-latn.umd.js +1 -1
  153. package/dist/translations/sr.js +1 -1
  154. package/dist/translations/sr.umd.js +1 -1
  155. package/dist/translations/sv.js +1 -1
  156. package/dist/translations/sv.umd.js +1 -1
  157. package/dist/translations/th.js +1 -1
  158. package/dist/translations/th.umd.js +1 -1
  159. package/dist/translations/ti.js +1 -1
  160. package/dist/translations/ti.umd.js +1 -1
  161. package/dist/translations/tk.js +1 -1
  162. package/dist/translations/tk.umd.js +1 -1
  163. package/dist/translations/tr.js +1 -1
  164. package/dist/translations/tr.umd.js +1 -1
  165. package/dist/translations/tt.js +1 -1
  166. package/dist/translations/tt.umd.js +1 -1
  167. package/dist/translations/ug.js +1 -1
  168. package/dist/translations/ug.umd.js +1 -1
  169. package/dist/translations/uk.js +1 -1
  170. package/dist/translations/uk.umd.js +1 -1
  171. package/dist/translations/ur.js +1 -1
  172. package/dist/translations/ur.umd.js +1 -1
  173. package/dist/translations/uz.js +1 -1
  174. package/dist/translations/uz.umd.js +1 -1
  175. package/dist/translations/vi.js +1 -1
  176. package/dist/translations/vi.umd.js +1 -1
  177. package/dist/translations/zh-cn.js +1 -1
  178. package/dist/translations/zh-cn.umd.js +1 -1
  179. package/dist/translations/zh.js +1 -1
  180. package/dist/translations/zh.umd.js +1 -1
  181. package/dist/ui/mediaformview.d.ts +83 -83
  182. package/dist/utils.d.ts +61 -61
  183. package/package.json +10 -10
@@ -1,501 +1,582 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module media-embed/mediaembedconfig
7
- */
8
- import type { ToolbarConfigItem } from '@ckeditor/ckeditor5-core';
9
- import type { ArrayOrItem } from '@ckeditor/ckeditor5-utils';
6
+ * @module media-embed/mediaembedconfig
7
+ */
8
+ import type { ToolbarConfigItem } from "@ckeditor/ckeditor5-core";
9
+ import type { ArrayOrItem } from "@ckeditor/ckeditor5-utils";
10
10
  /**
11
- * The configuration of the media embed features.
12
- *
13
- * Read more about {@glink features/media-embed/media-embed-configuration configuring the media embed feature}.
14
- *
15
- * ```ts
16
- * ClassicEditor
17
- * .create( {
18
- * mediaEmbed: ... // Media embed feature options.
19
- * } )
20
- * .then( ... )
21
- * .catch( ... );
22
- * ```
23
- *
24
- * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
25
- */
11
+ * The configuration of the media embed features.
12
+ *
13
+ * Read more about {@glink features/media-embed/media-embed-configuration configuring the media embed feature}.
14
+ *
15
+ * ```ts
16
+ * ClassicEditor
17
+ * .create( {
18
+ * mediaEmbed: ... // Media embed feature options.
19
+ * } )
20
+ * .then( ... )
21
+ * .catch( ... );
22
+ * ```
23
+ *
24
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
25
+ */
26
26
  export interface MediaEmbedConfig {
27
- /**
28
- * The default media providers supported by the editor.
29
- *
30
- * The names of providers with rendering functions (previews):
31
- *
32
- * * "dailymotion",
33
- * * "spotify",
34
- * * "youtube",
35
- * * "vimeo"
36
- *
37
- * The names of providers without rendering functions:
38
- *
39
- * * "instagram",
40
- * * "twitter",
41
- * * "googleMaps",
42
- * * "flickr",
43
- * * "facebook"
44
- *
45
- * See the {@link module:media-embed/mediaembedconfig~MediaEmbedProvider provider syntax} to learn more about
46
- * different kinds of media and media providers.
47
- *
48
- * **Note**: The default media provider configuration may not support all possible media URLs,
49
- * only the most common are included.
50
- *
51
- * Media without rendering functions are always represented in the data using the "semantic" markup. See
52
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`} to
53
- * learn more about possible data outputs.
54
- *
55
- * The priority of media providers corresponds to the order of configuration. The first provider
56
- * to match the URL is always used, even if there are other providers that support a particular URL.
57
- * The URL is never matched against the remaining providers.
58
- *
59
- * To discard **all** default media providers, simply override this configuration with your own
60
- * {@link module:media-embed/mediaembedconfig~MediaEmbedProvider definitions}:
61
- *
62
- * ```ts
63
- * ClassicEditor
64
- * .create( {
65
- * plugins: [ MediaEmbed, ... ],
66
- * mediaEmbed: {
67
- * providers: [
68
- * {
69
- * name: 'myProvider',
70
- * url: /^example\.com\/media\/(\w+)/,
71
- * html: match => '...'
72
- * },
73
- * ...
74
- * ]
75
- * }
76
- * } )
77
- * .then( ... )
78
- * .catch( ... );
79
- * ```
80
- *
81
- * You can take inspiration from the default configuration of this feature which you can find in:
82
- * https://github.com/ckeditor/ckeditor5-media-embed/blob/master/src/mediaembedediting.js
83
- *
84
- * To **extend** the list of default providers, use
85
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}.
86
- *
87
- * To **remove** certain providers, use
88
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#removeProviders `config.mediaEmbed.removeProviders`}.
89
- */
90
- providers?: Array<MediaEmbedProvider>;
91
- /**
92
- * The additional media providers supported by the editor. This configuration helps extend the default
93
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers}.
94
- *
95
- * ```ts
96
- * ClassicEditor
97
- * .create( {
98
- * plugins: [ MediaEmbed, ... ],
99
- * mediaEmbed: {
100
- * extraProviders: [
101
- * {
102
- * name: 'extraProvider',
103
- * url: /^example\.com\/media\/(\w+)/,
104
- * html: match => '...'
105
- * },
106
- * ...
107
- * ]
108
- * }
109
- * } )
110
- * .then( ... )
111
- * .catch( ... );
112
- * ```
113
- *
114
- * See the {@link module:media-embed/mediaembedconfig~MediaEmbedProvider provider syntax} to learn more.
115
- */
116
- extraProviders?: Array<MediaEmbedProvider>;
117
- /**
118
- * The list of media providers that should not be used despite being available in
119
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`} and
120
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}
121
- *
122
- * ```ts
123
- * mediaEmbed: {
124
- * removeProviders: [ 'youtube', 'twitter' ]
125
- * }
126
- * ```
127
- */
128
- removeProviders?: Array<string>;
129
- /**
130
- * Overrides the element name used for "semantic" data.
131
- *
132
- * This is not relevant if
133
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`} is set to `true`.
134
- *
135
- * When not set, the feature produces the `<oembed>` tag:
136
- *
137
- * ```html
138
- * <figure class="media">
139
- * <oembed url="https://url"></oembed>
140
- * </figure>
141
- * ```
142
- *
143
- * To override the element name with, for instance, the `o-embed` name:
144
- *
145
- * ```ts
146
- * mediaEmbed: {
147
- * elementName: 'o-embed'
148
- * }
149
- * ```
150
- *
151
- * This will produce semantic data with the `<o-embed>` tag:
152
- *
153
- * ```html
154
- * <figure class="media">
155
- * <o-embed url="https://url"></o-embed>
156
- * </figure>
157
- * ```
158
- *
159
- * @default 'oembed'
160
- */
161
- elementName?: string;
162
- /**
163
- * Controls the data format produced by the feature.
164
- *
165
- * When `false` (default), the feature produces "semantic" data, i.e. it does not include the preview of
166
- * the media, just the `<oembed>` tag with the `url` attribute:
167
- *
168
- * ```ts
169
- * <figure class="media">
170
- * <oembed url="https://url"></oembed>
171
- * </figure>
172
- * ```
173
- *
174
- * When `true`, the media is represented in the output in the same way it looks in the editor,
175
- * i.e. the media preview is saved to the database:
176
- *
177
- * ```ts
178
- * <figure class="media">
179
- * <div data-oembed-url="https://url">
180
- * <iframe src="https://preview"></iframe>
181
- * </div>
182
- * </figure>
183
- * ```
184
- *
185
- * **Note:** Media without preview are always represented in the data using the "semantic" markup
186
- * regardless of the value of the `previewsInData`. Learn more about different kinds of media
187
- * in the {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`}
188
- * configuration description.
189
- *
190
- * @default false
191
- */
192
- previewsInData?: boolean;
193
- /**
194
- * Items to be placed in the media embed toolbar.
195
- * This option requires adding {@link module:media-embed/mediaembedtoolbar~MediaEmbedToolbar} to the plugin list.
196
- *
197
- * Each entry is one of:
198
- *
199
- * * a component name (string) — including the built-in alignment buttons (e.g. `'mediaEmbed:alignCenter'`)
200
- * and built-in dropdowns (`'mediaEmbed:wrapText'`, `'mediaEmbed:breakText'`),
201
- * * a custom split-button media style dropdown definition (object) following the
202
- * {@link module:media-embed/mediaembedconfig~MediaStyleDropdownDefinition} shape — registered
203
- * alongside the built-in dropdowns and inheriting the same auto-skip / fallback-defaultItem behavior,
204
- * * a generic nested toolbar grouping (`{ label, items }`) — same shape as in
205
- * {@link module:core/editor/editorconfig~EditorConfig#toolbar `config.toolbar`}.
206
- *
207
- * ```ts
208
- * mediaEmbed: {
209
- * toolbar: [
210
- * 'mediaEmbed:alignCenter',
211
- * {
212
- * name: 'mediaEmbed:myAlignments',
213
- * title: 'Alignment',
214
- * items: [ 'mediaEmbed:alignBlockLeft', 'mediaEmbed:alignBlockRight' ],
215
- * defaultItem: 'mediaEmbed:alignBlockLeft'
216
- * }
217
- * ]
218
- * }
219
- * ```
220
- */
221
- toolbar?: Array<ToolbarConfigItem | MediaStyleDropdownDefinition>;
222
- /**
223
- * The {@link module:media-embed/mediaembedstyle~MediaEmbedStyle media embed style} feature configuration.
224
- *
225
- * Available out of the box: five built-in alignment styles — `'alignLeft'`, `'alignBlockLeft'`,
226
- * `'alignCenter'` (default), `'alignBlockRight'`, `'alignRight'`.
227
- *
228
- * Restrict the set to a subset of built-ins:
229
- *
230
- * ```ts
231
- * mediaEmbed: {
232
- * styles: {
233
- * options: [ 'alignBlockLeft', 'alignCenter', 'alignBlockRight' ]
234
- * }
235
- * }
236
- * ```
237
- *
238
- * Override fields of a built-in by re-declaring with the same `name`:
239
- *
240
- * ```ts
241
- * mediaEmbed: {
242
- * styles: {
243
- * options: [
244
- * { name: 'alignCenter', title: 'Center' },
245
- * 'alignLeft',
246
- * 'alignRight'
247
- * ]
248
- * }
249
- * }
250
- * ```
251
- *
252
- * Register a custom (e.g. semantical) style by supplying a complete definition:
253
- *
254
- * ```ts
255
- * import sideIcon from 'path/to/icon.svg';
256
- *
257
- * mediaEmbed: {
258
- * styles: {
259
- * options: [
260
- * 'alignCenter',
261
- * {
262
- * name: 'side',
263
- * title: 'Side media',
264
- * icon: sideIcon,
265
- * className: 'media-style-side'
266
- * }
267
- * ]
268
- * }
269
- * }
270
- * ```
271
- *
272
- * When omitted, all five built-in styles are available.
273
- */
274
- styles?: MediaStyleConfig;
27
+ /**
28
+ * The default media providers supported by the editor.
29
+ *
30
+ * The names of providers with rendering functions (previews):
31
+ *
32
+ * * "dailymotion",
33
+ * * "spotify",
34
+ * * "youtube",
35
+ * * "vimeo"
36
+ *
37
+ * The names of providers without rendering functions:
38
+ *
39
+ * * "instagram",
40
+ * * "twitter",
41
+ * * "googleMaps",
42
+ * * "flickr",
43
+ * * "facebook"
44
+ *
45
+ * See the {@link module:media-embed/mediaembedconfig~MediaEmbedProvider provider syntax} to learn more about
46
+ * different kinds of media and media providers.
47
+ *
48
+ * **Note**: The default media provider configuration may not support all possible media URLs,
49
+ * only the most common are included.
50
+ *
51
+ * Media without rendering functions are always represented in the data using the "semantic" markup. See
52
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`} to
53
+ * learn more about possible data outputs.
54
+ *
55
+ * The priority of media providers corresponds to the order of configuration. The first provider
56
+ * to match the URL is always used, even if there are other providers that support a particular URL.
57
+ * The URL is never matched against the remaining providers.
58
+ *
59
+ * To discard **all** default media providers, simply override this configuration with your own
60
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedProvider definitions}:
61
+ *
62
+ * ```ts
63
+ * ClassicEditor
64
+ * .create( {
65
+ * plugins: [ MediaEmbed, ... ],
66
+ * mediaEmbed: {
67
+ * providers: [
68
+ * {
69
+ * name: 'myProvider',
70
+ * url: /^example\.com\/media\/(\w+)/,
71
+ * html: match => '...'
72
+ * },
73
+ * ...
74
+ * ]
75
+ * }
76
+ * } )
77
+ * .then( ... )
78
+ * .catch( ... );
79
+ * ```
80
+ *
81
+ * You can take inspiration from the default configuration of this feature which you can find in:
82
+ * https://github.com/ckeditor/ckeditor5-media-embed/blob/master/src/mediaembedediting.js
83
+ *
84
+ * To **extend** the list of default providers, use
85
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}.
86
+ *
87
+ * To **remove** certain providers, use
88
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#removeProviders `config.mediaEmbed.removeProviders`}.
89
+ */
90
+ providers?: Array<MediaEmbedProvider>;
91
+ /**
92
+ * The additional media providers supported by the editor. This configuration helps extend the default
93
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers}.
94
+ *
95
+ * ```ts
96
+ * ClassicEditor
97
+ * .create( {
98
+ * plugins: [ MediaEmbed, ... ],
99
+ * mediaEmbed: {
100
+ * extraProviders: [
101
+ * {
102
+ * name: 'extraProvider',
103
+ * url: /^example\.com\/media\/(\w+)/,
104
+ * html: match => '...'
105
+ * },
106
+ * ...
107
+ * ]
108
+ * }
109
+ * } )
110
+ * .then( ... )
111
+ * .catch( ... );
112
+ * ```
113
+ *
114
+ * See the {@link module:media-embed/mediaembedconfig~MediaEmbedProvider provider syntax} to learn more.
115
+ */
116
+ extraProviders?: Array<MediaEmbedProvider>;
117
+ /**
118
+ * The list of media providers that should not be used despite being available in
119
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`} and
120
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}
121
+ *
122
+ * ```ts
123
+ * mediaEmbed: {
124
+ * removeProviders: [ 'youtube', 'twitter' ]
125
+ * }
126
+ * ```
127
+ */
128
+ removeProviders?: Array<string>;
129
+ /**
130
+ * Overrides the element name used for "semantic" data.
131
+ *
132
+ * This is not relevant if
133
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`} is set to `true`.
134
+ *
135
+ * When not set, the feature produces the `<oembed>` tag:
136
+ *
137
+ * ```html
138
+ * <figure class="media">
139
+ * <oembed url="https://url"></oembed>
140
+ * </figure>
141
+ * ```
142
+ *
143
+ * To override the element name with, for instance, the `o-embed` name:
144
+ *
145
+ * ```ts
146
+ * mediaEmbed: {
147
+ * elementName: 'o-embed'
148
+ * }
149
+ * ```
150
+ *
151
+ * This will produce semantic data with the `<o-embed>` tag:
152
+ *
153
+ * ```html
154
+ * <figure class="media">
155
+ * <o-embed url="https://url"></o-embed>
156
+ * </figure>
157
+ * ```
158
+ *
159
+ * @default 'oembed'
160
+ */
161
+ elementName?: string;
162
+ /**
163
+ * Controls the data format produced by the feature.
164
+ *
165
+ * When `false` (default), the feature produces "semantic" data, i.e. it does not include the preview of
166
+ * the media, just the `<oembed>` tag with the `url` attribute:
167
+ *
168
+ * ```ts
169
+ * <figure class="media">
170
+ * <oembed url="https://url"></oembed>
171
+ * </figure>
172
+ * ```
173
+ *
174
+ * When `true`, the media is represented in the output in the same way it looks in the editor,
175
+ * i.e. the media preview is saved to the database:
176
+ *
177
+ * ```ts
178
+ * <figure class="media">
179
+ * <div data-oembed-url="https://url">
180
+ * <iframe src="https://preview"></iframe>
181
+ * </div>
182
+ * </figure>
183
+ * ```
184
+ *
185
+ * **Note:** Media without preview are always represented in the data using the "semantic" markup
186
+ * regardless of the value of the `previewsInData`. Learn more about different kinds of media
187
+ * in the {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`}
188
+ * configuration description.
189
+ *
190
+ * @default false
191
+ */
192
+ previewsInData?: boolean;
193
+ /**
194
+ * Items to be placed in the media embed toolbar.
195
+ * This option requires adding {@link module:media-embed/mediaembedtoolbar~MediaEmbedToolbar} to the plugin list.
196
+ *
197
+ * Each entry is one of:
198
+ *
199
+ * * a component name (string) — including the built-in alignment buttons (e.g. `'mediaEmbed:alignCenter'`)
200
+ * and built-in dropdowns (`'mediaEmbed:wrapText'`, `'mediaEmbed:breakText'`),
201
+ * * a custom split-button media style dropdown definition (object) following the
202
+ * {@link module:media-embed/mediaembedconfig~MediaStyleDropdownDefinition} shape — registered
203
+ * alongside the built-in dropdowns and inheriting the same auto-skip / fallback-defaultItem behavior,
204
+ * * a generic nested toolbar grouping (`{ label, items }`) — same shape as in
205
+ * {@link module:core/editor/editorconfig~EditorConfig#toolbar `config.toolbar`}.
206
+ *
207
+ * ```ts
208
+ * mediaEmbed: {
209
+ * toolbar: [
210
+ * 'mediaEmbed:alignCenter',
211
+ * {
212
+ * name: 'mediaEmbed:myAlignments',
213
+ * title: 'Alignment',
214
+ * items: [ 'mediaEmbed:alignBlockLeft', 'mediaEmbed:alignBlockRight' ],
215
+ * defaultItem: 'mediaEmbed:alignBlockLeft'
216
+ * }
217
+ * ]
218
+ * }
219
+ * ```
220
+ */
221
+ toolbar?: Array<ToolbarConfigItem | MediaStyleDropdownDefinition>;
222
+ /**
223
+ * The {@link module:media-embed/mediaembedstyle~MediaEmbedStyle media embed style} feature configuration.
224
+ *
225
+ * Available out of the box: five built-in alignment styles — `'alignLeft'`, `'alignBlockLeft'`,
226
+ * `'alignCenter'` (default), `'alignBlockRight'`, `'alignRight'`.
227
+ *
228
+ * Restrict the set to a subset of built-ins:
229
+ *
230
+ * ```ts
231
+ * mediaEmbed: {
232
+ * styles: {
233
+ * options: [ 'alignBlockLeft', 'alignCenter', 'alignBlockRight' ]
234
+ * }
235
+ * }
236
+ * ```
237
+ *
238
+ * Override fields of a built-in by re-declaring with the same `name`:
239
+ *
240
+ * ```ts
241
+ * mediaEmbed: {
242
+ * styles: {
243
+ * options: [
244
+ * { name: 'alignCenter', title: 'Center' },
245
+ * 'alignLeft',
246
+ * 'alignRight'
247
+ * ]
248
+ * }
249
+ * }
250
+ * ```
251
+ *
252
+ * Register a custom (e.g. semantical) style by supplying a complete definition:
253
+ *
254
+ * ```ts
255
+ * import sideIcon from 'path/to/icon.svg';
256
+ *
257
+ * mediaEmbed: {
258
+ * styles: {
259
+ * options: [
260
+ * 'alignCenter',
261
+ * {
262
+ * name: 'side',
263
+ * title: 'Side media',
264
+ * icon: sideIcon,
265
+ * className: 'media-style-side'
266
+ * }
267
+ * ]
268
+ * }
269
+ * }
270
+ * ```
271
+ *
272
+ * When omitted, all five built-in styles are available.
273
+ */
274
+ styles?: MediaStyleConfig;
275
+ /**
276
+ * The resize unit applied to the media width.
277
+ *
278
+ * Possible values: `'%'` (default) or `'px'`.
279
+ *
280
+ * ```ts
281
+ * mediaEmbed: {
282
+ * resizeUnit: 'px'
283
+ * }
284
+ * ```
285
+ *
286
+ * @default '%'
287
+ */
288
+ resizeUnit?: "px" | "%";
289
+ /**
290
+ * The available media resize options.
291
+ *
292
+ * Used to populate the resize dropdown (`'resizeMediaEmbed'`) or the standalone resize buttons
293
+ * (`'resizeMediaEmbed:25'`, `'resizeMediaEmbed:original'`, etc.) placed in
294
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#toolbar `config.mediaEmbed.toolbar`}.
295
+ *
296
+ * Example — dropdown form:
297
+ *
298
+ * ```ts
299
+ * mediaEmbed: {
300
+ * toolbar: [ 'resizeMediaEmbed' ],
301
+ * resizeOptions: [
302
+ * { name: 'resizeMediaEmbed:original', value: null, icon: 'original' },
303
+ * { name: 'resizeMediaEmbed:25', value: '25', icon: 'small' },
304
+ * { name: 'resizeMediaEmbed:50', value: '50', icon: 'medium' },
305
+ * { name: 'resizeMediaEmbed:75', value: '75', icon: 'large' },
306
+ * { name: 'resizeMediaEmbed:custom', value: 'custom', icon: 'custom' }
307
+ * ]
308
+ * }
309
+ * ```
310
+ *
311
+ * Example — standalone buttons form:
312
+ *
313
+ * ```ts
314
+ * mediaEmbed: {
315
+ * toolbar: [ 'resizeMediaEmbed:25', 'resizeMediaEmbed:50', 'resizeMediaEmbed:75',
316
+ * 'resizeMediaEmbed:original', 'resizeMediaEmbed:custom' ],
317
+ * resizeOptions: [
318
+ * { name: 'resizeMediaEmbed:original', value: null, icon: 'original' },
319
+ * { name: 'resizeMediaEmbed:custom', value: 'custom', icon: 'custom' },
320
+ * { name: 'resizeMediaEmbed:25', value: '25', icon: 'small' },
321
+ * { name: 'resizeMediaEmbed:50', value: '50', icon: 'medium' },
322
+ * { name: 'resizeMediaEmbed:75', value: '75', icon: 'large' }
323
+ * ]
324
+ * }
325
+ * ```
326
+ */
327
+ resizeOptions?: Array<MediaEmbedResizeOption>;
275
328
  }
276
329
  /**
277
- * The configuration for the {@link module:media-embed/mediaembedstyle~MediaEmbedStyle} feature.
278
- *
279
- * See {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`}
280
- * for details and examples.
281
- */
330
+ * The media embed resize option used in the
331
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#resizeOptions `config.mediaEmbed.resizeOptions`} configuration.
332
+ */
333
+ export interface MediaEmbedResizeOption {
334
+ /**
335
+ * The name of the UI component that changes the media size.
336
+ * When placing individual resize buttons in the toolbar, reference this name directly.
337
+ * When using the dropdown, this name is used for the corresponding list item.
338
+ */
339
+ name: string;
340
+ /**
341
+ * The numeric resize value without the unit
342
+ * ({@link module:media-embed/mediaembedconfig~MediaEmbedConfig#resizeUnit configured separately}).
343
+ * `null` resets the media to its original (unresized) width. `'custom'` opens the custom-size balloon.
344
+ */
345
+ value: string | null;
346
+ /**
347
+ * The icon displayed on the button. Available icons: `'small'`, `'medium'`, `'large'`, `'original'`, `'custom'`.
348
+ */
349
+ icon?: string;
350
+ /**
351
+ * The option label shown in the dropdown or used as button tooltip and ARIA label.
352
+ * When not specified, the label is generated automatically from the `value` and
353
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#resizeUnit `config.mediaEmbed.resizeUnit`}.
354
+ */
355
+ label?: string;
356
+ }
357
+ /**
358
+ * The configuration for the {@link module:media-embed/mediaembedstyle~MediaEmbedStyle} feature.
359
+ *
360
+ * See {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`}
361
+ * for details and examples.
362
+ */
282
363
  export interface MediaStyleConfig {
283
- /**
284
- * A list of media style options. Each entry is either:
285
- *
286
- * * a string referencing a built-in style by name (`'alignLeft'`, `'alignBlockLeft'`,
287
- * `'alignCenter'`, `'alignBlockRight'`, `'alignRight'`),
288
- * * an object overriding fields of a built-in (matched by `name`),
289
- * * an object defining a new custom style.
290
- *
291
- * Defaults to all five built-in styles when omitted.
292
- */
293
- options?: Array<string | MediaStyleOptionDefinition>;
364
+ /**
365
+ * A list of media style options. Each entry is either:
366
+ *
367
+ * * a string referencing a built-in style by name (`'alignLeft'`, `'alignBlockLeft'`,
368
+ * `'alignCenter'`, `'alignBlockRight'`, `'alignRight'`),
369
+ * * an object overriding fields of a built-in (matched by `name`),
370
+ * * an object defining a new custom style.
371
+ *
372
+ * Defaults to all five built-in styles when omitted.
373
+ */
374
+ options?: Array<string | MediaStyleOptionDefinition>;
294
375
  }
295
376
  /**
296
- * The definition of a single media style option used by the
297
- * {@link module:media-embed/mediaembedstyle~MediaEmbedStyle media embed style} feature.
298
- *
299
- * To customize a built-in style, re-declare it with the same `name` — only the fields
300
- * you set will be replaced; the rest are inherited from the built-in. To register a
301
- * brand-new style, provide a fresh `name` and a complete definition (`title`, `icon`,
302
- * and — unless `isDefault: true` — `className`).
303
- *
304
- * ```ts
305
- * import sideIcon from 'path/to/icon.svg';
306
- *
307
- * const sideStyle = {
308
- * name: 'side',
309
- * title: 'Side media',
310
- * icon: sideIcon,
311
- * className: 'media-style-side'
312
- * };
313
- * ```
314
- *
315
- * Each option registers a toggle button under the name `'mediaEmbed:{name}'` in the
316
- * {@link module:ui/componentfactory~ComponentFactory UI component factory}.
317
- */
377
+ * The definition of a single media style option used by the
378
+ * {@link module:media-embed/mediaembedstyle~MediaEmbedStyle media embed style} feature.
379
+ *
380
+ * To customize a built-in style, re-declare it with the same `name` — only the fields
381
+ * you set will be replaced; the rest are inherited from the built-in. To register a
382
+ * brand-new style, provide a fresh `name` and a complete definition (`title`, `icon`,
383
+ * and — unless `isDefault: true` — `className`).
384
+ *
385
+ * ```ts
386
+ * import sideIcon from 'path/to/icon.svg';
387
+ *
388
+ * const sideStyle = {
389
+ * name: 'side',
390
+ * title: 'Side media',
391
+ * icon: sideIcon,
392
+ * className: 'media-style-side'
393
+ * };
394
+ * ```
395
+ *
396
+ * Each option registers a toggle button under the name `'mediaEmbed:{name}'` in the
397
+ * {@link module:ui/componentfactory~ComponentFactory UI component factory}.
398
+ */
318
399
  export interface MediaStyleOptionDefinition {
319
- /**
320
- * The unique style name. It is used to:
321
- *
322
- * * reference a built-in style or define a custom one,
323
- * * store the chosen style in the model as the `mediaStyle` attribute,
324
- * * register the toolbar button under `'mediaEmbed:{name}'`.
325
- */
326
- name: string;
327
- /**
328
- * The button title. The title is wrapped in `editor.t()` at button creation,
329
- * so titles that match keys in the official translation set will be localized
330
- * automatically.
331
- *
332
- * Required when defining a custom style. Inherited from the built-in style with
333
- * the matching `name` when overriding a built-in.
334
- */
335
- title?: string;
336
- /**
337
- * The button icon. Either an SVG XML source string, or one of the keys in
338
- * `DEFAULT_ICONS` (`'inlineLeft'`, `'left'`, `'center'`, `'right'`, `'inlineRight'`)
339
- * to use one of the icons shipped with the plugin.
340
- *
341
- * Required when defining a custom style. Inherited from the built-in style with
342
- * the matching `name` when overriding a built-in.
343
- */
344
- icon?: string;
345
- /**
346
- * The CSS class added to the view `<figure>` when this style is applied. Required
347
- * for every non-default style — default styles are encoded as the absence of the
348
- * `mediaStyle` attribute, so they intentionally have no class.
349
- *
350
- * Inherited from the built-in style with the matching `name` when not set.
351
- */
352
- className?: string;
353
- /**
354
- * When `true`, this style is the default state — applying it removes the
355
- * `mediaStyle` attribute from the model element (no class is written to the view).
356
- * Default styles must not define a `className`.
357
- *
358
- * Inherited from the built-in style with the matching `name` when not set.
359
- */
360
- isDefault?: boolean;
400
+ /**
401
+ * The unique style name. It is used to:
402
+ *
403
+ * * reference a built-in style or define a custom one,
404
+ * * store the chosen style in the model as the `mediaStyle` attribute,
405
+ * * register the toolbar button under `'mediaEmbed:{name}'`.
406
+ */
407
+ name: string;
408
+ /**
409
+ * The button title. The title is wrapped in `editor.t()` at button creation,
410
+ * so titles that match keys in the official translation set will be localized
411
+ * automatically.
412
+ *
413
+ * Required when defining a custom style. Inherited from the built-in style with
414
+ * the matching `name` when overriding a built-in.
415
+ */
416
+ title?: string;
417
+ /**
418
+ * The button icon. Either an SVG XML source string, or one of the keys in
419
+ * `DEFAULT_ICONS` (`'inlineLeft'`, `'left'`, `'center'`, `'right'`, `'inlineRight'`)
420
+ * to use one of the icons shipped with the plugin.
421
+ *
422
+ * Required when defining a custom style. Inherited from the built-in style with
423
+ * the matching `name` when overriding a built-in.
424
+ */
425
+ icon?: string;
426
+ /**
427
+ * The CSS class added to the view `<figure>` when this style is applied. Required
428
+ * for every non-default style — default styles are encoded as the absence of the
429
+ * `mediaStyle` attribute, so they intentionally have no class.
430
+ *
431
+ * Inherited from the built-in style with the matching `name` when not set.
432
+ */
433
+ className?: string;
434
+ /**
435
+ * When `true`, this style is the default state — applying it removes the
436
+ * `mediaStyle` attribute from the model element (no class is written to the view).
437
+ * Default styles must not define a `className`.
438
+ *
439
+ * Inherited from the built-in style with the matching `name` when not set.
440
+ */
441
+ isDefault?: boolean;
361
442
  }
362
443
  /**
363
- * A media style option resolved by the normalizer — built-in inheritance has been applied
364
- * and {@link module:media-embed/mediaembedstyle/utils~normalizeStyles} has already verified
365
- * the required fields. UI and editing internals consume this shape.
366
- *
367
- * @internal
368
- */
369
- export type NormalizedMediaStyleOption = Required<Pick<MediaStyleOptionDefinition, 'name' | 'title' | 'icon'>> & Pick<MediaStyleOptionDefinition, 'className' | 'isDefault'>;
444
+ * A media style option resolved by the normalizer — built-in inheritance has been applied
445
+ * and {@link module:media-embed/mediaembedstyle/utils~normalizeStyles} has already verified
446
+ * the required fields. UI and editing internals consume this shape.
447
+ *
448
+ * @internal
449
+ */
450
+ export type NormalizedMediaStyleOption = Required<Pick<MediaStyleOptionDefinition, "name" | "title" | "icon">> & Pick<MediaStyleOptionDefinition, "className" | "isDefault">;
370
451
  /**
371
- * The definition of a split-button dropdown that groups several media style buttons.
372
- *
373
- * Integrators can declare custom dropdowns inline in
374
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#toolbar `config.mediaEmbed.toolbar`}
375
- * alongside button-name strings; `defaultItem` is the discriminator that distinguishes a
376
- * split-button media style dropdown from a generic toolbar grouping.
377
- *
378
- * ```ts
379
- * mediaEmbed: {
380
- * toolbar: [
381
- * 'mediaEmbed:alignCenter',
382
- * {
383
- * name: 'mediaEmbed:myAlignments',
384
- * title: 'Alignment',
385
- * items: [ 'mediaEmbed:alignBlockLeft', 'mediaEmbed:alignBlockRight' ],
386
- * defaultItem: 'mediaEmbed:alignBlockLeft'
387
- * }
388
- * ]
389
- * }
390
- * ```
391
- *
392
- * All names (`name`, `items[]`, `defaultItem`) use the full prefixed component-factory form.
393
- * Items referencing styles that are not in the resolved
394
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`} list
395
- * are filtered out at registration time. A dropdown that ends up with fewer than two items is
396
- * skipped. If the configured `defaultItem` was filtered out, the first surviving item is used.
397
- */
452
+ * The definition of a split-button dropdown that groups several media style buttons.
453
+ *
454
+ * Integrators can declare custom dropdowns inline in
455
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#toolbar `config.mediaEmbed.toolbar`}
456
+ * alongside button-name strings; `defaultItem` is the discriminator that distinguishes a
457
+ * split-button media style dropdown from a generic toolbar grouping.
458
+ *
459
+ * ```ts
460
+ * mediaEmbed: {
461
+ * toolbar: [
462
+ * 'mediaEmbed:alignCenter',
463
+ * {
464
+ * name: 'mediaEmbed:myAlignments',
465
+ * title: 'Alignment',
466
+ * items: [ 'mediaEmbed:alignBlockLeft', 'mediaEmbed:alignBlockRight' ],
467
+ * defaultItem: 'mediaEmbed:alignBlockLeft'
468
+ * }
469
+ * ]
470
+ * }
471
+ * ```
472
+ *
473
+ * All names (`name`, `items[]`, `defaultItem`) use the full prefixed component-factory form.
474
+ * Items referencing styles that are not in the resolved
475
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#styles `config.mediaEmbed.styles`} list
476
+ * are filtered out at registration time. A dropdown that ends up with fewer than two items is
477
+ * skipped. If the configured `defaultItem` was filtered out, the first surviving item is used.
478
+ */
398
479
  export interface MediaStyleDropdownDefinition {
399
- /**
400
- * The dropdown name. Registered as-is in the UI component factory, so it must use the
401
- * `mediaEmbed:` prefix (for example, `'mediaEmbed:myAlignments'`).
402
- */
403
- name: string;
404
- /**
405
- * The dropdown title, used both for the split-button label and the dropdown arrow tooltip.
406
- */
407
- title: string;
408
- /**
409
- * Prefixed style names included in the dropdown (for example,
410
- * `[ 'mediaEmbed:alignBlockLeft', 'mediaEmbed:alignBlockRight' ]`).
411
- */
412
- items: Array<string>;
413
- /**
414
- * The default child whose icon and label the split button mirrors when no child is active.
415
- * Must be one of the `items`.
416
- */
417
- defaultItem: string;
480
+ /**
481
+ * The dropdown name. Registered as-is in the UI component factory, so it must use the
482
+ * `mediaEmbed:` prefix (for example, `'mediaEmbed:myAlignments'`).
483
+ */
484
+ name: string;
485
+ /**
486
+ * The dropdown title, used both for the split-button label and the dropdown arrow tooltip.
487
+ */
488
+ title: string;
489
+ /**
490
+ * Prefixed style names included in the dropdown (for example,
491
+ * `[ 'mediaEmbed:alignBlockLeft', 'mediaEmbed:alignBlockRight' ]`).
492
+ */
493
+ items: Array<string>;
494
+ /**
495
+ * The default child whose icon and label the split button mirrors when no child is active.
496
+ * Must be one of the `items`.
497
+ */
498
+ defaultItem: string;
418
499
  }
419
500
  /**
420
- * The media embed provider descriptor. Used in
421
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`} and
422
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}.
423
- *
424
- * See {@link module:media-embed/mediaembedconfig~MediaEmbedConfig} to learn more.
425
- *
426
- * ```ts
427
- * {
428
- * name: 'example',
429
- *
430
- * // The following RegExp matches https://www.example.com/media/{media id},
431
- * // (either with "http(s)://" and "www" or without), so the valid URLs are:
432
- * //
433
- * // * https://www.example.com/media/{media id},
434
- * // * http://www.example.com/media/{media id},
435
- * // * www.example.com/media/{media id},
436
- * // * example.com/media/{media id}
437
- * url: /^example\.com\/media\/(\w+)/,
438
- *
439
- * // The rendering function of the provider.
440
- * // Used to represent the media when editing the content (i.e. in the view)
441
- * // and also in the data output of the editor if semantic data output is disabled.
442
- * html: match => `The HTML representing the media with ID=${ match[ 1 ] }.`
443
- * }
444
- * ```
445
- *
446
- * You can allow any sort of media in the editor using the "allow–all" `RegExp`.
447
- * But mind that, since URLs are processed in the order of configuration, if one of the previous
448
- * `RegExps` matches the URL, it will have a precedence over this one.
449
- *
450
- * ```ts
451
- * {
452
- * name: 'allow-all',
453
- * url: /^.+/
454
- * }
455
- * ```
456
- *
457
- * To implement responsive media, set an `aspect-ratio` on the iframe. The HTML `width` and
458
- * `height` attributes act as the intrinsic size (useful for layout hints in containers like
459
- * table cells), while CSS `width: 100%` and `height: auto` make the element scale with its
460
- * container while preserving the declared aspect ratio. The iframe is wrapped in a plain
461
- * `<div>` so external styles or queries that target this wrapper continue to work:
462
- *
463
- * ```ts
464
- * {
465
- * ...
466
- * html: match =>
467
- * '<div>' +
468
- * `<iframe src="..." width="1280" height="720" ` +
469
- * `style="width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; display: block;" ` +
470
- * 'frameborder="0" allowfullscreen>' +
471
- * '</iframe>' +
472
- * '</div>'
473
- * }
474
- * ```
475
- */
501
+ * The media embed provider descriptor. Used in
502
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`} and
503
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}.
504
+ *
505
+ * See {@link module:media-embed/mediaembedconfig~MediaEmbedConfig} to learn more.
506
+ *
507
+ * ```ts
508
+ * {
509
+ * name: 'example',
510
+ *
511
+ * // The following RegExp matches https://www.example.com/media/{media id},
512
+ * // (either with "http(s)://" and "www" or without), so the valid URLs are:
513
+ * //
514
+ * // * https://www.example.com/media/{media id},
515
+ * // * http://www.example.com/media/{media id},
516
+ * // * www.example.com/media/{media id},
517
+ * // * example.com/media/{media id}
518
+ * url: /^example\.com\/media\/(\w+)/,
519
+ *
520
+ * // The rendering function of the provider.
521
+ * // Used to represent the media when editing the content (i.e. in the view)
522
+ * // and also in the data output of the editor if semantic data output is disabled.
523
+ * html: match => `The HTML representing the media with ID=${ match[ 1 ] }.`
524
+ * }
525
+ * ```
526
+ *
527
+ * You can allow any sort of media in the editor using the "allow–all" `RegExp`.
528
+ * But mind that, since URLs are processed in the order of configuration, if one of the previous
529
+ * `RegExps` matches the URL, it will have a precedence over this one.
530
+ *
531
+ * ```ts
532
+ * {
533
+ * name: 'allow-all',
534
+ * url: /^.+/
535
+ * }
536
+ * ```
537
+ *
538
+ * To implement responsive media, set an `aspect-ratio` on the iframe. The HTML `width` and
539
+ * `height` attributes act as the intrinsic size (useful for layout hints in containers like
540
+ * table cells), while CSS `width: 100%` and `height: auto` make the element scale with its
541
+ * container while preserving the declared aspect ratio. The iframe is wrapped in a plain
542
+ * `<div>` so external styles or queries that target this wrapper continue to work:
543
+ *
544
+ * ```ts
545
+ * {
546
+ * ...
547
+ * html: match =>
548
+ * '<div>' +
549
+ * `<iframe src="..." width="1280" height="720" ` +
550
+ * `style="width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; display: block;" ` +
551
+ * 'frameborder="0" allowfullscreen>' +
552
+ * '</iframe>' +
553
+ * '</div>'
554
+ * }
555
+ * ```
556
+ */
476
557
  export interface MediaEmbedProvider {
477
- /**
478
- * The name of the provider. Used e.g. when
479
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#removeProviders removing providers}.
480
- */
481
- name: string;
482
- /**
483
- * The `RegExp` object (or array of objects) defining the URL of the media.
484
- * If any URL matches the `RegExp`, it becomes the media in the editor model, as defined by the provider. The result
485
- * of matching (output of `String.prototype.match()`) is passed to the `html` rendering function of the media.
486
- *
487
- * **Note:** You do not need to include the protocol (`http://`, `https://`) and `www` subdomain in your `RegExps`,
488
- * they are stripped from the URLs before matching anyway.
489
- */
490
- url: ArrayOrItem<RegExp>;
491
- /**
492
- * The rendering function of the media. The function receives the entire matching
493
- * array from the corresponding `url` `RegExp` as an argument, allowing rendering a dedicated
494
- * preview of the media identified by a certain ID or a hash. When not defined, the media embed feature
495
- * will use a generic media representation in the view and output data.
496
- * Note that when
497
- * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`}
498
- * is `true`, the rendering function **will always** be used for the media in the editor data output.
499
- */
500
- html?: (match: RegExpMatchArray) => string;
558
+ /**
559
+ * The name of the provider. Used e.g. when
560
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#removeProviders removing providers}.
561
+ */
562
+ name: string;
563
+ /**
564
+ * The `RegExp` object (or array of objects) defining the URL of the media.
565
+ * If any URL matches the `RegExp`, it becomes the media in the editor model, as defined by the provider. The result
566
+ * of matching (output of `String.prototype.match()`) is passed to the `html` rendering function of the media.
567
+ *
568
+ * **Note:** You do not need to include the protocol (`http://`, `https://`) and `www` subdomain in your `RegExps`,
569
+ * they are stripped from the URLs before matching anyway.
570
+ */
571
+ url: ArrayOrItem<RegExp>;
572
+ /**
573
+ * The rendering function of the media. The function receives the entire matching
574
+ * array from the corresponding `url` `RegExp` as an argument, allowing rendering a dedicated
575
+ * preview of the media identified by a certain ID or a hash. When not defined, the media embed feature
576
+ * will use a generic media representation in the view and output data.
577
+ * Note that when
578
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`}
579
+ * is `true`, the rendering function **will always** be used for the media in the editor data output.
580
+ */
581
+ html?: (match: RegExpMatchArray) => string;
501
582
  }