Class

MediaRegistry (media-embed)

@ckeditor/ckeditor5-media-embed/src/mediaregistry

class

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

Methods

  • constructor( locale, config )

    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

    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

    Element
  • hasMedia( url ) → boolean

    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
  • private

    _getMedia( url ) → null | Media

    Returns a Media instance for the given URL.

    Parameters

    url : string

    The URL of the media.

    Returns

    null | Media

    The Media instance or null when there is none.

  • private

    _getUrlMatches( url, pattern ) → null | RegExpMatchArray

    Tries to match url to pattern.

    Parameters

    url : string

    The URL of the media.

    pattern : RegExp

    The pattern that should accept the media URL.

    Returns

    null | RegExpMatchArray