@ckeditor/ckeditor5-media-embed 41.2.0 → 41.3.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.
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed/automediaembed
7
+ */
8
+ import { type Editor, Plugin } from 'ckeditor5/src/core.js';
9
+ import { Clipboard } from 'ckeditor5/src/clipboard.js';
10
+ import { Delete } from 'ckeditor5/src/typing.js';
11
+ import { Undo } from 'ckeditor5/src/undo.js';
12
+ /**
13
+ * The auto-media embed plugin. It recognizes media links in the pasted content and embeds
14
+ * them shortly after they are injected into the document.
15
+ */
16
+ export default class AutoMediaEmbed extends Plugin {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get requires(): readonly [typeof Clipboard, typeof Delete, typeof Undo];
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get pluginName(): "AutoMediaEmbed";
25
+ /**
26
+ * The paste–to–embed `setTimeout` ID. Stored as a property to allow
27
+ * cleaning of the timeout.
28
+ */
29
+ private _timeoutId;
30
+ /**
31
+ * The position where the `<media>` element will be inserted after the timeout,
32
+ * determined each time the new content is pasted into the document.
33
+ */
34
+ private _positionToInsert;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ constructor(editor: Editor);
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ init(): void;
43
+ /**
44
+ * Analyzes the part of the document between provided positions in search for a URL representing media.
45
+ * When the URL is found, it is automatically converted into media.
46
+ *
47
+ * @param leftPosition Left position of the selection.
48
+ * @param rightPosition Right position of the selection.
49
+ */
50
+ private _embedMediaBetweenPositions;
51
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 { DowncastDispatcher } from 'ckeditor5/src/engine.js';
6
+ import type MediaRegistry from './mediaregistry.js';
7
+ import type { MediaOptions } from './utils.js';
8
+ /**
9
+ * Returns a function that converts the model "url" attribute to the view representation.
10
+ *
11
+ * Depending on the configuration, the view representation can be "semantic" (for the data pipeline):
12
+ *
13
+ * ```html
14
+ * <figure class="media">
15
+ * <oembed url="foo"></oembed>
16
+ * </figure>
17
+ * ```
18
+ *
19
+ * or "non-semantic" (for the editing view pipeline):
20
+ *
21
+ * ```html
22
+ * <figure class="media">
23
+ * <div data-oembed-url="foo">[ non-semantic media preview for "foo" ]</div>
24
+ * </figure>
25
+ * ```
26
+ *
27
+ * **Note:** Changing the model "url" attribute replaces the entire content of the
28
+ * `<figure>` in the view.
29
+ *
30
+ * @param registry The registry providing
31
+ * the media and their content.
32
+ * @param options options object with following properties:
33
+ * - elementName When set, overrides the default element name for semantic media embeds.
34
+ * - renderMediaPreview When `true`, the converter will create the view in the non-semantic form.
35
+ * - renderForEditingView When `true`, the converter will create a view specific for the
36
+ * editing pipeline (e.g. including CSS classes, content placeholders).
37
+ */
38
+ export declare function modelToViewUrlAttributeConverter(registry: MediaRegistry, options: MediaOptions): (dispatcher: DowncastDispatcher) => void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed
7
+ */
8
+ export { default as MediaEmbed } from './mediaembed.js';
9
+ export { default as MediaEmbedEditing } from './mediaembedediting.js';
10
+ export { default as MediaEmbedUI } from './mediaembedui.js';
11
+ export { default as AutoMediaEmbed } from './automediaembed.js';
12
+ export { default as MediaEmbedToolbar } from './mediaembedtoolbar.js';
13
+ export type { MediaEmbedConfig } from './mediaembedconfig.js';
14
+ export type { default as MediaEmbedCommand } from './mediaembedcommand.js';
15
+ import './augmentation.js';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed/mediaembed
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Widget } from 'ckeditor5/src/widget.js';
10
+ import MediaEmbedEditing from './mediaembedediting.js';
11
+ import AutoMediaEmbed from './automediaembed.js';
12
+ import MediaEmbedUI from './mediaembedui.js';
13
+ import '../theme/mediaembed.css';
14
+ /**
15
+ * The media embed plugin.
16
+ *
17
+ * For a detailed overview, check the {@glink features/media-embed Media Embed feature documentation}.
18
+ *
19
+ * This is a "glue" plugin which loads the following plugins:
20
+ *
21
+ * * The {@link module:media-embed/mediaembedediting~MediaEmbedEditing media embed editing feature},
22
+ * * The {@link module:media-embed/mediaembedui~MediaEmbedUI media embed UI feature} and
23
+ * * The {@link module:media-embed/automediaembed~AutoMediaEmbed auto-media embed feature}.
24
+ */
25
+ export default class MediaEmbed extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires(): readonly [typeof MediaEmbedEditing, typeof MediaEmbedUI, typeof AutoMediaEmbed, typeof Widget];
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get pluginName(): "MediaEmbed";
34
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 { Command } from 'ckeditor5/src/core.js';
6
+ /**
7
+ * The insert media command.
8
+ *
9
+ * The command is registered by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} as `'mediaEmbed'`.
10
+ *
11
+ * To insert media at the current selection, execute the command and specify the URL:
12
+ *
13
+ * ```ts
14
+ * editor.execute( 'mediaEmbed', 'http://url.to.the/media' );
15
+ * ```
16
+ */
17
+ export default class MediaEmbedCommand extends Command {
18
+ /**
19
+ * Media url.
20
+ */
21
+ value: string | undefined;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ refresh(): void;
26
+ /**
27
+ * Executes the command, which either:
28
+ *
29
+ * * updates the URL of the selected media,
30
+ * * inserts the new media into the editor and puts the selection around it.
31
+ *
32
+ * @fires execute
33
+ * @param url The URL of the media.
34
+ */
35
+ execute(url: string): void;
36
+ }
@@ -0,0 +1,278 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 { ToolbarConfigItem } from 'ckeditor5/src/core.js';
6
+ import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
7
+ /**
8
+ * @module media-embed/mediaembedconfig
9
+ */
10
+ /**
11
+ * The configuration of the media embed features.
12
+ *
13
+ * Read more about {@glink features/media-embed#configuration configuring the media embed feature}.
14
+ *
15
+ * ```ts
16
+ * ClassicEditor
17
+ * .create( editorElement, {
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
+ 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( editorElement, {
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( editorElement, {
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
+ * @defualt 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
+ * Read more about configuring toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
198
+ */
199
+ toolbar?: Array<ToolbarConfigItem>;
200
+ }
201
+ /**
202
+ * The media embed provider descriptor. Used in
203
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#providers `config.mediaEmbed.providers`} and
204
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}.
205
+ *
206
+ * See {@link module:media-embed/mediaembedconfig~MediaEmbedConfig} to learn more.
207
+ *
208
+ * ```ts
209
+ * {
210
+ * name: 'example',
211
+ *
212
+ * // The following RegExp matches https://www.example.com/media/{media id},
213
+ * // (either with "http(s)://" and "www" or without), so the valid URLs are:
214
+ * //
215
+ * // * https://www.example.com/media/{media id},
216
+ * // * http://www.example.com/media/{media id},
217
+ * // * www.example.com/media/{media id},
218
+ * // * example.com/media/{media id}
219
+ * url: /^example\.com\/media\/(\w+)/,
220
+ *
221
+ * // The rendering function of the provider.
222
+ * // Used to represent the media when editing the content (i.e. in the view)
223
+ * // and also in the data output of the editor if semantic data output is disabled.
224
+ * html: match => `The HTML representing the media with ID=${ match[ 1 ] }.`
225
+ * }
226
+ * ```
227
+ *
228
+ * You can allow any sort of media in the editor using the "allow–all" `RegExp`.
229
+ * But mind that, since URLs are processed in the order of configuration, if one of the previous
230
+ * `RegExps` matches the URL, it will have a precedence over this one.
231
+ *
232
+ * ```ts
233
+ * {
234
+ * name: 'allow-all',
235
+ * url: /^.+/
236
+ * }
237
+ * ```
238
+ *
239
+ * To implement responsive media, you can use the following HTML structure:
240
+ *
241
+ * ```ts
242
+ * {
243
+ * ...
244
+ * html: match =>
245
+ * '<div style="position:relative; padding-bottom:100%; height:0">' +
246
+ * '<iframe src="..." frameborder="0" ' +
247
+ * 'style="position:absolute; width:100%; height:100%; top:0; left:0">' +
248
+ * '</iframe>' +
249
+ * '</div>'
250
+ * }
251
+ * ```
252
+ */
253
+ export interface MediaEmbedProvider {
254
+ /**
255
+ * The name of the provider. Used e.g. when
256
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#removeProviders removing providers}.
257
+ */
258
+ name: string;
259
+ /**
260
+ * The `RegExp` object (or array of objects) defining the URL of the media.
261
+ * If any URL matches the `RegExp`, it becomes the media in the editor model, as defined by the provider. The result
262
+ * of matching (output of `String.prototype.match()`) is passed to the `html` rendering function of the media.
263
+ *
264
+ * **Note:** You do not need to include the protocol (`http://`, `https://`) and `www` subdomain in your `RegExps`,
265
+ * they are stripped from the URLs before matching anyway.
266
+ */
267
+ url: ArrayOrItem<RegExp>;
268
+ /**
269
+ * The rendering function of the media. The function receives the entire matching
270
+ * array from the corresponding `url` `RegExp` as an argument, allowing rendering a dedicated
271
+ * preview of the media identified by a certain ID or a hash. When not defined, the media embed feature
272
+ * will use a generic media representation in the view and output data.
273
+ * Note that when
274
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`}
275
+ * is `true`, the rendering function **will always** be used for the media in the editor data output.
276
+ */
277
+ html?: (match: RegExpMatchArray) => string;
278
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed/mediaembedediting
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
+ import MediaRegistry from './mediaregistry.js';
10
+ import '../theme/mediaembedediting.css';
11
+ /**
12
+ * The media embed editing feature.
13
+ */
14
+ export default class MediaEmbedEditing extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "MediaEmbedEditing";
19
+ /**
20
+ * The media registry managing the media providers in the editor.
21
+ */
22
+ registry: MediaRegistry;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ constructor(editor: Editor);
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ init(): void;
31
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed/mediaembedtoolbar
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
10
+ import './mediaembedconfig.js';
11
+ /**
12
+ * The media embed toolbar plugin. It creates a toolbar for media embed that shows up when the media element is selected.
13
+ *
14
+ * Instances of toolbar components (e.g. buttons) are created based on the
15
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig#toolbar `media.toolbar` configuration option}.
16
+ */
17
+ export default class MediaEmbedToolbar extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires(): readonly [typeof WidgetToolbarRepository];
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "MediaEmbedToolbar";
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ afterInit(): void;
30
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed/mediaembedui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import MediaEmbedEditing from './mediaembedediting.js';
10
+ /**
11
+ * The media embed UI plugin.
12
+ */
13
+ export default class MediaEmbedUI extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get requires(): readonly [typeof MediaEmbedEditing];
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "MediaEmbedUI";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init(): void;
26
+ private _setUpDropdown;
27
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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 media-embed/mediaregistry
7
+ */
8
+ import type { DowncastWriter, ViewElement } from 'ckeditor5/src/engine.js';
9
+ import { type Locale } from 'ckeditor5/src/utils.js';
10
+ import type { MediaEmbedConfig, MediaEmbedProvider } from './mediaembedconfig.js';
11
+ import type { MediaOptions } from './utils.js';
12
+ /**
13
+ * A bridge between the raw media content provider definitions and the editor view content.
14
+ *
15
+ * It helps translating media URLs to corresponding {@link module:engine/view/element~Element view elements}.
16
+ *
17
+ * Mostly used by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} plugin.
18
+ */
19
+ export default class MediaRegistry {
20
+ /**
21
+ * The {@link module:utils/locale~Locale} instance.
22
+ */
23
+ locale: Locale;
24
+ /**
25
+ * The media provider definitions available for the registry. Usually corresponding with the
26
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig media configuration}.
27
+ */
28
+ providerDefinitions: Array<MediaEmbedProvider>;
29
+ /**
30
+ * Creates an instance of the {@link module:media-embed/mediaregistry~MediaRegistry} class.
31
+ *
32
+ * @param locale The localization services instance.
33
+ * @param config The configuration of the media embed feature.
34
+ */
35
+ constructor(locale: Locale, config: MediaEmbedConfig);
36
+ /**
37
+ * Checks whether the passed URL is representing a certain media type allowed in the editor.
38
+ *
39
+ * @param url The URL to be checked
40
+ */
41
+ hasMedia(url: string): boolean;
42
+ /**
43
+ * For the given media URL string and options, it returns the {@link module:engine/view/element~Element view element}
44
+ * representing that media.
45
+ *
46
+ * **Note:** If no URL is specified, an empty view element is returned.
47
+ *
48
+ * @param writer The view writer used to produce a view element.
49
+ * @param url The URL to be translated into a view element.
50
+ */
51
+ getMediaViewElement(writer: DowncastWriter, url: string, options: MediaOptions): ViewElement;
52
+ /**
53
+ * Returns a `Media` instance for the given URL.
54
+ *
55
+ * @param url The URL of the media.
56
+ * @returns The `Media` instance or `null` when there is none.
57
+ */
58
+ private _getMedia;
59
+ /**
60
+ * Tries to match `url` to `pattern`.
61
+ *
62
+ * @param url The URL of the media.
63
+ * @param pattern The pattern that should accept the media URL.
64
+ */
65
+ private _getUrlMatches;
66
+ }