@editora/core 1.0.3 → 1.0.5

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 (131) hide show
  1. package/README.md +34 -0
  2. package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
  3. package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
  4. package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
  5. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
  6. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
  7. package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-B263UI8O.mjs} +624 -473
  8. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +384 -0
  9. package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
  10. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
  11. package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
  12. package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
  13. package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
  14. package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
  15. package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
  16. package/dist/HistoryPlugin.native-TDnVMsEO.mjs +257 -0
  17. package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
  18. package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
  19. package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
  20. package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
  21. package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
  22. package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
  23. package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +419 -0
  24. package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
  25. package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
  26. package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
  27. package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
  28. package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
  29. package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
  30. package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
  31. package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
  32. package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
  33. package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
  34. package/dist/core.css +1 -1
  35. package/dist/editora.min.js +31 -29
  36. package/dist/editora.umd.js +31 -29
  37. package/dist/index-CqWQFb3D.js +10 -0
  38. package/dist/index-OwnkG39N.mjs +2227 -0
  39. package/dist/index.cjs.js +14 -18
  40. package/dist/index.esm.js +204 -521
  41. package/dist/plugin-loader.js +26 -26
  42. package/dist/webcomponent-core.js +1286 -295
  43. package/dist/webcomponent-core.min.css +1 -1
  44. package/dist/webcomponent-core.min.js +111 -78
  45. package/dist/webcomponent.cjs.js +1 -1
  46. package/dist/webcomponent.esm.js +1 -1
  47. package/dist/webcomponent.js +1252 -261
  48. package/dist/webcomponent.min.css +1 -1
  49. package/dist/webcomponent.min.js +3552 -2037
  50. package/index.d.ts +355 -0
  51. package/package.json +21 -18
  52. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
  53. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
  54. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
  55. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
  56. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
  57. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
  58. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
  59. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
  60. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
  61. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
  62. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
  63. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
  64. package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
  65. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
  66. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
  67. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
  68. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
  69. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
  70. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
  71. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
  72. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
  73. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
  74. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
  75. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
  76. package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
  77. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
  78. package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
  79. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
  80. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
  81. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
  82. package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
  83. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
  84. package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
  85. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
  86. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
  87. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
  88. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
  89. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
  90. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
  91. package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
  92. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
  93. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
  94. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
  95. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
  96. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
  97. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
  98. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
  99. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
  100. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
  101. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
  102. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
  103. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
  104. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
  105. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
  106. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
  107. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
  108. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
  109. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
  110. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
  111. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
  112. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
  113. package/dist/documentManager-irzj9n3V.mjs.map +0 -1
  114. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
  115. package/dist/editora.min.js.map +0 -1
  116. package/dist/editora.umd.js.map +0 -1
  117. package/dist/index-BF5RBhL9.js +0 -4
  118. package/dist/index-BF5RBhL9.js.map +0 -1
  119. package/dist/index-BPsf460l.mjs +0 -1243
  120. package/dist/index-BPsf460l.mjs.map +0 -1
  121. package/dist/index.cjs.js.map +0 -1
  122. package/dist/index.es-CuicffkQ.mjs.map +0 -1
  123. package/dist/index.esm.js.map +0 -1
  124. package/dist/plugin-loader.js.map +0 -1
  125. package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
  126. package/dist/webcomponent-core.js.map +0 -1
  127. package/dist/webcomponent-core.min.js.map +0 -1
  128. package/dist/webcomponent.cjs.js.map +0 -1
  129. package/dist/webcomponent.esm.js.map +0 -1
  130. package/dist/webcomponent.js.map +0 -1
  131. package/dist/webcomponent.min.js.map +0 -1
@@ -0,0 +1,384 @@
1
+ const T = () => {
2
+ const d = window.getSelection();
3
+ if (d && d.rangeCount > 0) {
4
+ let t = d.getRangeAt(0).startContainer;
5
+ for (; t && t !== document.body; ) {
6
+ if (t.nodeType === Node.ELEMENT_NODE) {
7
+ const a = t;
8
+ if (a.getAttribute("contenteditable") === "true")
9
+ return a;
10
+ }
11
+ t = t.parentNode;
12
+ }
13
+ }
14
+ const l = document.activeElement;
15
+ if (l) {
16
+ if (l.getAttribute("contenteditable") === "true")
17
+ return l;
18
+ const t = l.closest('[contenteditable="true"]');
19
+ if (t) return t;
20
+ }
21
+ return document.querySelector('[contenteditable="true"]');
22
+ }, k = '[data-theme="dark"], .dark, .editora-theme-dark', A = () => {
23
+ const d = T();
24
+ if (d != null && d.closest(k)) return !0;
25
+ const l = window.getSelection();
26
+ if (l && l.rangeCount > 0) {
27
+ const a = l.getRangeAt(0).startContainer, i = a.nodeType === Node.ELEMENT_NODE ? a : a.parentElement;
28
+ if (i != null && i.closest(k)) return !0;
29
+ }
30
+ const t = document.activeElement;
31
+ return t != null && t.closest(k) ? !0 : document.body.matches(k) || document.documentElement.matches(k);
32
+ }, M = [
33
+ { value: "javascript", label: "JavaScript" },
34
+ { value: "typescript", label: "TypeScript" },
35
+ { value: "python", label: "Python" },
36
+ { value: "java", label: "Java" },
37
+ { value: "csharp", label: "C#" },
38
+ { value: "cpp", label: "C++" },
39
+ { value: "c", label: "C" },
40
+ { value: "php", label: "PHP" },
41
+ { value: "ruby", label: "Ruby" },
42
+ { value: "go", label: "Go" },
43
+ { value: "rust", label: "Rust" },
44
+ { value: "swift", label: "Swift" },
45
+ { value: "kotlin", label: "Kotlin" },
46
+ { value: "html", label: "HTML" },
47
+ { value: "css", label: "CSS" },
48
+ { value: "scss", label: "SCSS" },
49
+ { value: "json", label: "JSON" },
50
+ { value: "xml", label: "XML" },
51
+ { value: "yaml", label: "YAML" },
52
+ { value: "markdown", label: "Markdown" },
53
+ { value: "sql", label: "SQL" },
54
+ { value: "bash", label: "Bash" },
55
+ { value: "shell", label: "Shell" },
56
+ { value: "plaintext", label: "Plain Text" }
57
+ ], S = /* @__PURE__ */ new Map();
58
+ function $(d, l, t, a) {
59
+ const i = !!l, n = a || "javascript", f = t || "", p = A(), e = p ? {
60
+ overlay: "rgba(0, 0, 0, 0.62)",
61
+ dialogBg: "#1f2937",
62
+ dialogBorder: "#4b5563",
63
+ text: "#e2e8f0",
64
+ mutedText: "#a8b5c8",
65
+ headerFooterBg: "#222d3a",
66
+ border: "#3b4657",
67
+ fieldBg: "#111827",
68
+ fieldBorder: "#4b5563",
69
+ cancelBg: "#334155",
70
+ cancelHover: "#475569",
71
+ cancelText: "#e2e8f0",
72
+ primaryBg: "#3b82f6",
73
+ primaryHover: "#2563eb"
74
+ } : {
75
+ overlay: "rgba(0, 0, 0, 0.5)",
76
+ dialogBg: "#ffffff",
77
+ dialogBorder: "#e0e0e0",
78
+ text: "#333333",
79
+ mutedText: "#666666",
80
+ headerFooterBg: "#ffffff",
81
+ border: "#e0e0e0",
82
+ fieldBg: "#ffffff",
83
+ fieldBorder: "#dddddd",
84
+ cancelBg: "#e5e7eb",
85
+ cancelHover: "#d1d5db",
86
+ cancelText: "#333333",
87
+ primaryBg: "#2563eb",
88
+ primaryHover: "#1d4ed8"
89
+ }, c = document.createElement("div");
90
+ c.className = "rte-code-sample-overlay", p && c.classList.add("rte-theme-dark"), c.style.cssText = `
91
+ position: fixed;
92
+ top: 0;
93
+ left: 0;
94
+ right: 0;
95
+ bottom: 0;
96
+ background: ${e.overlay};
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ z-index: 10000;
101
+ animation: fadeIn 160ms ease-out;
102
+ `;
103
+ const o = document.createElement("div");
104
+ o.className = "rte-code-sample-dialog", o.style.cssText = `
105
+ background: ${e.dialogBg};
106
+ border: 1px solid ${e.dialogBorder};
107
+ border-radius: 8px;
108
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
109
+ max-width: 700px;
110
+ width: 90vw;
111
+ max-height: 80vh;
112
+ display: flex;
113
+ flex-direction: column;
114
+ animation: slideUp 200ms cubic-bezier(0.2, 0.9, 0.25, 1);
115
+ `;
116
+ const u = document.createElement("div");
117
+ u.style.cssText = `
118
+ padding: 20px;
119
+ border-bottom: 1px solid ${e.border};
120
+ background: ${e.headerFooterBg};
121
+ display: flex;
122
+ justify-content: space-between;
123
+ align-items: center;
124
+ `, u.innerHTML = `
125
+ <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};">
126
+ ${i ? "Edit Code Sample" : "Insert Code Sample"}
127
+ </h2>
128
+ <button class="rte-code-close-btn" style="background: none; border: none; font-size: 28px; color: ${e.mutedText}; cursor: pointer; padding: 0; width: 32px; height: 32px;">×</button>
129
+ `;
130
+ const m = document.createElement("div");
131
+ m.style.cssText = `
132
+ flex: 1;
133
+ overflow-y: auto;
134
+ padding: 20px;
135
+ `;
136
+ const s = document.createElement("div");
137
+ s.style.marginBottom = "20px", s.innerHTML = `
138
+ <label style="display: block; margin-bottom: 8px; font-weight: 500; color: ${e.text}; font-size: 14px;">Language</label>
139
+ <select class="rte-code-language" style="
140
+ width: 100%;
141
+ padding: 10px 12px;
142
+ border: 1px solid ${e.fieldBorder};
143
+ border-radius: 4px;
144
+ font-size: 14px;
145
+ background-color: ${e.fieldBg};
146
+ color: ${e.text};
147
+ cursor: pointer;
148
+ ">
149
+ ${M.map((r) => `
150
+ <option value="${r.value}" ${r.value === n ? "selected" : ""}>
151
+ ${r.label}
152
+ </option>
153
+ `).join("")}
154
+ </select>
155
+ `;
156
+ const b = document.createElement("div");
157
+ b.style.marginBottom = "20px", b.innerHTML = `
158
+ <label style="display: block; margin-bottom: 8px; font-weight: 500; color: ${e.text}; font-size: 14px;">Code</label>
159
+ <textarea class="rte-code-textarea" spellcheck="false" placeholder="Paste or type your code here..." style="
160
+ width: 100%;
161
+ padding: 12px;
162
+ border: 1px solid ${e.fieldBorder};
163
+ border-radius: 4px;
164
+ font-family: 'Courier New', Courier, monospace;
165
+ font-size: 13px;
166
+ line-height: 1.5;
167
+ resize: vertical;
168
+ min-height: 250px;
169
+ max-height: 400px;
170
+ background-color: ${e.fieldBg};
171
+ color: ${e.text};
172
+ box-sizing: border-box;
173
+ ">${f}</textarea>
174
+ <div class="rte-code-error" style="color: #dc2626; font-size: 12px; margin-top: 6px; display: none;"></div>
175
+ `;
176
+ const x = document.createElement("div");
177
+ x.style.cssText = `color: ${e.mutedText}; font-size: 12px; margin-top: 10px;`, x.innerHTML = "💡 Tip: Press Ctrl+Enter (or Cmd+Enter on Mac) to save, or Escape to cancel", m.appendChild(s), m.appendChild(b), m.appendChild(x);
178
+ const y = document.createElement("div");
179
+ y.style.cssText = `
180
+ padding: 20px;
181
+ border-top: 1px solid ${e.border};
182
+ background: ${e.headerFooterBg};
183
+ display: flex;
184
+ justify-content: flex-end;
185
+ gap: 12px;
186
+ `, y.innerHTML = `
187
+ <button class="rte-code-cancel-btn" style="
188
+ padding: 10px 16px;
189
+ border: none;
190
+ border-radius: 4px;
191
+ font-size: 14px;
192
+ font-weight: 500;
193
+ cursor: pointer;
194
+ background: ${e.cancelBg};
195
+ color: ${e.cancelText};
196
+ ">Cancel</button>
197
+ <button class="rte-code-save-btn" style="
198
+ padding: 10px 16px;
199
+ border: none;
200
+ border-radius: 4px;
201
+ font-size: 14px;
202
+ font-weight: 500;
203
+ cursor: pointer;
204
+ background: ${e.primaryBg};
205
+ color: #fff;
206
+ ">${i ? "Update Code Sample" : "Insert Code Sample"}</button>
207
+ `, o.appendChild(u), o.appendChild(m), o.appendChild(y), c.appendChild(o);
208
+ const L = s.querySelector(".rte-code-language"), E = b.querySelector(".rte-code-textarea"), w = b.querySelector(".rte-code-error"), g = u.querySelector(".rte-code-close-btn"), v = y.querySelector(".rte-code-cancel-btn"), h = y.querySelector(".rte-code-save-btn");
209
+ g.onmouseover = () => {
210
+ g.style.color = "#f8fafc", g.style.background = p ? "#334155" : "#f0f0f0", g.style.borderRadius = "4px";
211
+ }, g.onmouseout = () => {
212
+ g.style.color = e.mutedText, g.style.background = "none";
213
+ }, v.onmouseover = () => {
214
+ v.style.background = e.cancelHover;
215
+ }, v.onmouseout = () => {
216
+ v.style.background = e.cancelBg;
217
+ }, h.onmouseover = () => {
218
+ h.style.background = e.primaryHover;
219
+ }, h.onmouseout = () => {
220
+ h.style.background = e.primaryBg;
221
+ };
222
+ const C = () => {
223
+ c.remove();
224
+ }, B = () => {
225
+ const r = E.value.trim();
226
+ if (!r) {
227
+ w.textContent = "⚠ Code cannot be empty", w.style.display = "block";
228
+ return;
229
+ }
230
+ const N = L.value;
231
+ d(r, N), C();
232
+ };
233
+ if (g.onclick = C, v.onclick = C, h.onclick = B, E.addEventListener("keydown", (r) => {
234
+ (r.ctrlKey || r.metaKey) && r.key === "Enter" && (r.preventDefault(), B()), r.key === "Escape" && C();
235
+ }), E.addEventListener("input", () => {
236
+ w.style.display = "none";
237
+ }), c.addEventListener("click", (r) => {
238
+ r.target === c && C();
239
+ }), !document.getElementById("rte-code-sample-animations")) {
240
+ const r = document.createElement("style");
241
+ r.id = "rte-code-sample-animations", r.textContent = `
242
+ @keyframes fadeIn {
243
+ from { opacity: 0; }
244
+ to { opacity: 1; }
245
+ }
246
+ @keyframes slideUp {
247
+ from { transform: translateY(20px); opacity: 0; }
248
+ to { transform: translateY(0); opacity: 1; }
249
+ }
250
+ `, document.head.appendChild(r);
251
+ }
252
+ return document.body.appendChild(c), setTimeout(() => E.focus(), 100), c;
253
+ }
254
+ function R() {
255
+ if (!T()) return;
256
+ let l = null;
257
+ const t = window.getSelection();
258
+ t && t.rangeCount > 0 && (l = t.getRangeAt(0).cloneRange()), $((a, i) => {
259
+ const n = window.getSelection();
260
+ if (l && (n == null || n.removeAllRanges(), n == null || n.addRange(l)), !n || n.rangeCount === 0) return;
261
+ const f = T();
262
+ if (!f) return;
263
+ const p = n.anchorNode;
264
+ if (!p || !f.contains(p)) return;
265
+ const e = n.getRangeAt(0), c = `code-block-${Date.now()}`, o = document.createElement("pre");
266
+ o.className = "rte-code-block", o.id = c, o.setAttribute("data-type", "code-block"), o.setAttribute("data-lang", i), o.setAttribute("data-code-id", c), o.setAttribute("contenteditable", "false"), o.style.cssText = `
267
+ display: block;
268
+ position: relative;
269
+ background: #f5f5f5;
270
+ border: 1px solid #e0e0e0;
271
+ border-radius: 6px;
272
+ padding: 12px;
273
+ margin: 12px 0;
274
+ overflow-x: auto;
275
+ font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
276
+ font-size: 13px;
277
+ line-height: 1.5;
278
+ color: #333;
279
+ user-select: text;
280
+ cursor: default;
281
+ `;
282
+ const u = document.createElement("code");
283
+ u.className = `language-${i}`, u.style.cssText = `
284
+ font-family: inherit;
285
+ font-size: inherit;
286
+ line-height: inherit;
287
+ color: inherit;
288
+ white-space: pre;
289
+ word-break: normal;
290
+ display: block;
291
+ `, u.textContent = a;
292
+ const m = document.createElement("span");
293
+ m.style.cssText = `
294
+ position: absolute;
295
+ top: 0;
296
+ right: 0;
297
+ background: #333;
298
+ color: #fff;
299
+ padding: 2px 8px;
300
+ font-size: 11px;
301
+ font-weight: bold;
302
+ border-radius: 0 6px 0 4px;
303
+ text-transform: uppercase;
304
+ letter-spacing: 0.5px;
305
+ pointer-events: none;
306
+ `, m.textContent = i;
307
+ const s = document.createElement("button");
308
+ s.className = "rte-code-copy", s.textContent = "Copy", s.style.cssText = `
309
+ position: absolute;
310
+ top: 8px;
311
+ left: 8px;
312
+ background: #fff;
313
+ border: 1px solid #d0d0d0;
314
+ border-radius: 3px;
315
+ padding: 4px 8px;
316
+ font-size: 11px;
317
+ cursor: pointer;
318
+ opacity: 0;
319
+ transition: opacity 0.2s ease;
320
+ `, s.onclick = (x) => {
321
+ x.stopPropagation(), navigator.clipboard.writeText(a).then(() => {
322
+ s.textContent = "✓ Copied!", setTimeout(() => {
323
+ s.textContent = "Copy";
324
+ }, 2e3);
325
+ });
326
+ }, o.appendChild(m), o.appendChild(s), o.appendChild(u), o.addEventListener("mouseenter", () => {
327
+ s.style.opacity = "1";
328
+ }), o.addEventListener("mouseleave", () => {
329
+ s.style.opacity = "0";
330
+ }), o.addEventListener("dblclick", () => {
331
+ z(c);
332
+ }), S.set(c, {
333
+ id: c,
334
+ language: i,
335
+ code: a
336
+ }), e.insertNode(o);
337
+ const b = document.createRange();
338
+ b.setStartAfter(o), b.collapse(!0), n.removeAllRanges(), n.addRange(b);
339
+ });
340
+ }
341
+ function z(d) {
342
+ const l = T();
343
+ if (!l) return;
344
+ const t = l.querySelector(`#${d}`);
345
+ if (!t) return;
346
+ const a = S.get(d);
347
+ a && $(
348
+ (i, n) => {
349
+ const f = t.querySelector("code");
350
+ f && (f.textContent = i, f.className = `language-${n}`);
351
+ const p = t.querySelector("span");
352
+ p && (p.textContent = n), t.setAttribute("data-lang", n), a.language = n, a.code = i;
353
+ const e = t.querySelector(".rte-code-copy");
354
+ e && (e.onclick = (c) => {
355
+ c.stopPropagation(), navigator.clipboard.writeText(i).then(() => {
356
+ e.textContent = "✓ Copied!", setTimeout(() => {
357
+ e.textContent = "Copy";
358
+ }, 2e3);
359
+ });
360
+ });
361
+ },
362
+ d,
363
+ a.code,
364
+ a.language
365
+ );
366
+ }
367
+ const H = () => ({
368
+ name: "codeSample",
369
+ toolbar: [
370
+ {
371
+ label: "Insert Code",
372
+ command: "insertCodeBlock",
373
+ 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>',
374
+ shortcut: "Mod-Shift-C"
375
+ }
376
+ ],
377
+ commands: {
378
+ insertCodeBlock: (...d) => (R(), !0)
379
+ }
380
+ });
381
+ export {
382
+ H as CodeSamplePlugin
383
+ };
384
+ //# sourceMappingURL=CodeSamplePlugin.native-CgGoH-X4.mjs.map