Skip to main content

Media

Plugin alias: media

editor42.init({
plugins: 'media'
});

Enables inserting and editing embedded media content such as video, audio, iframes, and embed/object elements. Media elements are replaced with placeholder images for safe editing in the editor, then restored on serialization. Supports live embed previews, custom URL resolvers, and template callbacks.

Options​

OptionTypeDefaultDescription
audio_template_callbackfunction—Custom HTML for audio.
video_template_callbackfunction—Custom HTML for video.
iframe_template_callbackfunction—Custom HTML for iframes.
media_live_embedsbooleantrueLive preview in editor.
media_filter_htmlbooleantrueSanitize embed HTML.
media_url_resolverfunction—Async URL-to-embed resolver.
media_alt_sourcebooleantrueShow alt source field.
media_posterbooleantrueShow poster field.
media_dimensionsbooleantrueShow width/height.

Commands​

CommandDescription
editor42MediaOpens media dialog.

Toolbar buttons​

ButtonTypeDescription
mediaToggle buttonActive when media is selected.
ItemDescription
mediaOpens media dialog.

API​

MethodDescription
showDialog()Programmatically opens the media dialog.