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.
Properties
module:media-embed/mediaregistry~MediaRegistry#localeThe
Localeinstance.providerDefinitions : Array<MediaEmbedProvider>module:media-embed/mediaregistry~MediaRegistry#providerDefinitionsThe media provider definitions available for the registry. Usually corresponding with the media configuration.
Methods
constructor( locale, config )module:media-embed/mediaregistry~MediaRegistry#constructorCreates an instance of the
MediaRegistryclass.Parameters
locale : LocaleThe localization services instance.
config : MediaEmbedConfigThe configuration of the media embed feature.
getMediaViewElement( writer, url, options ) → ViewElementmodule:media-embed/mediaregistry~MediaRegistry#getMediaViewElementFor 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 : ViewDowncastWriterThe view writer used to produce a view element.
url : stringThe URL to be translated into a view element.
options : MediaOptions
Returns
hasMedia( url ) → booleanmodule:media-embed/mediaregistry~MediaRegistry#hasMediaChecks whether the passed URL is representing a certain media type allowed in the editor.
Parameters
url : stringThe URL to be checked
Returns
boolean
_getMedia( url ) → null | Mediaprivatemodule:media-embed/mediaregistry~MediaRegistry#_getMediaReturns a
Mediainstance for the given URL.Parameters
url : stringThe URL of the media.
Returns
null | MediaThe
Mediainstance ornullwhen there is none.
_getUrlMatches( url, pattern ) → null | RegExpMatchArrayprivatemodule:media-embed/mediaregistry~MediaRegistry#_getUrlMatchesTries to match
urltopattern.Parameters
url : stringThe URL of the media.
pattern : RegExpThe pattern that should accept the media URL.
Returns
null | RegExpMatchArray