Sign up (with export icon)

MediaRegistry

Api-class icon 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.

Properties

Methods

  • Chevron-right icon

    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.

  • Chevron-right icon

    getMediaViewElement( writer, url, options ) → ViewElement

    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 : ViewDowncastWriter

    The view writer used to produce a view element.

    url : string

    The URL to be translated into a view element.

    options : MediaOptions

    Returns

    ViewElement
  • Chevron-right icon

    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
  • Chevron-right icon

    _getMedia( url ) → null | Media
    Lock icon private

    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.

  • Chevron-right icon

    _getUrlMatches( url, pattern ) → null | RegExpMatchArray
    Lock icon private

    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