MediaEmbedProvider (media-embed)
@ckeditor/ckeditor5-media-embed/src/mediaembed
The media embed provider descriptor. Used in
config.mediaEmbed.providers
and
config.mediaEmbed.extraProviders
.
See MediaEmbedConfig
to learn more.
You can allow any sort of media in the editor using the "allow–all" RegExp
.
But mind that, since URLs are processed in the order of configuration, if one of the previous
RegExps
matches the URL, it will have a precedence over this one.
To implement responsive media, you can use the following HTML structure:
Filtering
Properties
-
(optional) The rendering function of the media. The function receives the entire matching array from the corresponding
url
RegExp
as an argument, allowing rendering a dedicated preview of the media identified by a certain ID or a hash. When not defined, the media embed feature will use a generic media representation in the view and output data. Note that whenconfig.mediaEmbed.previewsInData
istrue
, the rendering function will always be used for the media in the editor data output. -
The name of the provider. Used e.g. when removing providers.
-
url : RegExp | Array.<RegExp>
The
RegExp
object (or array of objects) defining the URL of the media. If any URL matches theRegExp
, it becomes the media in the editor model, as defined by the provider. The result of matching (output ofString.prototype.match()
) is passed to thehtml
rendering function of the media.Note: You do not need to include the protocol (
http://
,https://
) andwww
subdomain in yourRegExps
, they are stripped from the URLs before matching anyway.
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.