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
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 = { [options.elementName], [options.renderMediaPreview], [options.renderForEditingView] } ) → 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 : Object
-
Properties
[ options.elementName ] : String
[ options.renderMediaPreview ] : Boolean
[ options.renderForEditingView ] : Boolean
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
Media | null
The
Media
instance ornull
when there is none.
-
_getUrlMatches( url, pattern ) → Array | null
module:media-embed/mediaregistry~MediaRegistry#_getUrlMatches
private
Tries to match
url
topattern
.Parameters
url : String
The URL of the media.
pattern : RegExp
The pattern that should accept the media URL.
Returns
Array | null
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.