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
| Option | Type | Default | Description |
|---|---|---|---|
template_cdate_classes | string | 'cdate' | CSS classes for creation date elements. |
template_mdate_classes | string | 'mdate' | CSS classes for modification date elements. |
template_selected_content_classes | string | 'selcontent' | CSS classes for selected-content placeholders. |
template_preview_replace_values | object | — | Key-value map for preview substitutions. |
template_replace_values | object | — | Key-value map for insertion substitutions. |
templates | string/object[]/function | [] | Template source. |
template_cdate_format | string | '%Y-%m-%d' | Creation date format. |
template_mdate_format | string | '%Y-%m-%d' | Modification date format. |
Commands
| Command | Description |
|---|---|
editor42InsertTemplate | Inserts template HTML with variable substitution. |
editor42Template | Opens template selection dialog. |
Toolbar buttons
| Button | Type | Description |
|---|---|---|
template | Button | Opens template selection dialog. |
Menu items
| Item | Description |
|---|---|
template | Opens template selection dialog. |