@editora/core 1.0.14 → 1.0.16

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.
Files changed (73) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-veDC_kx5.mjs → CodePlugin.native-BH-K4xmW.mjs} +1049 -917
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/{documentManager-vQ1VkbUY.mjs → documentManager-BcBIv5P-.mjs} +3 -3
  44. package/dist/editora.min.js +26 -24
  45. package/dist/editora.umd.js +26 -24
  46. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  47. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  48. package/dist/index-B1_vtXRz.mjs +3910 -0
  49. package/dist/index-C6BoNR2t.js +12 -0
  50. package/dist/{index-BslAFzmv.mjs → index-CavM-mEM.mjs} +6391 -6203
  51. package/dist/index.cjs.js +3 -3
  52. package/dist/{index.es-BYD2KEo6.mjs → index.es-BK-4TPv8.mjs} +1562 -1546
  53. package/dist/index.esm.js +17 -14
  54. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-BsnKYYHL.mjs} +4 -3
  55. package/dist/plugin-loader.js +53 -52
  56. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-DhWKBjsL.mjs} +3 -3
  57. package/dist/webcomponent-core.js +2039 -473
  58. package/dist/webcomponent-core.min.css +1 -1
  59. package/dist/webcomponent-core.min.js +100 -70
  60. package/dist/webcomponent.cjs.js +1 -1
  61. package/dist/webcomponent.esm.js +1 -1
  62. package/dist/webcomponent.js +2208 -641
  63. package/dist/webcomponent.min.css +1 -1
  64. package/dist/webcomponent.min.js +1575 -1209
  65. package/index.d.ts +32 -0
  66. package/package.json +10 -3
  67. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  68. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  69. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  70. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  71. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  72. package/dist/index-B9MPiUAR.mjs +0 -2341
  73. package/dist/index-BLm1MtzH.js +0 -10
@@ -0,0 +1,501 @@
1
+ import { e as U } from "./escapeHtml-CX8RelZ1.mjs";
2
+ import { i as F } from "./dialogHelpers-DBf7WqYH.mjs";
3
+ import { r as P } from "./historyHelpers-B0-4mq1E.mjs";
4
+ const G = /* @__PURE__ */ new Set([
5
+ "DIV",
6
+ "P",
7
+ "BLOCKQUOTE",
8
+ "PRE",
9
+ "H1",
10
+ "H2",
11
+ "H3",
12
+ "H4",
13
+ "H5",
14
+ "H6",
15
+ "LI",
16
+ "TD",
17
+ "TH"
18
+ ]);
19
+ function N(t, o) {
20
+ let e = t;
21
+ for (; e && e !== o; ) {
22
+ if (e.nodeType === Node.ELEMENT_NODE && G.has(e.tagName))
23
+ return e;
24
+ e = e.parentNode;
25
+ }
26
+ return null;
27
+ }
28
+ const I = () => {
29
+ const t = window.getSelection();
30
+ if (t && t.rangeCount > 0) {
31
+ let e = t.getRangeAt(0).startContainer;
32
+ for (; e && e !== document.body; ) {
33
+ if (e.nodeType === Node.ELEMENT_NODE) {
34
+ const n = e;
35
+ if (n.getAttribute("contenteditable") === "true")
36
+ return n;
37
+ }
38
+ e = e.parentNode;
39
+ }
40
+ }
41
+ const o = document.activeElement;
42
+ if (o) {
43
+ if (o.getAttribute("contenteditable") === "true")
44
+ return o;
45
+ const e = o.closest('[contenteditable="true"]');
46
+ if (e) return e;
47
+ }
48
+ return document.querySelector('[contenteditable="true"]');
49
+ }, C = '[data-theme="dark"], .dark, .editora-theme-dark', Z = () => {
50
+ const t = I();
51
+ if (t != null && t.closest(C)) return !0;
52
+ const o = window.getSelection();
53
+ if (o && o.rangeCount > 0) {
54
+ const n = o.getRangeAt(0).startContainer, l = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
55
+ if (l != null && l.closest(C)) return !0;
56
+ }
57
+ const e = document.activeElement;
58
+ return e != null && e.closest(C) ? !0 : document.body.matches(C) || document.documentElement.matches(C);
59
+ }, J = [
60
+ { value: "javascript", label: "JavaScript" },
61
+ { value: "typescript", label: "TypeScript" },
62
+ { value: "python", label: "Python" },
63
+ { value: "java", label: "Java" },
64
+ { value: "csharp", label: "C#" },
65
+ { value: "cpp", label: "C++" },
66
+ { value: "c", label: "C" },
67
+ { value: "php", label: "PHP" },
68
+ { value: "ruby", label: "Ruby" },
69
+ { value: "go", label: "Go" },
70
+ { value: "rust", label: "Rust" },
71
+ { value: "swift", label: "Swift" },
72
+ { value: "kotlin", label: "Kotlin" },
73
+ { value: "html", label: "HTML" },
74
+ { value: "css", label: "CSS" },
75
+ { value: "scss", label: "SCSS" },
76
+ { value: "json", label: "JSON" },
77
+ { value: "xml", label: "XML" },
78
+ { value: "yaml", label: "YAML" },
79
+ { value: "markdown", label: "Markdown" },
80
+ { value: "sql", label: "SQL" },
81
+ { value: "bash", label: "Bash" },
82
+ { value: "shell", label: "Shell" },
83
+ { value: "plaintext", label: "Plain Text" }
84
+ ];
85
+ let E = null;
86
+ function O(t, o, e, n) {
87
+ E && (E.remove(), E = null);
88
+ const l = !!o, f = n || "javascript", u = e || "", d = Z(), a = d ? {
89
+ overlay: "rgba(0, 0, 0, 0.62)",
90
+ dialogBg: "#1f2937",
91
+ dialogBorder: "#4b5563",
92
+ text: "#e2e8f0",
93
+ mutedText: "#a8b5c8",
94
+ headerFooterBg: "#222d3a",
95
+ border: "#3b4657",
96
+ fieldBg: "#111827",
97
+ fieldBorder: "#4b5563",
98
+ cancelBg: "#334155",
99
+ cancelHover: "#475569",
100
+ cancelText: "#e2e8f0",
101
+ primaryBg: "#3b82f6",
102
+ primaryHover: "#2563eb"
103
+ } : {
104
+ overlay: "rgba(0, 0, 0, 0.5)",
105
+ dialogBg: "#ffffff",
106
+ dialogBorder: "#e0e0e0",
107
+ text: "#333333",
108
+ mutedText: "#666666",
109
+ headerFooterBg: "#ffffff",
110
+ border: "#e0e0e0",
111
+ fieldBg: "#ffffff",
112
+ fieldBorder: "#dddddd",
113
+ cancelBg: "#e5e7eb",
114
+ cancelHover: "#d1d5db",
115
+ cancelText: "#333333",
116
+ primaryBg: "#2563eb",
117
+ primaryHover: "#1d4ed8"
118
+ }, i = document.createElement("div");
119
+ F(i), i.className = "rte-code-sample-overlay", d && i.classList.add("rte-theme-dark"), i.style.cssText = `
120
+ position: fixed;
121
+ top: 0;
122
+ left: 0;
123
+ right: 0;
124
+ bottom: 0;
125
+ background: ${a.overlay};
126
+ display: flex;
127
+ align-items: center;
128
+ justify-content: center;
129
+ z-index: 10000;
130
+ animation: fadeIn 160ms ease-out;
131
+ `;
132
+ const c = document.createElement("div");
133
+ c.className = "rte-code-sample-dialog", c.style.cssText = `
134
+ background: ${a.dialogBg};
135
+ border: 1px solid ${a.dialogBorder};
136
+ border-radius: 8px;
137
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
138
+ max-width: 700px;
139
+ width: 90vw;
140
+ max-height: 80vh;
141
+ display: flex;
142
+ flex-direction: column;
143
+ animation: slideUp 200ms cubic-bezier(0.2, 0.9, 0.25, 1);
144
+ `;
145
+ const m = document.createElement("div");
146
+ m.style.cssText = `
147
+ padding: 20px;
148
+ border-bottom: 1px solid ${a.border};
149
+ background: ${a.headerFooterBg};
150
+ display: flex;
151
+ justify-content: space-between;
152
+ align-items: center;
153
+ `, m.innerHTML = `
154
+ <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${a.text};">
155
+ ${l ? "Edit Code Sample" : "Insert Code Sample"}
156
+ </h2>
157
+ <button class="rte-code-close-btn" style="background: none; border: none; font-size: 28px; color: ${a.mutedText}; cursor: pointer; padding: 0; width: 32px; height: 32px;">×</button>
158
+ `;
159
+ const b = document.createElement("div");
160
+ b.style.cssText = `
161
+ flex: 1;
162
+ overflow-y: auto;
163
+ padding: 20px;
164
+ `;
165
+ const k = document.createElement("div");
166
+ k.style.marginBottom = "20px", k.innerHTML = `
167
+ <label style="display: block; margin-bottom: 8px; font-weight: 500; color: ${a.text}; font-size: 14px;">Language</label>
168
+ <select class="rte-code-language" style="
169
+ width: 100%;
170
+ padding: 10px 12px;
171
+ border: 1px solid ${a.fieldBorder};
172
+ border-radius: 4px;
173
+ font-size: 14px;
174
+ background-color: ${a.fieldBg};
175
+ color: ${a.text};
176
+ cursor: pointer;
177
+ ">
178
+ ${J.map((r) => `
179
+ <option value="${r.value}" ${r.value === f ? "selected" : ""}>
180
+ ${r.label}
181
+ </option>
182
+ `).join("")}
183
+ </select>
184
+ `;
185
+ const g = document.createElement("div");
186
+ g.style.marginBottom = "20px", g.innerHTML = `
187
+ <label style="display: block; margin-bottom: 8px; font-weight: 500; color: ${a.text}; font-size: 14px;">Code</label>
188
+ <textarea class="rte-code-textarea" spellcheck="false" placeholder="Paste or type your code here..." style="
189
+ width: 100%;
190
+ padding: 12px;
191
+ border: 1px solid ${a.fieldBorder};
192
+ border-radius: 4px;
193
+ font-family: 'Courier New', Courier, monospace;
194
+ font-size: 13px;
195
+ line-height: 1.5;
196
+ resize: vertical;
197
+ min-height: 250px;
198
+ max-height: 400px;
199
+ background-color: ${a.fieldBg};
200
+ color: ${a.text};
201
+ box-sizing: border-box;
202
+ ">${U(u)}</textarea>
203
+ <div class="rte-code-error" style="color: #dc2626; font-size: 12px; margin-top: 6px; display: none;"></div>
204
+ `;
205
+ const L = document.createElement("div");
206
+ L.style.cssText = `color: ${a.mutedText}; font-size: 12px; margin-top: 10px;`, L.innerHTML = "💡 Tip: Press Ctrl+Enter (or Cmd+Enter on Mac) to save, or Escape to cancel", b.appendChild(k), b.appendChild(g), b.appendChild(L);
207
+ const y = document.createElement("div");
208
+ y.style.cssText = `
209
+ padding: 20px;
210
+ border-top: 1px solid ${a.border};
211
+ background: ${a.headerFooterBg};
212
+ display: flex;
213
+ justify-content: flex-end;
214
+ gap: 12px;
215
+ `, y.innerHTML = `
216
+ <button class="rte-code-cancel-btn" style="
217
+ padding: 10px 16px;
218
+ border: none;
219
+ border-radius: 4px;
220
+ font-size: 14px;
221
+ font-weight: 500;
222
+ cursor: pointer;
223
+ background: ${a.cancelBg};
224
+ color: ${a.cancelText};
225
+ ">Cancel</button>
226
+ <button class="rte-code-save-btn" style="
227
+ padding: 10px 16px;
228
+ border: none;
229
+ border-radius: 4px;
230
+ font-size: 14px;
231
+ font-weight: 500;
232
+ cursor: pointer;
233
+ background: ${a.primaryBg};
234
+ color: #fff;
235
+ ">${l ? "Update Code Sample" : "Insert Code Sample"}</button>
236
+ `, c.appendChild(m), c.appendChild(b), c.appendChild(y), i.appendChild(c);
237
+ const V = k.querySelector(".rte-code-language"), w = g.querySelector(".rte-code-textarea"), $ = g.querySelector(".rte-code-error"), p = m.querySelector(".rte-code-close-btn"), x = y.querySelector(".rte-code-cancel-btn"), v = y.querySelector(".rte-code-save-btn");
238
+ p.onmouseover = () => {
239
+ p.style.color = "#f8fafc", p.style.background = d ? "#334155" : "#f0f0f0", p.style.borderRadius = "4px";
240
+ }, p.onmouseout = () => {
241
+ p.style.color = a.mutedText, p.style.background = "none";
242
+ }, x.onmouseover = () => {
243
+ x.style.background = a.cancelHover;
244
+ }, x.onmouseout = () => {
245
+ x.style.background = a.cancelBg;
246
+ }, v.onmouseover = () => {
247
+ v.style.background = a.primaryHover;
248
+ }, v.onmouseout = () => {
249
+ v.style.background = a.primaryBg;
250
+ };
251
+ const h = () => {
252
+ i.remove(), E = null;
253
+ }, R = () => {
254
+ const r = w.value.replace(/^(?:[ \t]*\r?\n)+/, "").replace(/\s+$/, "");
255
+ if (!r.trim()) {
256
+ $.textContent = "⚠ Code cannot be empty", $.style.display = "block";
257
+ return;
258
+ }
259
+ const K = V.value;
260
+ t(r, K), h();
261
+ };
262
+ if (p.onclick = h, x.onclick = h, v.onclick = R, w.addEventListener("keydown", (r) => {
263
+ (r.ctrlKey || r.metaKey) && r.key === "Enter" && (r.preventDefault(), R()), r.key === "Escape" && h();
264
+ }), w.addEventListener("input", () => {
265
+ $.style.display = "none";
266
+ }), i.addEventListener("click", (r) => {
267
+ r.target === i && h();
268
+ }), !document.getElementById("rte-code-sample-animations")) {
269
+ const r = document.createElement("style");
270
+ r.id = "rte-code-sample-animations", r.textContent = `
271
+ @keyframes fadeIn {
272
+ from { opacity: 0; }
273
+ to { opacity: 1; }
274
+ }
275
+ @keyframes slideUp {
276
+ from { transform: translateY(20px); opacity: 0; }
277
+ to { transform: translateY(0); opacity: 1; }
278
+ }
279
+ `, document.head.appendChild(r);
280
+ }
281
+ return E = i, document.body.appendChild(i), setTimeout(() => w.focus(), 100), i;
282
+ }
283
+ const M = 'pre.rte-code-block, pre[data-type="code-block"]';
284
+ function _() {
285
+ if (document.getElementById("rte-code-sample-block-styles")) return;
286
+ const t = document.createElement("style");
287
+ t.id = "rte-code-sample-block-styles", t.textContent = `
288
+ pre.rte-code-block[data-lang]::after {
289
+ content: attr(data-lang);
290
+ position: absolute;
291
+ top: 0;
292
+ right: 0;
293
+ background: #333;
294
+ color: #fff;
295
+ padding: 2px 8px;
296
+ font-size: 11px;
297
+ font-weight: bold;
298
+ border-radius: 0 6px 0 4px;
299
+ text-transform: uppercase;
300
+ letter-spacing: 0.5px;
301
+ pointer-events: none;
302
+ }
303
+
304
+ pre.rte-code-block:focus-visible {
305
+ outline: 2px solid #2563eb;
306
+ outline-offset: 2px;
307
+ }
308
+
309
+ .rte-code-copy-floating {
310
+ position: fixed;
311
+ z-index: 9999;
312
+ display: none;
313
+ background: #fff;
314
+ color: #333;
315
+ border: 1px solid #d0d0d0;
316
+ border-radius: 3px;
317
+ padding: 4px 8px;
318
+ font: 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
319
+ cursor: pointer;
320
+ }
321
+
322
+ .rte-code-copy-floating:hover {
323
+ background: #f3f4f6;
324
+ }
325
+
326
+ @media print {
327
+ .rte-code-copy-floating {
328
+ display: none !important;
329
+ }
330
+ }
331
+ `, document.head.appendChild(t);
332
+ }
333
+ function q(t) {
334
+ var o, e;
335
+ return (e = (o = t.querySelector("code")) == null ? void 0 : o.textContent) != null ? e : "";
336
+ }
337
+ function Y(t) {
338
+ return t.getAttribute("data-lang") || "plaintext";
339
+ }
340
+ function Q(t, o) {
341
+ const e = document.createElement("pre");
342
+ e.className = "rte-code-block", e.setAttribute("data-type", "code-block"), e.setAttribute("data-lang", o), e.setAttribute("contenteditable", "false"), e.setAttribute("tabindex", "0"), e.setAttribute("role", "group"), e.setAttribute("aria-label", `Code sample (${o}). Press Enter to edit.`), e.style.cssText = `
343
+ display: block;
344
+ position: relative;
345
+ background: #f5f5f5;
346
+ border: 1px solid #e0e0e0;
347
+ border-radius: 6px;
348
+ padding: 30px 12px 12px;
349
+ margin: 12px 0;
350
+ overflow-x: auto;
351
+ font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
352
+ font-size: 13px;
353
+ line-height: 1.5;
354
+ color: #333;
355
+ user-select: text;
356
+ cursor: default;
357
+ `;
358
+ const n = document.createElement("code");
359
+ return n.className = `language-${o}`, n.style.cssText = `
360
+ font-family: inherit;
361
+ font-size: inherit;
362
+ line-height: inherit;
363
+ color: inherit;
364
+ white-space: pre;
365
+ word-break: normal;
366
+ display: block;
367
+ `, n.textContent = t, e.appendChild(n), e;
368
+ }
369
+ function X(t, o, e) {
370
+ let n = t.querySelector("code");
371
+ n || (n = document.createElement("code")), n.textContent = o, n.className = `language-${e}`, Array.from(t.childNodes).forEach((l) => {
372
+ l !== n && t.removeChild(l);
373
+ }), t.appendChild(n), t.setAttribute("data-lang", e), t.setAttribute("aria-label", `Code sample (${e}). Press Enter to edit.`), t.style.paddingTop = "30px";
374
+ }
375
+ let s = null, A = null, B = null, T = null;
376
+ function S() {
377
+ B !== null && (window.clearTimeout(B), B = null);
378
+ }
379
+ function H() {
380
+ S(), s && (s.style.display = "none"), A = null;
381
+ }
382
+ function j() {
383
+ S(), B = window.setTimeout(H, 120);
384
+ }
385
+ async function W(t) {
386
+ try {
387
+ if (navigator.clipboard && window.isSecureContext)
388
+ return await navigator.clipboard.writeText(t), !0;
389
+ } catch (f) {
390
+ }
391
+ const o = document.createElement("textarea");
392
+ o.value = t, o.setAttribute("readonly", ""), o.style.cssText = "position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none;", document.body.appendChild(o);
393
+ const e = window.getSelection(), n = e && e.rangeCount > 0 ? e.getRangeAt(0).cloneRange() : null;
394
+ o.select();
395
+ let l = !1;
396
+ try {
397
+ l = document.execCommand("copy");
398
+ } catch (f) {
399
+ l = !1;
400
+ }
401
+ return o.remove(), n && e && (e.removeAllRanges(), e.addRange(n)), l;
402
+ }
403
+ function ee() {
404
+ if (s && s.isConnected) return s;
405
+ const t = document.createElement("button");
406
+ return t.type = "button", t.className = "rte-code-copy-floating", t.textContent = "Copy", t.setAttribute("aria-label", "Copy code"), t.addEventListener("mousedown", (o) => o.preventDefault()), t.addEventListener("mouseenter", S), t.addEventListener("mouseleave", j), t.addEventListener("click", async (o) => {
407
+ o.stopPropagation();
408
+ const e = A;
409
+ if (!e) return;
410
+ const n = await W(q(e));
411
+ t.textContent = n ? "✓ Copied!" : "Copy failed", T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
412
+ t.textContent = "Copy", T = null;
413
+ }, 2e3);
414
+ }), document.body.appendChild(t), s = t, t;
415
+ }
416
+ function te(t) {
417
+ _();
418
+ const o = ee();
419
+ S(), A = t;
420
+ const e = t.getBoundingClientRect();
421
+ o.style.left = `${Math.max(0, e.left + 8)}px`, o.style.top = `${Math.max(0, e.top + 5)}px`, o.style.display = "block";
422
+ }
423
+ function z(t) {
424
+ var o;
425
+ return !!((o = t.parentElement) != null && o.closest('[contenteditable="true"]'));
426
+ }
427
+ function oe() {
428
+ if (typeof document == "undefined" || window.__codeSampleInteractionsReady) return;
429
+ window.__codeSampleInteractionsReady = !0;
430
+ const t = (o) => {
431
+ var n;
432
+ const e = o instanceof Element ? o : o instanceof Node ? o.parentElement : null;
433
+ return (n = e == null ? void 0 : e.closest(M)) != null ? n : null;
434
+ };
435
+ document.addEventListener("mouseover", (o) => {
436
+ const e = t(o.target);
437
+ e && te(e);
438
+ }), document.addEventListener("mouseout", (o) => {
439
+ t(o.target) && !(o.relatedTarget instanceof Node && (s != null && s.contains(o.relatedTarget))) && j();
440
+ }), document.addEventListener("scroll", H, !0), window.addEventListener("resize", H), document.addEventListener("dblclick", (o) => {
441
+ const e = t(o.target);
442
+ e && z(e) && D(e);
443
+ }), document.addEventListener("keydown", (o) => {
444
+ if (o.key !== "Enter" || o.target !== document.activeElement) return;
445
+ const e = o.target instanceof HTMLElement && o.target.matches(M) ? o.target : null;
446
+ e && z(e) && (o.preventDefault(), D(e));
447
+ });
448
+ }
449
+ typeof window != "undefined" && oe();
450
+ function ne() {
451
+ const t = I();
452
+ if (!t || t.getAttribute("contenteditable") !== "true") return;
453
+ let o = null;
454
+ const e = window.getSelection();
455
+ e && e.rangeCount > 0 && t.contains(e.getRangeAt(0).commonAncestorContainer) && (o = e.getRangeAt(0).cloneRange()), O((n, l) => {
456
+ if (!t.isConnected) return;
457
+ _();
458
+ const f = t.innerHTML, u = Q(n, l), d = o ? o.cloneRange() : document.createRange();
459
+ o || (d.selectNodeContents(t), d.collapse(!1));
460
+ const a = N(d.endContainer, t) || N(d.startContainer, t);
461
+ if (a && a.parentNode ? a.parentNode.insertBefore(u, a.nextSibling) : o ? d.insertNode(u) : t.appendChild(u), !u.nextSibling) {
462
+ const m = document.createElement("p");
463
+ m.appendChild(document.createElement("br")), u.after(m);
464
+ }
465
+ const i = document.createRange();
466
+ i.setStartAfter(u), i.collapse(!0);
467
+ const c = window.getSelection();
468
+ c == null || c.removeAllRanges(), c == null || c.addRange(i), P(t, f), t.dispatchEvent(new Event("input", { bubbles: !0 }));
469
+ });
470
+ }
471
+ function D(t) {
472
+ const o = t.closest('[contenteditable="true"]');
473
+ o && O(
474
+ (e, n) => {
475
+ if (!t.isConnected) return;
476
+ const l = o.innerHTML;
477
+ X(t, e, n), P(o, l), o.dispatchEvent(new Event("input", { bubbles: !0 }));
478
+ },
479
+ "editing",
480
+ q(t),
481
+ Y(t)
482
+ );
483
+ }
484
+ const ie = () => ({
485
+ name: "codeSample",
486
+ toolbar: [
487
+ {
488
+ label: "Insert Code",
489
+ command: "insertCodeBlock",
490
+ icon: '<svg width="24" height="26" focusable="false"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"></path></svg>',
491
+ shortcut: "Mod-Shift-C"
492
+ }
493
+ ],
494
+ commands: {
495
+ insertCodeBlock: () => (ne(), !0)
496
+ }
497
+ });
498
+ export {
499
+ ie as CodeSamplePlugin
500
+ };
501
+ //# sourceMappingURL=CodeSamplePlugin.native-svbAFWh_.mjs.map