@editora/core 1.0.18 → 1.0.19
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/{CodePlugin.native-BH-K4xmW.mjs → CodePlugin.native-BcVqm5MS.mjs} +64 -65
- package/dist/{CodePlugin.native-hNgfXlfS.mjs → CodePlugin.native-Rgxx2Igx.mjs} +2708 -1225
- package/dist/{DocumentManagerPlugin.native-iFip6s4Q.mjs → DocumentManagerPlugin.native-B8K-Oqom.mjs} +12 -11
- package/dist/{PreviewPlugin.native-CiR51jql.mjs → PreviewPlugin.native-Dyht8mGi.mjs} +48 -51
- package/dist/{TablePlugin.native-BjIxYZ2X.mjs → TablePlugin.native-C1YZ372P.mjs} +156 -147
- package/dist/TemplatePlugin.native-BDV2eik2.mjs +628 -0
- package/dist/{documentManager-BcBIv5P-.mjs → documentManager-BWK_-KJp.mjs} +524 -526
- package/dist/editora.min.js +17 -17
- package/dist/editora.umd.js +17 -17
- package/dist/index-CclXYzUB.js +12 -0
- package/dist/{index-XsYC_KdJ.mjs → index-DeUjxpKd.mjs} +406 -386
- package/dist/index.cjs.js +4 -4
- package/dist/index.esm.js +19 -16
- package/dist/plugin-loader.js +4 -4
- package/dist/purify.es-BHa5gZB7.mjs +1481 -0
- package/dist/sanitizeHtml-DA0ajC6k.mjs +17 -0
- package/dist/webcomponent-core.js +376 -362
- package/dist/webcomponent-core.min.js +91 -89
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +2 -2
- package/dist/webcomponent.js +382 -368
- package/dist/webcomponent.min.js +968 -967
- package/index.d.ts +9 -0
- package/package.json +1 -1
- package/dist/TemplatePlugin.native-D6n5RUnC.mjs +0 -1176
- package/dist/index-_eKRBZPq.js +0 -12
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { e as q } from "./escapeHtml-CX8RelZ1.mjs";
|
|
2
|
+
import { i as P } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
3
|
+
import { p as z } from "./purify.es-BHa5gZB7.mjs";
|
|
4
|
+
let n = null, d = null, f = null, o = null, h = "", v = "", T = "insert", E = null, c = null, b = null;
|
|
5
|
+
function M(t, e) {
|
|
6
|
+
if (e === t.innerHTML) return;
|
|
7
|
+
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
8
|
+
if (typeof r == "function")
|
|
9
|
+
try {
|
|
10
|
+
r("recordDomTransaction", t, e, t.innerHTML);
|
|
11
|
+
} catch (a) {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function F(t) {
|
|
15
|
+
if (!t) return null;
|
|
16
|
+
let e = t.startContainer;
|
|
17
|
+
for (; e && e !== document.body; ) {
|
|
18
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
19
|
+
const r = e;
|
|
20
|
+
if (r.getAttribute("contenteditable") === "true")
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
23
|
+
e = e.parentNode;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const I = [
|
|
28
|
+
{
|
|
29
|
+
id: "formal-letter",
|
|
30
|
+
name: "Formal Letter",
|
|
31
|
+
category: "Letters",
|
|
32
|
+
description: "Professional business letter template",
|
|
33
|
+
html: `<p><strong>{{ Company Name }}</strong></p>
|
|
34
|
+
<p>{{ Today }}</p>
|
|
35
|
+
<p>Dear {{ first_name }} {{ last_name }},</p>
|
|
36
|
+
<p>I hope this letter finds you well. [Your letter content here]</p>
|
|
37
|
+
<p>Thank you for your time and consideration.</p>
|
|
38
|
+
<p>Sincerely,<br>Your Name</p>`
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "meeting-notes",
|
|
42
|
+
name: "Meeting Notes",
|
|
43
|
+
category: "Notes",
|
|
44
|
+
description: "Template for meeting notes with attendees and action items",
|
|
45
|
+
html: `<h2>Meeting Notes - {{ today }}</h2>
|
|
46
|
+
<p><strong>Attendees:</strong> [List attendees]</p>
|
|
47
|
+
<p><strong>Agenda:</strong></p>
|
|
48
|
+
<ul>
|
|
49
|
+
<li>[Item 1]</li>
|
|
50
|
+
<li>[Item 2]</li>
|
|
51
|
+
<li>[Item 3]</li>
|
|
52
|
+
</ul>
|
|
53
|
+
<p><strong>Action Items:</strong></p>
|
|
54
|
+
<ul>
|
|
55
|
+
<li>[Owner]: [Task] - [Due Date]</li>
|
|
56
|
+
</ul>
|
|
57
|
+
<p><strong>Next Meeting:</strong> [Date]</p>`
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "proposal",
|
|
61
|
+
name: "Project Proposal",
|
|
62
|
+
category: "Business",
|
|
63
|
+
description: "Structured project proposal template",
|
|
64
|
+
html: `<h1>Project Proposal</h1>
|
|
65
|
+
<h2>Executive Summary</h2>
|
|
66
|
+
<p>[Summary of the proposal]</p>
|
|
67
|
+
<h2>Objectives</h2>
|
|
68
|
+
<ul>
|
|
69
|
+
<li>[Objective 1]</li>
|
|
70
|
+
<li>[Objective 2]</li>
|
|
71
|
+
</ul>
|
|
72
|
+
<h2>Scope</h2>
|
|
73
|
+
<p>[Project scope details]</p>
|
|
74
|
+
<h2>Timeline</h2>
|
|
75
|
+
<p>[Project timeline]</p>
|
|
76
|
+
<h2>Budget</h2>
|
|
77
|
+
<p>[Budget details]</p>
|
|
78
|
+
<h2>Contact</h2>
|
|
79
|
+
<p>{{ first_name }} {{ last_name }}<br>{{ email }}<br>{{ phone }}</p>`
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "faq",
|
|
83
|
+
name: "FAQ Template",
|
|
84
|
+
category: "Documentation",
|
|
85
|
+
description: "FAQ document structure",
|
|
86
|
+
html: `<h1>Frequently Asked Questions</h1>
|
|
87
|
+
<h2>General Questions</h2>
|
|
88
|
+
<h3>Q: What is this about?</h3>
|
|
89
|
+
<p>A: [Answer here]</p>
|
|
90
|
+
<h3>Q: Who should use this?</h3>
|
|
91
|
+
<p>A: [Answer here]</p>
|
|
92
|
+
<h2>Technical Questions</h2>
|
|
93
|
+
<h3>Q: How do I get started?</h3>
|
|
94
|
+
<p>A: [Answer here]</p>
|
|
95
|
+
<h3>Q: What are the requirements?</h3>
|
|
96
|
+
<p>A: [Answer here]</p>`
|
|
97
|
+
}
|
|
98
|
+
], x = [...I], R = () => x, oe = (t) => x.filter((e) => e.category === t), N = () => {
|
|
99
|
+
const t = new Set(x.map((e) => e.category));
|
|
100
|
+
return Array.from(t);
|
|
101
|
+
}, O = (t) => {
|
|
102
|
+
const e = t.toLowerCase();
|
|
103
|
+
return x.filter(
|
|
104
|
+
(r) => {
|
|
105
|
+
var a, m;
|
|
106
|
+
return r.name.toLowerCase().includes(e) || ((a = r.description) == null ? void 0 : a.toLowerCase().includes(e)) || ((m = r.tags) == null ? void 0 : m.some((s) => s.toLowerCase().includes(e)));
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}, V = (t) => z.sanitize(t, {
|
|
110
|
+
ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
|
|
111
|
+
ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
|
|
112
|
+
}), ae = (t) => x.some((e) => e.id === t.id) ? (console.warn(`Template with ID ${t.id} already exists`), !1) : (x.push(t), !0), le = (t) => !!(t.id && t.name && t.category && t.html && t.html.trim().length > 0);
|
|
113
|
+
function Q(t) {
|
|
114
|
+
d && u(), d = document.createElement("div"), P(d), d.className = "rte-dialog-overlay", Z(t) && d.classList.add("rte-ui-theme-dark"), d.addEventListener("click", () => u()), n = document.createElement("div"), n.className = "rte-dialog rte-template-dialog", n.addEventListener("click", (r) => r.stopPropagation());
|
|
115
|
+
const e = N();
|
|
116
|
+
e.length > 0 && !h && (h = e[0]), k(), d.appendChild(n), document.body.appendChild(d), B(), ee();
|
|
117
|
+
}
|
|
118
|
+
function B() {
|
|
119
|
+
$(), E = (t) => {
|
|
120
|
+
t.key === "Escape" && (!d || !n || (t.preventDefault(), t.stopPropagation(), u()));
|
|
121
|
+
}, document.addEventListener("keydown", E, !0);
|
|
122
|
+
}
|
|
123
|
+
function $() {
|
|
124
|
+
E && (document.removeEventListener("keydown", E, !0), E = null);
|
|
125
|
+
}
|
|
126
|
+
const W = '[data-theme="dark"], .dark, .editora-theme-dark', C = () => {
|
|
127
|
+
const t = window.getSelection();
|
|
128
|
+
if (!t || t.rangeCount === 0) return null;
|
|
129
|
+
const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
|
|
130
|
+
return (r == null ? void 0 : r.closest(
|
|
131
|
+
".rte-content, .editora-content"
|
|
132
|
+
)) || null;
|
|
133
|
+
}, Z = (t) => {
|
|
134
|
+
const e = t || C();
|
|
135
|
+
return e ? !!e.closest(W) : !1;
|
|
136
|
+
};
|
|
137
|
+
function A() {
|
|
138
|
+
const t = F(f);
|
|
139
|
+
if (t) return t;
|
|
140
|
+
if (b != null && b.isConnected) return b;
|
|
141
|
+
const e = C();
|
|
142
|
+
return e || document.querySelector(".rte-content, .editora-content");
|
|
143
|
+
}
|
|
144
|
+
function k() {
|
|
145
|
+
if (!n) return;
|
|
146
|
+
const t = N(), e = H();
|
|
147
|
+
n.innerHTML = `
|
|
148
|
+
<div class="rte-dialog-header">
|
|
149
|
+
<h2>Insert Template</h2>
|
|
150
|
+
<button class="rte-dialog-close" aria-label="Close">✕</button>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="rte-dialog-body">
|
|
154
|
+
<!-- Search -->
|
|
155
|
+
<input
|
|
156
|
+
type="text"
|
|
157
|
+
placeholder="Search templates..."
|
|
158
|
+
value="${q(v)}"
|
|
159
|
+
class="rte-input rte-template-search"
|
|
160
|
+
aria-label="Search templates"
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
<!-- Category Tabs -->
|
|
164
|
+
<div class="rte-tabs">
|
|
165
|
+
${t.map((r) => `
|
|
166
|
+
<button class="rte-tab ${h === r ? "active" : ""}" data-category="${r}">
|
|
167
|
+
${r}
|
|
168
|
+
</button>
|
|
169
|
+
`).join("")}
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<!-- Template List -->
|
|
173
|
+
<div class="rte-template-list">
|
|
174
|
+
${e.length > 0 ? e.map((r) => `
|
|
175
|
+
<div
|
|
176
|
+
class="rte-template-item ${(o == null ? void 0 : o.id) === r.id ? "selected" : ""}"
|
|
177
|
+
data-template-id="${r.id}"
|
|
178
|
+
>
|
|
179
|
+
<div class="template-name">${r.name}</div>
|
|
180
|
+
${r.description ? `<div class="template-description">${r.description}</div>` : ""}
|
|
181
|
+
</div>
|
|
182
|
+
`).join("") : '<div class="rte-empty-state">No templates found</div>'}
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<!-- Preview -->
|
|
186
|
+
${o ? `
|
|
187
|
+
<div class="rte-template-preview">
|
|
188
|
+
<strong>Preview:</strong>
|
|
189
|
+
<div class="template-preview-content">${o.html}</div>
|
|
190
|
+
</div>
|
|
191
|
+
` : ""}
|
|
192
|
+
|
|
193
|
+
<!-- Insert Mode Toggle -->
|
|
194
|
+
<div class="rte-insert-mode">
|
|
195
|
+
<label>
|
|
196
|
+
<input type="radio" name="insertMode" value="insert" ${T === "insert" ? "checked" : ""} />
|
|
197
|
+
Insert at cursor
|
|
198
|
+
</label>
|
|
199
|
+
<label>
|
|
200
|
+
<input type="radio" name="insertMode" value="replace" ${T === "replace" ? "checked" : ""} />
|
|
201
|
+
Replace document
|
|
202
|
+
</label>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<div class="rte-dialog-footer">
|
|
207
|
+
<button class="rte-button-secondary rte-cancel-btn">Cancel</button>
|
|
208
|
+
<button class="rte-button-primary rte-insert-btn" ${o ? "" : "disabled"}>
|
|
209
|
+
${T === "insert" ? "Insert" : "Replace"}
|
|
210
|
+
</button>
|
|
211
|
+
</div>
|
|
212
|
+
`, K();
|
|
213
|
+
}
|
|
214
|
+
function G() {
|
|
215
|
+
if (!n) return;
|
|
216
|
+
n.innerHTML = `
|
|
217
|
+
<div class="rte-dialog-header">
|
|
218
|
+
<h2>Replace Document?</h2>
|
|
219
|
+
</div>
|
|
220
|
+
<div class="rte-dialog-body">
|
|
221
|
+
<p>This will replace your current document content. Continue?</p>
|
|
222
|
+
</div>
|
|
223
|
+
<div class="rte-dialog-footer">
|
|
224
|
+
<button class="rte-button-secondary rte-cancel-warning-btn">Cancel</button>
|
|
225
|
+
<button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
|
|
226
|
+
</div>
|
|
227
|
+
`;
|
|
228
|
+
const t = n.querySelector(".rte-cancel-warning-btn"), e = n.querySelector(".rte-confirm-replace-btn");
|
|
229
|
+
t == null || t.addEventListener("click", () => k()), e == null || e.addEventListener("click", () => Y());
|
|
230
|
+
}
|
|
231
|
+
function H() {
|
|
232
|
+
const t = R();
|
|
233
|
+
return v.trim() ? O(v) : h ? t.filter((e) => e.category === h) : t;
|
|
234
|
+
}
|
|
235
|
+
function K() {
|
|
236
|
+
if (!n) return;
|
|
237
|
+
const t = n.querySelector(".rte-dialog-close");
|
|
238
|
+
t == null || t.addEventListener("click", () => u());
|
|
239
|
+
const e = n.querySelector(".rte-cancel-btn");
|
|
240
|
+
e == null || e.addEventListener("click", () => u());
|
|
241
|
+
const r = n.querySelector(".rte-insert-btn");
|
|
242
|
+
r == null || r.addEventListener("click", () => L());
|
|
243
|
+
const a = n.querySelector(".rte-template-search");
|
|
244
|
+
a == null || a.addEventListener("input", (l) => {
|
|
245
|
+
c !== null && cancelAnimationFrame(c), v = l.target.value, c = requestAnimationFrame(() => {
|
|
246
|
+
c = null, S();
|
|
247
|
+
});
|
|
248
|
+
}), a == null || a.addEventListener("keydown", (l) => {
|
|
249
|
+
l.key === "Enter" && o ? L() : l.key === "Escape" && u();
|
|
250
|
+
});
|
|
251
|
+
const m = n.querySelector(".rte-tabs");
|
|
252
|
+
m == null || m.addEventListener("click", (l) => {
|
|
253
|
+
const p = l.target.closest(".rte-tab");
|
|
254
|
+
if (!p) return;
|
|
255
|
+
const w = p.getAttribute("data-category");
|
|
256
|
+
w && (h = w, v = "", c !== null && (cancelAnimationFrame(c), c = null), S());
|
|
257
|
+
});
|
|
258
|
+
const s = n.querySelector(".rte-template-list"), y = (l) => {
|
|
259
|
+
const p = l.target.closest(".rte-template-item");
|
|
260
|
+
if (!p) return null;
|
|
261
|
+
const w = p.getAttribute("data-template-id");
|
|
262
|
+
return w && R().find((j) => j.id === w) || null;
|
|
263
|
+
};
|
|
264
|
+
s == null || s.addEventListener("click", (l) => {
|
|
265
|
+
const i = y(l);
|
|
266
|
+
i && (o = i, k());
|
|
267
|
+
}), s == null || s.addEventListener("dblclick", (l) => {
|
|
268
|
+
const i = y(l);
|
|
269
|
+
i && (o = i, L());
|
|
270
|
+
});
|
|
271
|
+
const g = n.querySelector(".rte-insert-mode");
|
|
272
|
+
g == null || g.addEventListener("change", (l) => {
|
|
273
|
+
const i = l.target;
|
|
274
|
+
!i || i.name !== "insertMode" || (T = i.value, k());
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function S() {
|
|
278
|
+
const t = H();
|
|
279
|
+
t.length > 0 ? (!o || !t.find((e) => e.id === o.id)) && (o = t[0]) : o = null, k();
|
|
280
|
+
}
|
|
281
|
+
function L() {
|
|
282
|
+
var t;
|
|
283
|
+
if (o)
|
|
284
|
+
if (T === "replace") {
|
|
285
|
+
const e = A();
|
|
286
|
+
if ((t = e == null ? void 0 : e.innerHTML) != null && t.trim()) {
|
|
287
|
+
G();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
_(o), u();
|
|
291
|
+
} else
|
|
292
|
+
J(o), u();
|
|
293
|
+
}
|
|
294
|
+
function Y() {
|
|
295
|
+
o && (_(o), u());
|
|
296
|
+
}
|
|
297
|
+
const U = /* @__PURE__ */ new Set([
|
|
298
|
+
"DIV",
|
|
299
|
+
"P",
|
|
300
|
+
"BLOCKQUOTE",
|
|
301
|
+
"PRE",
|
|
302
|
+
"H1",
|
|
303
|
+
"H2",
|
|
304
|
+
"H3",
|
|
305
|
+
"H4",
|
|
306
|
+
"H5",
|
|
307
|
+
"H6",
|
|
308
|
+
"LI",
|
|
309
|
+
"TD",
|
|
310
|
+
"TH"
|
|
311
|
+
]);
|
|
312
|
+
function D(t, e) {
|
|
313
|
+
let r = t;
|
|
314
|
+
for (; r && r !== e; ) {
|
|
315
|
+
if (r.nodeType === Node.ELEMENT_NODE && U.has(r.tagName))
|
|
316
|
+
return r;
|
|
317
|
+
r = r.parentNode;
|
|
318
|
+
}
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
function J(t) {
|
|
322
|
+
var i;
|
|
323
|
+
const e = window.getSelection();
|
|
324
|
+
if (!e) return;
|
|
325
|
+
const r = A();
|
|
326
|
+
if (!r) return;
|
|
327
|
+
if (f)
|
|
328
|
+
e.removeAllRanges(), e.addRange(f);
|
|
329
|
+
else {
|
|
330
|
+
const p = document.createRange();
|
|
331
|
+
p.selectNodeContents(r), p.collapse(!1), e.removeAllRanges(), e.addRange(p);
|
|
332
|
+
}
|
|
333
|
+
if (e.rangeCount === 0) return;
|
|
334
|
+
const a = e.getRangeAt(0), m = (i = r == null ? void 0 : r.innerHTML) != null ? i : "", s = document.createRange().createContextualFragment(V(t.html));
|
|
335
|
+
a.deleteContents();
|
|
336
|
+
const y = s.lastChild, g = D(a.endContainer, r) || D(a.startContainer, r);
|
|
337
|
+
g && g.parentNode ? g.parentNode.insertBefore(s, g.nextSibling) : a.insertNode(s);
|
|
338
|
+
const l = document.createRange();
|
|
339
|
+
y ? l.setStartAfter(y) : l.setStartAfter(a.endContainer), l.collapse(!0), e.removeAllRanges(), e.addRange(l), r && (M(r, m), r.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
340
|
+
}
|
|
341
|
+
function _(t) {
|
|
342
|
+
const e = A();
|
|
343
|
+
if (e) {
|
|
344
|
+
const r = e.innerHTML;
|
|
345
|
+
e.innerHTML = V(t.html), M(e, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function u() {
|
|
349
|
+
$(), c !== null && (cancelAnimationFrame(c), c = null), d && (d.remove(), d = null), n = null, f = null, v = "", b = null;
|
|
350
|
+
}
|
|
351
|
+
function X(t) {
|
|
352
|
+
const e = window.getSelection();
|
|
353
|
+
e && e.rangeCount > 0 ? f = e.getRangeAt(0).cloneRange() : f = null;
|
|
354
|
+
const r = H();
|
|
355
|
+
r.length > 0 && !o && (o = r[0]);
|
|
356
|
+
const a = (t == null ? void 0 : t.contentElement) instanceof HTMLElement ? t.contentElement : C();
|
|
357
|
+
b = a || null, Q(a);
|
|
358
|
+
}
|
|
359
|
+
function ee() {
|
|
360
|
+
if (typeof document == "undefined") return;
|
|
361
|
+
const t = "template-plugin-dialog-styles";
|
|
362
|
+
if (document.getElementById(t)) return;
|
|
363
|
+
const e = document.createElement("style");
|
|
364
|
+
e.id = t, e.textContent = `
|
|
365
|
+
.rte-dialog-overlay {
|
|
366
|
+
--rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
367
|
+
--rte-tmpl-dialog-bg: #fff;
|
|
368
|
+
--rte-tmpl-dialog-text: #101828;
|
|
369
|
+
--rte-tmpl-border: #d6dbe4;
|
|
370
|
+
--rte-tmpl-subtle-bg: #f7f9fc;
|
|
371
|
+
--rte-tmpl-subtle-hover: #eef2f7;
|
|
372
|
+
--rte-tmpl-muted-text: #5f6b7d;
|
|
373
|
+
--rte-tmpl-accent: #1976d2;
|
|
374
|
+
--rte-tmpl-accent-strong: #1565c0;
|
|
375
|
+
--rte-tmpl-ring: rgba(31, 117, 254, 0.18);
|
|
376
|
+
position: fixed;
|
|
377
|
+
top: 0;
|
|
378
|
+
left: 0;
|
|
379
|
+
right: 0;
|
|
380
|
+
bottom: 0;
|
|
381
|
+
background-color: var(--rte-tmpl-overlay-bg);
|
|
382
|
+
backdrop-filter: blur(2px);
|
|
383
|
+
display: flex;
|
|
384
|
+
align-items: center;
|
|
385
|
+
justify-content: center;
|
|
386
|
+
z-index: 10000;
|
|
387
|
+
padding: 16px;
|
|
388
|
+
box-sizing: border-box;
|
|
389
|
+
}
|
|
390
|
+
.rte-dialog-overlay.rte-ui-theme-dark {
|
|
391
|
+
--rte-tmpl-overlay-bg: rgba(2, 8, 20, 0.72);
|
|
392
|
+
--rte-tmpl-dialog-bg: #202938;
|
|
393
|
+
--rte-tmpl-dialog-text: #e8effc;
|
|
394
|
+
--rte-tmpl-border: #49566c;
|
|
395
|
+
--rte-tmpl-subtle-bg: #2a3444;
|
|
396
|
+
--rte-tmpl-subtle-hover: #344256;
|
|
397
|
+
--rte-tmpl-muted-text: #a5b1c5;
|
|
398
|
+
--rte-tmpl-accent: #58a6ff;
|
|
399
|
+
--rte-tmpl-accent-strong: #4598f4;
|
|
400
|
+
--rte-tmpl-ring: rgba(88, 166, 255, 0.22);
|
|
401
|
+
}
|
|
402
|
+
.rte-template-dialog {
|
|
403
|
+
background: var(--rte-tmpl-dialog-bg);
|
|
404
|
+
color: var(--rte-tmpl-dialog-text);
|
|
405
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
406
|
+
border-radius: 12px;
|
|
407
|
+
box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
|
|
408
|
+
width: 600px;
|
|
409
|
+
max-height: 700px;
|
|
410
|
+
display: flex;
|
|
411
|
+
flex-direction: column;
|
|
412
|
+
overflow: hidden;
|
|
413
|
+
}
|
|
414
|
+
.rte-dialog-header {
|
|
415
|
+
display: flex;
|
|
416
|
+
justify-content: space-between;
|
|
417
|
+
align-items: center;
|
|
418
|
+
padding: 16px 20px;
|
|
419
|
+
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
420
|
+
background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
|
|
421
|
+
}
|
|
422
|
+
.rte-dialog-header h2 {
|
|
423
|
+
margin: 0;
|
|
424
|
+
font-size: 18px;
|
|
425
|
+
font-weight: 600;
|
|
426
|
+
color: var(--rte-tmpl-dialog-text);
|
|
427
|
+
}
|
|
428
|
+
.rte-dialog-close {
|
|
429
|
+
background: none;
|
|
430
|
+
border: none;
|
|
431
|
+
font-size: 24px;
|
|
432
|
+
cursor: pointer;
|
|
433
|
+
color: var(--rte-tmpl-muted-text);
|
|
434
|
+
padding: 0;
|
|
435
|
+
width: 32px;
|
|
436
|
+
height: 32px;
|
|
437
|
+
display: flex;
|
|
438
|
+
align-items: center;
|
|
439
|
+
justify-content: center;
|
|
440
|
+
border-radius: 8px;
|
|
441
|
+
transition: background-color 0.16s ease, color 0.16s ease;
|
|
442
|
+
}
|
|
443
|
+
.rte-dialog-close:hover {
|
|
444
|
+
background-color: var(--rte-tmpl-subtle-hover);
|
|
445
|
+
color: var(--rte-tmpl-dialog-text);
|
|
446
|
+
}
|
|
447
|
+
.rte-dialog-body {
|
|
448
|
+
padding: 20px;
|
|
449
|
+
flex: 1;
|
|
450
|
+
overflow-y: auto;
|
|
451
|
+
}
|
|
452
|
+
.rte-input {
|
|
453
|
+
width: 100%;
|
|
454
|
+
padding: 8px 12px;
|
|
455
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
456
|
+
border-radius: 4px;
|
|
457
|
+
font-size: 14px;
|
|
458
|
+
box-sizing: border-box;
|
|
459
|
+
background: var(--rte-tmpl-subtle-bg);
|
|
460
|
+
color: var(--rte-tmpl-dialog-text);
|
|
461
|
+
}
|
|
462
|
+
.rte-input:focus {
|
|
463
|
+
outline: none;
|
|
464
|
+
border-color: var(--rte-tmpl-accent);
|
|
465
|
+
}
|
|
466
|
+
.rte-tabs {
|
|
467
|
+
display: flex;
|
|
468
|
+
gap: 8px;
|
|
469
|
+
margin-top: 12px;
|
|
470
|
+
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
471
|
+
padding-bottom: 8px;
|
|
472
|
+
}
|
|
473
|
+
.rte-tab {
|
|
474
|
+
padding: 6px 12px;
|
|
475
|
+
border: none;
|
|
476
|
+
background: none;
|
|
477
|
+
cursor: pointer;
|
|
478
|
+
font-size: 14px;
|
|
479
|
+
color: var(--rte-tmpl-muted-text);
|
|
480
|
+
border-bottom: 2px solid transparent;
|
|
481
|
+
transition: all 0.2s;
|
|
482
|
+
}
|
|
483
|
+
.rte-tab:hover {
|
|
484
|
+
color: var(--rte-tmpl-dialog-text);
|
|
485
|
+
}
|
|
486
|
+
.rte-tab.active {
|
|
487
|
+
color: var(--rte-tmpl-accent);
|
|
488
|
+
border-bottom-color: var(--rte-tmpl-accent);
|
|
489
|
+
font-weight: 600;
|
|
490
|
+
}
|
|
491
|
+
.rte-template-list {
|
|
492
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
493
|
+
border-radius: 4px;
|
|
494
|
+
max-height: 250px;
|
|
495
|
+
overflow-y: auto;
|
|
496
|
+
margin: 12px 0;
|
|
497
|
+
background: var(--rte-tmpl-subtle-bg);
|
|
498
|
+
}
|
|
499
|
+
.rte-template-item {
|
|
500
|
+
padding: 12px;
|
|
501
|
+
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
502
|
+
cursor: pointer;
|
|
503
|
+
transition: background-color 0.2s;
|
|
504
|
+
background: none;
|
|
505
|
+
}
|
|
506
|
+
.rte-template-item:last-child {
|
|
507
|
+
border-bottom: none;
|
|
508
|
+
}
|
|
509
|
+
.rte-template-item:hover,
|
|
510
|
+
.rte-template-item.selected {
|
|
511
|
+
background-color: var(--rte-tmpl-subtle-hover);
|
|
512
|
+
}
|
|
513
|
+
.template-name {
|
|
514
|
+
font-weight: 600;
|
|
515
|
+
color: var(--rte-tmpl-dialog-text);
|
|
516
|
+
margin-bottom: 4px;
|
|
517
|
+
}
|
|
518
|
+
.template-description {
|
|
519
|
+
font-size: 12px;
|
|
520
|
+
color: var(--rte-tmpl-muted-text);
|
|
521
|
+
}
|
|
522
|
+
.rte-template-preview {
|
|
523
|
+
padding: 12px;
|
|
524
|
+
background-color: var(--rte-tmpl-subtle-bg);
|
|
525
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
526
|
+
border-radius: 4px;
|
|
527
|
+
margin-top: 12px;
|
|
528
|
+
max-height: 200px;
|
|
529
|
+
overflow-y: auto;
|
|
530
|
+
}
|
|
531
|
+
.template-preview-content {
|
|
532
|
+
font-size: 13px;
|
|
533
|
+
line-height: 1.5;
|
|
534
|
+
margin-top: 8px;
|
|
535
|
+
}
|
|
536
|
+
.template-preview-content * {
|
|
537
|
+
margin: 4px 0;
|
|
538
|
+
}
|
|
539
|
+
.rte-insert-mode {
|
|
540
|
+
margin-top: 12px;
|
|
541
|
+
padding: 12px;
|
|
542
|
+
background-color: var(--rte-tmpl-subtle-bg);
|
|
543
|
+
border-radius: 4px;
|
|
544
|
+
display: flex;
|
|
545
|
+
gap: 16px;
|
|
546
|
+
}
|
|
547
|
+
.rte-insert-mode label {
|
|
548
|
+
display: flex;
|
|
549
|
+
align-items: center;
|
|
550
|
+
cursor: pointer;
|
|
551
|
+
font-size: 14px;
|
|
552
|
+
}
|
|
553
|
+
.rte-insert-mode input {
|
|
554
|
+
margin-right: 6px;
|
|
555
|
+
cursor: pointer;
|
|
556
|
+
}
|
|
557
|
+
.rte-empty-state {
|
|
558
|
+
padding: 40px;
|
|
559
|
+
text-align: center;
|
|
560
|
+
color: var(--rte-tmpl-muted-text);
|
|
561
|
+
font-size: 14px;
|
|
562
|
+
}
|
|
563
|
+
.rte-dialog-footer {
|
|
564
|
+
padding: 16px 20px;
|
|
565
|
+
border-top: 1px solid var(--rte-tmpl-border);
|
|
566
|
+
background: var(--rte-tmpl-subtle-bg);
|
|
567
|
+
display: flex;
|
|
568
|
+
justify-content: flex-end;
|
|
569
|
+
gap: 12px;
|
|
570
|
+
}
|
|
571
|
+
.rte-button-primary {
|
|
572
|
+
padding: 8px 16px;
|
|
573
|
+
border: none;
|
|
574
|
+
border-radius: 4px;
|
|
575
|
+
font-size: 14px;
|
|
576
|
+
cursor: pointer;
|
|
577
|
+
background-color: var(--rte-tmpl-accent);
|
|
578
|
+
color: white;
|
|
579
|
+
transition: all 0.2s;
|
|
580
|
+
}
|
|
581
|
+
.rte-button-primary:hover:not([disabled]) {
|
|
582
|
+
background-color: var(--rte-tmpl-accent-strong);
|
|
583
|
+
}
|
|
584
|
+
.rte-button-primary[disabled] {
|
|
585
|
+
opacity: 0.5;
|
|
586
|
+
cursor: not-allowed;
|
|
587
|
+
}
|
|
588
|
+
.rte-button-secondary {
|
|
589
|
+
padding: 8px 16px;
|
|
590
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
591
|
+
border-radius: 4px;
|
|
592
|
+
font-size: 14px;
|
|
593
|
+
cursor: pointer;
|
|
594
|
+
background-color: var(--rte-tmpl-subtle-bg);
|
|
595
|
+
color: var(--rte-tmpl-dialog-text);
|
|
596
|
+
transition: all 0.2s;
|
|
597
|
+
}
|
|
598
|
+
.rte-button-secondary:hover {
|
|
599
|
+
background-color: var(--rte-tmpl-subtle-hover);
|
|
600
|
+
}
|
|
601
|
+
`, document.head.appendChild(e);
|
|
602
|
+
}
|
|
603
|
+
const ie = () => ({
|
|
604
|
+
name: "template",
|
|
605
|
+
toolbar: [
|
|
606
|
+
{
|
|
607
|
+
label: "Template",
|
|
608
|
+
command: "insertTemplate",
|
|
609
|
+
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'
|
|
610
|
+
}
|
|
611
|
+
],
|
|
612
|
+
commands: {
|
|
613
|
+
insertTemplate: (t, e) => (X(e), !0)
|
|
614
|
+
},
|
|
615
|
+
keymap: {}
|
|
616
|
+
});
|
|
617
|
+
export {
|
|
618
|
+
I as PREDEFINED_TEMPLATES,
|
|
619
|
+
ie as TemplatePlugin,
|
|
620
|
+
ae as addCustomTemplate,
|
|
621
|
+
R as getAllTemplates,
|
|
622
|
+
N as getTemplateCategories,
|
|
623
|
+
oe as getTemplatesByCategory,
|
|
624
|
+
V as sanitizeTemplate,
|
|
625
|
+
O as searchTemplates,
|
|
626
|
+
le as validateTemplate
|
|
627
|
+
};
|
|
628
|
+
//# sourceMappingURL=TemplatePlugin.native-BDV2eik2.mjs.map
|