@richhtmleditor/templates 1.1.0
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/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +224 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { EditorPlugin } from "@richhtmleditor/core";
|
|
2
|
+
export type Template = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/**
|
|
6
|
+
* HTML content. Use `{{variableName}}` placeholders for dynamic substitution.
|
|
7
|
+
* Example: `<p>Dear {{firstName}},</p>`
|
|
8
|
+
*/
|
|
9
|
+
content: string;
|
|
10
|
+
/** Optional category for grouping in the picker UI */
|
|
11
|
+
category?: string;
|
|
12
|
+
/** Short description shown in the picker */
|
|
13
|
+
description?: string;
|
|
14
|
+
};
|
|
15
|
+
export type TemplatesPluginOptions = {
|
|
16
|
+
/** The templates available for insertion */
|
|
17
|
+
templates: Template[];
|
|
18
|
+
/**
|
|
19
|
+
* Static variable values for `{{variable}}` substitution.
|
|
20
|
+
* Dynamic values can be provided via `getVariables`.
|
|
21
|
+
*/
|
|
22
|
+
variables?: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Called when a template is about to be inserted.
|
|
25
|
+
* Return a (possibly modified) variable map to override static `variables`.
|
|
26
|
+
*/
|
|
27
|
+
getVariables?: (template: Template) => Record<string, string> | Promise<Record<string, string>>;
|
|
28
|
+
/** Called after a template has been inserted. */
|
|
29
|
+
onInsert?: (template: Template, resolvedHtml: string) => void;
|
|
30
|
+
};
|
|
31
|
+
/** Replace `{{key}}` placeholders in html with values from the variables map. */
|
|
32
|
+
export declare function applyVariables(html: string, variables: Record<string, string>): string;
|
|
33
|
+
/** Scan an HTML string and return all unique `{{variable}}` placeholder names. */
|
|
34
|
+
export declare function extractVariableNames(html: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Reusable content templates plugin.
|
|
37
|
+
*
|
|
38
|
+
* Click the toolbar button → modal opens with search, category tabs, template
|
|
39
|
+
* cards and an HTML preview pane. Select a card and click **Insert** (or
|
|
40
|
+
* double-click the card) to append the template at the current cursor position.
|
|
41
|
+
*
|
|
42
|
+
* Template content supports `{{variable}}` placeholders substituted at insert time.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { createTemplatesPlugin } from "@richhtmleditor/templates";
|
|
46
|
+
* createEditor({
|
|
47
|
+
* plugins: [createTemplatesPlugin({
|
|
48
|
+
* templates: [
|
|
49
|
+
* { id: "welcome", label: "Welcome email", category: "Email",
|
|
50
|
+
* description: "Greeting for new users",
|
|
51
|
+
* content: "<p>Dear {{firstName}},</p><p>Welcome to {{company}}!</p>" }
|
|
52
|
+
* ],
|
|
53
|
+
* variables: { company: "Acme Corp" }
|
|
54
|
+
* })]
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function createTemplatesPlugin(options: TemplatesPluginOptions): EditorPlugin;
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,4CAA4C;IAC5C,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChG,iDAAiD;IACjD,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEtF;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAM3D;AAkMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,YAAY,CAoBnF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/** Replace `{{key}}` placeholders in html with values from the variables map. */
|
|
2
|
+
export function applyVariables(html, variables) {
|
|
3
|
+
return html.replace(/\{\{(\w+)\}\}/g, (_, key) => variables[key] ?? `{{${key}}}`);
|
|
4
|
+
}
|
|
5
|
+
/** Scan an HTML string and return all unique `{{variable}}` placeholder names. */
|
|
6
|
+
export function extractVariableNames(html) {
|
|
7
|
+
const found = new Set();
|
|
8
|
+
for (const match of html.matchAll(/\{\{(\w+)\}\}/g)) {
|
|
9
|
+
found.add(match[1]);
|
|
10
|
+
}
|
|
11
|
+
return Array.from(found);
|
|
12
|
+
}
|
|
13
|
+
const PREVIEW_SCALE = 0.33;
|
|
14
|
+
function buildCardPreview(content) {
|
|
15
|
+
const box = document.createElement("div");
|
|
16
|
+
box.style.cssText =
|
|
17
|
+
"height:190px;overflow:hidden;border-radius:10px;background:#fff;" +
|
|
18
|
+
"border:1px solid #e8edf3;position:relative;margin-bottom:12px;";
|
|
19
|
+
const inner = document.createElement("div");
|
|
20
|
+
inner.style.cssText =
|
|
21
|
+
`position:absolute;top:0;left:0;` +
|
|
22
|
+
`width:${Math.round(100 / PREVIEW_SCALE)}%;` +
|
|
23
|
+
`transform:scale(${PREVIEW_SCALE});transform-origin:top left;` +
|
|
24
|
+
`padding:16px 18px;pointer-events:none;` +
|
|
25
|
+
`font-family:system-ui,sans-serif;font-size:14px;line-height:1.6;color:#0f172a;`;
|
|
26
|
+
inner.innerHTML = content;
|
|
27
|
+
box.appendChild(inner);
|
|
28
|
+
return box;
|
|
29
|
+
}
|
|
30
|
+
function openTemplateModal(options, onInsert) {
|
|
31
|
+
const templates = options.templates;
|
|
32
|
+
if (!templates.length)
|
|
33
|
+
return;
|
|
34
|
+
let selected = null;
|
|
35
|
+
// ── Inject card hover CSS once ───────────────────────────────────
|
|
36
|
+
const styleId = "de-tpl-modal-styles";
|
|
37
|
+
if (!document.getElementById(styleId)) {
|
|
38
|
+
const s = document.createElement("style");
|
|
39
|
+
s.id = styleId;
|
|
40
|
+
s.textContent =
|
|
41
|
+
`.de-tpl-card:hover{border-color:#93c5fd!important;box-shadow:0 0 0 3px rgba(37,99,235,.08)!important;}` +
|
|
42
|
+
`.de-tpl-card--active{border-color:#2563eb!important;box-shadow:0 0 0 4px rgba(37,99,235,.12)!important;}` +
|
|
43
|
+
`.de-tpl-modal__search:focus{border-color:#2563eb!important;box-shadow:0 0 0 3px rgba(37,99,235,.15)!important;}`;
|
|
44
|
+
document.head.appendChild(s);
|
|
45
|
+
}
|
|
46
|
+
// ── Backdrop ─────────────────────────────────────────────────────
|
|
47
|
+
const backdrop = document.createElement("div");
|
|
48
|
+
backdrop.style.cssText =
|
|
49
|
+
"position:fixed;inset:0;background:rgba(15,23,42,.5);z-index:9999;" +
|
|
50
|
+
"display:flex;align-items:center;justify-content:center;padding:20px;";
|
|
51
|
+
// ── Panel ─────────────────────────────────────────────────────────
|
|
52
|
+
const panel = document.createElement("div");
|
|
53
|
+
panel.setAttribute("role", "dialog");
|
|
54
|
+
panel.setAttribute("aria-modal", "true");
|
|
55
|
+
panel.setAttribute("aria-label", "Insert template");
|
|
56
|
+
panel.style.cssText =
|
|
57
|
+
"background:#f1f5f9;border-radius:18px;width:min(900px,96vw);max-height:90vh;" +
|
|
58
|
+
"display:flex;flex-direction:column;box-shadow:0 32px 80px rgba(0,0,0,.28);overflow:hidden;";
|
|
59
|
+
// ── Header ────────────────────────────────────────────────────────
|
|
60
|
+
const headerEl = document.createElement("div");
|
|
61
|
+
headerEl.style.cssText =
|
|
62
|
+
"padding:20px 22px 16px;background:#fff;border-bottom:1px solid #e2e8f0;flex-shrink:0;";
|
|
63
|
+
headerEl.innerHTML =
|
|
64
|
+
`<p style="margin:0 0 12px;font-size:.82rem;color:#64748b;line-height:1.5;">` +
|
|
65
|
+
`Preview reusable layouts, search by name, and replace the current editor content with a selected template.</p>` +
|
|
66
|
+
`<div style="display:flex;align-items:center;gap:10px;">` +
|
|
67
|
+
`<input type="text" class="de-tpl-modal__search" placeholder="Search templates"` +
|
|
68
|
+
` style="flex:1;padding:10px 16px;border:1.5px solid #cbd5e1;border-radius:999px;` +
|
|
69
|
+
`font-size:.875rem;outline:none;background:#fff;color:#0f172a;transition:border-color .15s,box-shadow .15s;" />` +
|
|
70
|
+
`<span class="de-tpl-count" style="flex-shrink:0;padding:8px 14px;border:1px solid #e2e8f0;` +
|
|
71
|
+
`border-radius:999px;font-size:.82rem;color:#64748b;background:#fff;white-space:nowrap;">` +
|
|
72
|
+
`${templates.length} template${templates.length === 1 ? "" : "s"}</span>` +
|
|
73
|
+
`</div>`;
|
|
74
|
+
// ── Grid ──────────────────────────────────────────────────────────
|
|
75
|
+
const gridEl = document.createElement("div");
|
|
76
|
+
gridEl.className = "de-tpl-modal__grid";
|
|
77
|
+
gridEl.style.cssText =
|
|
78
|
+
"flex:1;overflow-y:auto;padding:20px 22px;display:grid;grid-template-columns:repeat(2,1fr);gap:16px;align-content:start;";
|
|
79
|
+
// ── Footer ────────────────────────────────────────────────────────
|
|
80
|
+
const footerEl = document.createElement("div");
|
|
81
|
+
footerEl.style.cssText =
|
|
82
|
+
"display:flex;align-items:center;justify-content:space-between;" +
|
|
83
|
+
"padding:16px 22px;background:#fff;border-top:1px solid #e2e8f0;flex-shrink:0;";
|
|
84
|
+
footerEl.innerHTML =
|
|
85
|
+
`<span class="de-tpl-status" style="font-size:.82rem;color:#64748b;">Select a template to replace the current content.</span>` +
|
|
86
|
+
`<div style="display:flex;gap:8px;">` +
|
|
87
|
+
`<button type="button" class="de-tpl-modal__cancel"` +
|
|
88
|
+
` style="padding:9px 22px;border:1px solid #e2e8f0;background:#fff;border-radius:999px;` +
|
|
89
|
+
`cursor:pointer;font-size:.875rem;color:#0f172a;font-weight:500;">Cancel</button>` +
|
|
90
|
+
`<button type="button" class="de-tpl-modal__insert" disabled` +
|
|
91
|
+
` style="padding:9px 22px;background:#2563eb;color:#fff;border:none;border-radius:999px;` +
|
|
92
|
+
`cursor:pointer;font-size:.875rem;font-weight:600;opacity:.4;transition:opacity .15s;">Replace Content</button>` +
|
|
93
|
+
`</div>`;
|
|
94
|
+
panel.appendChild(headerEl);
|
|
95
|
+
panel.appendChild(gridEl);
|
|
96
|
+
panel.appendChild(footerEl);
|
|
97
|
+
backdrop.appendChild(panel);
|
|
98
|
+
document.body.appendChild(backdrop);
|
|
99
|
+
const searchEl = headerEl.querySelector(".de-tpl-modal__search");
|
|
100
|
+
const countEl = headerEl.querySelector(".de-tpl-count");
|
|
101
|
+
const insertBtn = footerEl.querySelector(".de-tpl-modal__insert");
|
|
102
|
+
const cancelBtn = footerEl.querySelector(".de-tpl-modal__cancel");
|
|
103
|
+
const statusEl = footerEl.querySelector(".de-tpl-status");
|
|
104
|
+
const close = () => backdrop.remove();
|
|
105
|
+
// ── Render grid ───────────────────────────────────────────────────
|
|
106
|
+
const renderGrid = (query) => {
|
|
107
|
+
const q = query.toLowerCase().trim();
|
|
108
|
+
const visible = q
|
|
109
|
+
? templates.filter((t) => t.label.toLowerCase().includes(q) ||
|
|
110
|
+
(t.description ?? "").toLowerCase().includes(q) ||
|
|
111
|
+
(t.category ?? "").toLowerCase().includes(q))
|
|
112
|
+
: templates;
|
|
113
|
+
countEl.textContent = `${visible.length} template${visible.length === 1 ? "" : "s"}`;
|
|
114
|
+
gridEl.replaceChildren();
|
|
115
|
+
if (!visible.length) {
|
|
116
|
+
const empty = document.createElement("p");
|
|
117
|
+
empty.style.cssText = "grid-column:1/-1;text-align:center;padding:48px;color:#94a3b8;font-size:.9rem;";
|
|
118
|
+
empty.textContent = "No templates found";
|
|
119
|
+
gridEl.appendChild(empty);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const tmpl of visible) {
|
|
123
|
+
const card = document.createElement("div");
|
|
124
|
+
card.className = "de-tpl-card" + (selected?.id === tmpl.id ? " de-tpl-card--active" : "");
|
|
125
|
+
card.dataset.id = tmpl.id;
|
|
126
|
+
card.style.cssText =
|
|
127
|
+
"background:#fff;border-radius:14px;border:2px solid #e2e8f0;" +
|
|
128
|
+
"cursor:pointer;padding:14px;transition:border-color .15s,box-shadow .15s;";
|
|
129
|
+
// HTML preview thumbnail
|
|
130
|
+
card.appendChild(buildCardPreview(tmpl.content));
|
|
131
|
+
// Title
|
|
132
|
+
const titleEl = document.createElement("p");
|
|
133
|
+
titleEl.style.cssText = "margin:0 0 5px;font-size:.95rem;font-weight:700;color:#0f172a;";
|
|
134
|
+
titleEl.textContent = tmpl.label;
|
|
135
|
+
card.appendChild(titleEl);
|
|
136
|
+
// Description (plain text fallback from content)
|
|
137
|
+
const descEl = document.createElement("p");
|
|
138
|
+
descEl.style.cssText =
|
|
139
|
+
"margin:0;font-size:.78rem;color:#64748b;line-height:1.45;" +
|
|
140
|
+
"display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;";
|
|
141
|
+
descEl.textContent =
|
|
142
|
+
tmpl.description ??
|
|
143
|
+
tmpl.content.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
144
|
+
card.appendChild(descEl);
|
|
145
|
+
card.addEventListener("click", () => {
|
|
146
|
+
selected = tmpl;
|
|
147
|
+
insertBtn.disabled = false;
|
|
148
|
+
insertBtn.style.opacity = "1";
|
|
149
|
+
statusEl.textContent = `"${tmpl.label}" selected.`;
|
|
150
|
+
gridEl.querySelectorAll(".de-tpl-card").forEach((c) => {
|
|
151
|
+
c.classList.toggle("de-tpl-card--active", c.dataset.id === tmpl.id);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
card.addEventListener("dblclick", () => { selected = tmpl; void doInsert(); });
|
|
155
|
+
gridEl.appendChild(card);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const doInsert = async () => {
|
|
159
|
+
if (!selected)
|
|
160
|
+
return;
|
|
161
|
+
const staticVars = options.variables ?? {};
|
|
162
|
+
const dynamicVars = options.getVariables
|
|
163
|
+
? await Promise.resolve(options.getVariables(selected))
|
|
164
|
+
: {};
|
|
165
|
+
const resolved = applyVariables(selected.content, { ...staticVars, ...dynamicVars });
|
|
166
|
+
onInsert(resolved, selected);
|
|
167
|
+
close();
|
|
168
|
+
};
|
|
169
|
+
// ── Wire events ───────────────────────────────────────────────────
|
|
170
|
+
cancelBtn.addEventListener("click", close);
|
|
171
|
+
backdrop.addEventListener("click", (e) => { if (e.target === backdrop)
|
|
172
|
+
close(); });
|
|
173
|
+
panel.addEventListener("keydown", (e) => { if (e.key === "Escape")
|
|
174
|
+
close(); });
|
|
175
|
+
insertBtn.addEventListener("click", () => void doInsert());
|
|
176
|
+
searchEl.addEventListener("input", () => renderGrid(searchEl.value));
|
|
177
|
+
renderGrid("");
|
|
178
|
+
setTimeout(() => searchEl.focus(), 50);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Reusable content templates plugin.
|
|
182
|
+
*
|
|
183
|
+
* Click the toolbar button → modal opens with search, category tabs, template
|
|
184
|
+
* cards and an HTML preview pane. Select a card and click **Insert** (or
|
|
185
|
+
* double-click the card) to append the template at the current cursor position.
|
|
186
|
+
*
|
|
187
|
+
* Template content supports `{{variable}}` placeholders substituted at insert time.
|
|
188
|
+
*
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { createTemplatesPlugin } from "@richhtmleditor/templates";
|
|
191
|
+
* createEditor({
|
|
192
|
+
* plugins: [createTemplatesPlugin({
|
|
193
|
+
* templates: [
|
|
194
|
+
* { id: "welcome", label: "Welcome email", category: "Email",
|
|
195
|
+
* description: "Greeting for new users",
|
|
196
|
+
* content: "<p>Dear {{firstName}},</p><p>Welcome to {{company}}!</p>" }
|
|
197
|
+
* ],
|
|
198
|
+
* variables: { company: "Acme Corp" }
|
|
199
|
+
* })]
|
|
200
|
+
* });
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export function createTemplatesPlugin(options) {
|
|
204
|
+
return {
|
|
205
|
+
id: "richhtmleditor-templates",
|
|
206
|
+
tools: [
|
|
207
|
+
{
|
|
208
|
+
id: "insertTemplate",
|
|
209
|
+
type: "button",
|
|
210
|
+
label: "Templates",
|
|
211
|
+
icon: "template",
|
|
212
|
+
display: "icon",
|
|
213
|
+
tooltip: "Insert content template",
|
|
214
|
+
onClick: (editor) => {
|
|
215
|
+
openTemplateModal(options, (resolvedHtml, tmpl) => {
|
|
216
|
+
editor.setContent(resolvedHtml);
|
|
217
|
+
options.onInsert?.(tmpl, resolvedHtml);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,iFAAiF;AACjF,MAAM,UAA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": "@richhtmleditor/templates",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Reusable content blocks and template variables plugin for Rich HTML Editor.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist", "README.md"],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"prepack": "node ../../scripts/assert-pack-ready.mjs"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@richhtmleditor/core": "^1.1.0"
|
|
22
|
+
},
|
|
23
|
+
"keywords": ["richhtmleditor", "templates", "snippets", "variables", "content-blocks"],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"publishConfig": { "access": "public" },
|
|
26
|
+
"engines": { "node": ">=18" }
|
|
27
|
+
}
|