Skip to main content

Template

Plugin alias: template

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

Allows inserting predefined HTML templates into the editor. Templates can be specified as an inline array, a URL to a JSON endpoint, or a callback function. Supports special placeholder classes for creation date, modification date, and selected content replacement, plus {$variable} substitution syntax.

Options​

OptionTypeDefaultDescription
template_cdate_classesstringcdateCSS classes for creation date elements.
template_mdate_classesstringmdateCSS classes for modification date elements.
template_selected_content_classesstringselcontentCSS classes for selected-content placeholders.
template_preview_replace_valuesobject—Key-value map for preview substitutions.
template_replace_valuesobject—Key-value map for insertion substitutions.
templatesstring/object[]/function[]Template source.
template_cdate_formatstring%Y-%m-%dCreation date format.
template_mdate_formatstring%Y-%m-%dModification date format.

Commands​

CommandDescription
editor42InsertTemplateInserts template HTML with variable substitution.
editor42TemplateOpens template selection dialog.

Toolbar buttons​

ButtonTypeDescription
templateButtonOpens template selection dialog.
ItemDescription
templateOpens template selection dialog.