1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import type { DowncastWriter, ViewElement } from 'ckeditor5/src/engine';
|
9 | import { type Locale } from 'ckeditor5/src/utils';
|
10 | import type { MediaEmbedConfig, MediaEmbedProvider } from './mediaembedconfig';
|
11 | import type { MediaOptions } from './utils';
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | export default class MediaRegistry {
|
20 | |
21 |
|
22 |
|
23 | locale: Locale;
|
24 | |
25 |
|
26 |
|
27 |
|
28 | providerDefinitions: Array<MediaEmbedProvider>;
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
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 | }
|