@richhtmleditor/templates 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @richhtmleditor/templates
|
|
2
|
+
|
|
3
|
+
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`](https://www.npmjs.com/package/@richhtmleditor/core).
|
|
4
|
+
|
|
5
|
+
**Current release: 1.1.1** — Depends on `@richhtmleditor/core` **^1.1.1**.
|
|
6
|
+
|
|
7
|
+
**Repository:** [github.com/rajkishorsahu89/richhtmleditor](https://github.com/rajkishorsahu89/richhtmleditor)
|
|
8
|
+
|
|
9
|
+
**Demo:** [richhtmleditor.vercel.app](https://richhtmleditor.vercel.app/) — [demo](https://richhtmleditor.vercel.app/demo) · [guide](https://richhtmleditor.vercel.app/guide) · [API](https://richhtmleditor.vercel.app/api)
|
|
10
|
+
|
|
11
|
+
### What's in 1.1.1
|
|
12
|
+
|
|
13
|
+
- **`createTemplatesPlugin`** — registers the `insertTemplate` toolbar tool
|
|
14
|
+
- **Template gallery** — grid of pre-built templates with preview thumbnails
|
|
15
|
+
- **Built-in templates** — report, letter, memo, resume, meeting notes
|
|
16
|
+
- **Custom templates** — register your own HTML templates with title and thumbnail
|
|
17
|
+
- **One-click insert** — select a template to replace or append to the document
|
|
18
|
+
|
|
19
|
+
> Community feature — no enterprise licence required.
|
|
20
|
+
|
|
21
|
+
**Keywords:** `richhtmleditor` `templates` `document` `report` `letter` `wysiwyg`
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @richhtmleditor/templates
|
|
27
|
+
# Requires @richhtmleditor/core (via framework wrapper or direct install).
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { createEditor } from "@richhtmleditor/core";
|
|
34
|
+
import { createTemplatesPlugin } from "@richhtmleditor/templates";
|
|
35
|
+
|
|
36
|
+
const editor = createEditor({
|
|
37
|
+
element: host,
|
|
38
|
+
toolbar: { preset: "full" },
|
|
39
|
+
plugins: [createTemplatesPlugin()]
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Angular
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { createTemplatesPlugin } from "@richhtmleditor/templates";
|
|
47
|
+
|
|
48
|
+
plugins = [createTemplatesPlugin()];
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<richhtmleditor [plugins]="plugins" [toolbar]="{ preset: 'full' }" />
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Custom templates
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
createTemplatesPlugin({
|
|
59
|
+
templates: [
|
|
60
|
+
{
|
|
61
|
+
id: "invoice",
|
|
62
|
+
title: "Invoice",
|
|
63
|
+
html: "<h1>Invoice</h1><table>...</table>"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
### `createTemplatesPlugin(options?)`
|
|
72
|
+
|
|
73
|
+
Returns an `EditorPlugin` that registers the `insertTemplate` toolbar tool.
|
|
74
|
+
|
|
75
|
+
| Option | Type | Description |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `templates` | `TemplateDefinition[]?` | Additional custom templates to include in the gallery. |
|
|
78
|
+
| `replaceContent` | `boolean?` | Replace document content on insert (default: `true`). |
|
|
79
|
+
|
|
80
|
+
### `TemplateDefinition`
|
|
81
|
+
|
|
82
|
+
| Field | Type | Description |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `id` | `string` | Unique template identifier. |
|
|
85
|
+
| `title` | `string` | Display name in the gallery. |
|
|
86
|
+
| `html` | `string` | HTML content of the template. |
|
|
87
|
+
| `thumbnail` | `string?` | Optional thumbnail image URL or data URL. |
|
|
88
|
+
|
|
89
|
+
## Related packages
|
|
90
|
+
|
|
91
|
+
- [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) — editor engine and plugins API.
|
|
92
|
+
- [`@richhtmleditor/themes`](https://www.npmjs.com/package/@richhtmleditor/themes) — shared CSS.
|
|
93
|
+
- [`@richhtmleditor/export`](https://www.npmjs.com/package/@richhtmleditor/export) — DOCX/PDF export plugin.
|
|
94
|
+
- [`@richhtmleditor/angular`](https://www.npmjs.com/package/@richhtmleditor/angular) — Angular wrapper.
|
|
95
|
+
- [`@richhtmleditor/react`](https://www.npmjs.com/package/@richhtmleditor/react) — React wrapper.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
[MIT](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richhtmleditor/templates",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Reusable content blocks and template variables plugin for Rich HTML Editor.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"prepack": "node ../../scripts/assert-pack-ready.mjs"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@richhtmleditor/core": "^1.1.
|
|
21
|
+
"@richhtmleditor/core": "^1.1.1"
|
|
22
22
|
},
|
|
23
23
|
"keywords": ["richhtmleditor", "templates", "snippets", "variables", "content-blocks"],
|
|
24
24
|
"license": "MIT",
|