MediaRegistry (media-embed)
@ckeditor/ckeditor5-media-embed/src/mediaregistry
A bridge between the raw media content provider definitions and the editor view content.
It helps translating media URLs to corresponding view elements.
Mostly used by the MediaEmbedEditing
plugin.
Filtering
Properties
-
The
Locale
instance. -
providerDefinitions : Array<MediaEmbedProvider>
module:media-embed/mediaregistry~MediaRegistry#providerDefinitions
The media provider definitions available for the registry. Usually corresponding with the media configuration.
Methods
-
constructor( locale, config )
module:media-embed/mediaregistry~MediaRegistry#constructor
Creates an instance of the
MediaRegistry
class.Parameters
locale : Locale
The localization services instance.
config : MediaEmbedConfig
The configuration of the media embed feature.
-
getMediaViewElement( writer, url, options ) → Element
module:media-embed/mediaregistry~MediaRegistry#getMediaViewElement
For the given media URL string and options, it returns the view element representing that media.
Note: If no URL is specified, an empty view element is returned.
Parameters
writer : DowncastWriter
The view writer used to produce a view element.
url : string
The URL to be translated into a view element.
options : MediaOptions
Returns
-
hasMedia( url ) → boolean
module:media-embed/mediaregistry~MediaRegistry#hasMedia
Checks whether the passed URL is representing a certain media type allowed in the editor.
Parameters
url : string
The URL to be checked
Returns
boolean
-
Returns a
Media
instance for the given URL.Parameters
url : string
The URL of the media.
Returns
null | Media
The
Media
instance ornull
when there is none.
-
private
_getUrlMatches( url, pattern ) → null | RegExpMatchArray
module:media-embed/mediaregistry~MediaRegistry#_getUrlMatches
Tries to match
url
topattern
.Parameters
url : string
The URL of the media.
pattern : RegExp
The pattern that should accept the media URL.
Returns
null | RegExpMatchArray
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.