1.2.0 • Published 3d ago
@richhtmleditor/templates
Licence
MIT
Version
1.2.0
Deps
1
Size
26 kB
Vulns
0
Weekly
0
@richhtmleditor/templates
Document templates plugin for Rich HTML Editor. Adds an Insert Template toolbar tool with a gallery of pre-built document templates — report, letter, memo, resume, and more. Built on @richhtmleditor/core.
Current release: 1.2.0 — Depends on @richhtmleditor/core ^1.2.0.
Repository: github.com/rajkishorsahu89/richhtmleditor
Demo: richhtmleditor.vercel.app — demo · guide · API
What's in 1.2.0
createTemplatesPlugin— registers theinsertTemplatetoolbar tool- Template gallery — grid of pre-built templates with preview thumbnails
- Built-in templates — report, letter, memo, resume, meeting notes
- Custom templates — register your own HTML templates with title and thumbnail
- One-click insert — select a template to replace or append to the document
Community feature — no enterprise licence required.
Keywords: richhtmleditor templates document report letter wysiwyg
Install
npm install @richhtmleditor/templates
# Requires @richhtmleditor/core (via framework wrapper or direct install).Usage
import { createEditor } from "@richhtmleditor/core";
import { createTemplatesPlugin } from "@richhtmleditor/templates";
const editor = createEditor({
element: host,
toolbar: { preset: "full" },
plugins: [createTemplatesPlugin()]
});Angular
import { createTemplatesPlugin } from "@richhtmleditor/templates";
plugins = [createTemplatesPlugin()];<richhtmleditor [plugins]="plugins" [toolbar]="{ preset: 'full' }" />Custom templates
createTemplatesPlugin({
templates: [
{
id: "invoice",
title: "Invoice",
html: "<h1>Invoice</h1><table>...</table>"
}
]
})API
createTemplatesPlugin(options?)
Returns an EditorPlugin that registers the insertTemplate toolbar tool.
| Option | Type | Description |
|---|---|---|
templates |
TemplateDefinition[]? |
Additional custom templates to include in the gallery. |
replaceContent |
boolean? |
Replace document content on insert (default: true). |
TemplateDefinition
| Field | Type | Description |
|---|---|---|
id |
string |
Unique template identifier. |
title |
string |
Display name in the gallery. |
html |
string |
HTML content of the template. |
thumbnail |
string? |
Optional thumbnail image URL or data URL. |
Related packages
@richhtmleditor/core— editor engine and plugins API.@richhtmleditor/themes— shared CSS.@richhtmleditor/export— DOCX/PDF export plugin.@richhtmleditor/angular— Angular wrapper.@richhtmleditor/react— React wrapper.