@editora/plugins 1.0.16 → 1.0.18

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 (109) hide show
  1. package/dist/CodePlugin.native-Bwf25lLX.js +460 -0
  2. package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
  3. package/dist/a11y-checker.cjs.js +16 -16
  4. package/dist/a11y-checker.esm.js +79 -75
  5. package/dist/anchor.cjs.js +9 -9
  6. package/dist/anchor.esm.js +61 -60
  7. package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
  8. package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
  9. package/dist/approval-workflow.cjs.js +5 -5
  10. package/dist/approval-workflow.esm.js +105 -104
  11. package/dist/background-color.cjs.js +1 -1
  12. package/dist/background-color.esm.js +1 -1
  13. package/dist/blocks-library.cjs.js +6 -6
  14. package/dist/blocks-library.esm.js +226 -202
  15. package/dist/capitalization.cjs.js +1 -1
  16. package/dist/capitalization.esm.js +9 -4
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +154 -116
  19. package/dist/citations.cjs.js +43 -18
  20. package/dist/citations.esm.js +465 -446
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +21 -20
  23. package/dist/code-sample.cjs.js +85 -66
  24. package/dist/code-sample.esm.js +301 -190
  25. package/dist/code.cjs.js +1 -669
  26. package/dist/code.esm.js +2 -4560
  27. package/dist/collaboration.cjs.js +68 -0
  28. package/dist/collaboration.esm.js +7428 -0
  29. package/dist/comments.cjs.js +11 -11
  30. package/dist/comments.esm.js +284 -237
  31. package/dist/conditional-content.cjs.js +67 -60
  32. package/dist/conditional-content.esm.js +270 -220
  33. package/dist/data-binding.cjs.js +3 -3
  34. package/dist/data-binding.esm.js +28 -27
  35. package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
  36. package/dist/dialogHelpers-zU6zpMIA.js +12 -0
  37. package/dist/document-manager.cjs.js +1 -1
  38. package/dist/document-manager.esm.js +1 -1
  39. package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
  40. package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
  41. package/dist/embed-iframe.cjs.js +37 -17
  42. package/dist/embed-iframe.esm.js +188 -143
  43. package/dist/emojis.cjs.js +13 -10
  44. package/dist/emojis.esm.js +288 -76
  45. package/dist/enterprise.cjs.js +1 -1
  46. package/dist/enterprise.esm.js +9 -7
  47. package/dist/escapeHtml-D2Zh82pD.js +1 -0
  48. package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +48 -41
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +67 -60
  53. package/dist/format-painter.cjs.js +1 -1
  54. package/dist/format-painter.esm.js +2 -1
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +40 -36
  57. package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
  58. package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
  59. package/dist/index-Bm1eqYHh.mjs +194 -0
  60. package/dist/index-CoflqYuK.js +30 -0
  61. package/dist/index-CxhJLMPS.js +221 -0
  62. package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
  63. package/dist/index.cjs.js +1 -1
  64. package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
  65. package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
  66. package/dist/index.esm.js +17 -15
  67. package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
  68. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
  69. package/dist/link.cjs.js +17 -13
  70. package/dist/link.esm.js +138 -69
  71. package/dist/list.cjs.js +1 -1
  72. package/dist/list.esm.js +66 -33
  73. package/dist/math.cjs.js +22 -22
  74. package/dist/math.esm.js +221 -126
  75. package/dist/media-manager.cjs.js +12 -12
  76. package/dist/media-manager.esm.js +55 -50
  77. package/dist/mentions.cjs.js +2 -2
  78. package/dist/mentions.esm.js +17 -12
  79. package/dist/merge-tag.cjs.js +2 -2
  80. package/dist/merge-tag.esm.js +43 -42
  81. package/dist/plugins.css +1 -1
  82. package/dist/preview.cjs.js +3 -3
  83. package/dist/preview.esm.js +30 -27
  84. package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
  85. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
  86. package/dist/slash-commands.cjs.js +13 -7
  87. package/dist/slash-commands.esm.js +90 -79
  88. package/dist/smart-paste.cjs.js +5 -5
  89. package/dist/smart-paste.esm.js +85 -81
  90. package/dist/special-characters.cjs.js +6 -3
  91. package/dist/special-characters.esm.js +72 -25
  92. package/dist/spell-check.cjs.js +8 -8
  93. package/dist/spell-check.esm.js +10189 -295
  94. package/dist/table.cjs.js +166 -13
  95. package/dist/table.esm.js +543 -266
  96. package/dist/template.cjs.js +11 -11
  97. package/dist/template.esm.js +290 -264
  98. package/dist/text-color.cjs.js +1 -1
  99. package/dist/text-color.esm.js +1 -1
  100. package/dist/translation-workflow.cjs.js +4 -4
  101. package/dist/translation-workflow.esm.js +33 -31
  102. package/dist/version-diff.cjs.js +6 -6
  103. package/dist/version-diff.esm.js +40 -40
  104. package/package.json +10 -4
  105. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  106. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  107. package/dist/index-BFsKNTTj.mjs +0 -145
  108. package/dist/index-CvJk4DKa.js +0 -221
  109. package/dist/index-tqLTHcO6.js +0 -1
@@ -0,0 +1,648 @@
1
+ import { i as Z } from "./dialogHelpers-5d5BuOCW.mjs";
2
+ import { createEditor as I, LineNumbersExtension as U, ThemeExtension as P, ReadOnlyExtension as _, BracketMatchingExtension as $, SearchExtension as K, CodeFoldingExtension as Y, SyntaxHighlightingExtension as G } from "@editora/light-code-editor";
3
+ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Editor Dialog Styles */
4
+ .rte-source-editor-overlay {
5
+ position: fixed !important;
6
+ top: 0 !important;
7
+ left: 0 !important;
8
+ right: 0 !important;
9
+ bottom: 0 !important;
10
+ width: 100vw !important;
11
+ height: 100vh !important;
12
+ background-color: rgba(0, 0, 0, 0.6) !important;
13
+ display: flex !important;
14
+ align-items: center !important;
15
+ justify-content: center !important;
16
+ z-index: 10000 !important;
17
+ padding: 20px !important;
18
+ box-sizing: border-box !important;
19
+ margin: 0 !important;
20
+ }
21
+
22
+ .rte-source-editor-overlay.fullscreen {
23
+ padding: 0 !important;
24
+ }
25
+
26
+ .rte-source-editor-modal {
27
+ background: white;
28
+ border-radius: 8px;
29
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
30
+ width: 100%;
31
+ max-width: 1200px;
32
+ max-height: 90vh;
33
+ display: flex;
34
+ flex-direction: column;
35
+ overflow: hidden;
36
+ position: relative;
37
+ }
38
+
39
+ .rte-source-editor-overlay.fullscreen .rte-source-editor-modal {
40
+ border-radius: 0;
41
+ max-width: 100%;
42
+ max-height: 100vh;
43
+ width: 100%;
44
+ height: 100vh;
45
+ }
46
+
47
+ .rte-source-editor-header {
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: space-between;
51
+ padding: 16px 20px;
52
+ border-bottom: 1px solid #e1e5e9;
53
+ background: #f8f9fa;
54
+ border-radius: 8px 8px 0 0;
55
+ }
56
+
57
+ .rte-source-editor-overlay.fullscreen .rte-source-editor-header {
58
+ border-radius: 0;
59
+ }
60
+
61
+ .rte-source-editor-header h2 {
62
+ margin: 0;
63
+ font-size: 18px;
64
+ font-weight: 600;
65
+ color: #1a1a1a;
66
+ }
67
+
68
+ .rte-source-editor-header-toolbar {
69
+ display: flex;
70
+ gap: 8px;
71
+ margin-left: auto;
72
+ margin-right: 16px;
73
+ }
74
+
75
+ .rte-source-editor-toolbar-btn {
76
+ background: none;
77
+ border: none;
78
+ cursor: pointer;
79
+ padding: 6px;
80
+ border-radius: 4px;
81
+ font-size: 16px;
82
+ line-height: 1;
83
+ transition: all 0.2s ease;
84
+ color: #666;
85
+ }
86
+
87
+ .rte-source-editor-toolbar-btn:hover:not(:disabled) {
88
+ background: #e1e5e9;
89
+ color: #1a1a1a;
90
+ }
91
+
92
+ .rte-source-editor-toolbar-btn:disabled {
93
+ opacity: 0.5;
94
+ cursor: not-allowed;
95
+ }
96
+
97
+ .rte-source-editor-toolbar-btn.active {
98
+ background: #007acc;
99
+ color: white;
100
+ }
101
+
102
+ .rte-source-editor-toolbar-btn.active:hover {
103
+ background: #0056b3;
104
+ }
105
+
106
+ .rte-source-editor-header-actions {
107
+ display: flex;
108
+ gap: 8px;
109
+ }
110
+
111
+ .rte-source-editor-fullscreen-btn,
112
+ .rte-source-editor-close-btn {
113
+ background: none;
114
+ border: none;
115
+ cursor: pointer;
116
+ padding: 4px;
117
+ border-radius: 4px;
118
+ color: #666;
119
+ font-size: 16px;
120
+ line-height: 1;
121
+ transition: all 0.2s ease;
122
+ }
123
+
124
+ .rte-source-editor-fullscreen-btn:hover,
125
+ .rte-source-editor-close-btn:hover {
126
+ background: #e1e5e9;
127
+ color: #1a1a1a;
128
+ }
129
+
130
+ .rte-source-editor-body {
131
+ flex: 1;
132
+ overflow: hidden;
133
+ display: flex;
134
+ flex-direction: column;
135
+ }
136
+
137
+ .rte-source-editor-loading {
138
+ display: flex;
139
+ flex-direction: column;
140
+ align-items: center;
141
+ justify-content: center;
142
+ padding: 40px;
143
+ color: #666;
144
+ position: absolute;
145
+ z-index: 9;
146
+ margin: 0 auto;
147
+ width: 100%;
148
+ top: 44%;
149
+ }
150
+
151
+ .rte-source-editor-spinner {
152
+ width: 32px;
153
+ height: 32px;
154
+ border: 3px solid #e1e5e9;
155
+ border-top: 3px solid #007acc;
156
+ border-radius: 50%;
157
+ animation: spin 1s linear infinite;
158
+ margin-bottom: 16px;
159
+ }
160
+
161
+ @keyframes spin {
162
+ 0% { transform: rotate(0deg); }
163
+ 100% { transform: rotate(360deg); }
164
+ }
165
+
166
+ .rte-source-editor-error {
167
+ background: #fee;
168
+ color: #c53030;
169
+ padding: 12px 16px;
170
+ border-left: 4px solid #c53030;
171
+ margin: 16px;
172
+ border-radius: 4px;
173
+ font-size: 14px;
174
+ }
175
+
176
+ .rte-source-editor-content {
177
+ flex: 1;
178
+ display: flex;
179
+ flex-direction: column;
180
+ overflow: hidden;
181
+ }
182
+
183
+ .rte-source-editor-warning {
184
+ background: #fefcbf;
185
+ color: #744210;
186
+ padding: 8px 16px;
187
+ font-size: 12px;
188
+ font-weight: 500;
189
+ border-bottom: 1px solid #f6e05e;
190
+ }
191
+
192
+ .rte-source-editor-codemirror {
193
+ flex: 1;
194
+ overflow: auto;
195
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
196
+ font-size: 14px;
197
+ line-height: 1.5;
198
+ }
199
+
200
+ .rte-source-editor-codemirror .cm-editor {
201
+ height: 100%;
202
+ }
203
+
204
+ .rte-source-editor-codemirror .cm-focused {
205
+ outline: none;
206
+ }
207
+
208
+ .rte-source-editor-footer {
209
+ display: flex;
210
+ align-items: center;
211
+ justify-content: space-between;
212
+ padding: 16px 20px;
213
+ border-top: 1px solid #e1e5e9;
214
+ background: #f8f9fa;
215
+ border-radius: 0 0 8px 8px;
216
+ }
217
+
218
+ .rte-source-editor-overlay.fullscreen .rte-source-editor-footer {
219
+ border-radius: 0;
220
+ }
221
+
222
+ .rte-source-editor-footer-info {
223
+ font-size: 12px;
224
+ color: #666;
225
+ }
226
+
227
+ .unsaved-changes {
228
+ color: #d69e2e;
229
+ font-weight: 500;
230
+ }
231
+
232
+ .rte-source-editor-footer-actions {
233
+ display: flex;
234
+ gap: 12px;
235
+ }
236
+
237
+ .rte-source-editor-btn {
238
+ padding: 8px 16px;
239
+ border-radius: 4px;
240
+ font-size: 14px;
241
+ font-weight: 500;
242
+ cursor: pointer;
243
+ border: 1px solid transparent;
244
+ transition: all 0.2s ease;
245
+ }
246
+
247
+ .rte-source-editor-btn:disabled {
248
+ opacity: 0.6;
249
+ cursor: not-allowed;
250
+ }
251
+
252
+ .rte-source-editor-btn-cancel {
253
+ background: white;
254
+ border-color: #d1d5db;
255
+ color: #374151;
256
+ }
257
+
258
+ .rte-source-editor-btn-cancel:hover:not(:disabled) {
259
+ background: #f9fafb;
260
+ border-color: #9ca3af;
261
+ }
262
+
263
+ .rte-source-editor-btn-save {
264
+ background: #007acc;
265
+ color: white;
266
+ }
267
+
268
+ .rte-source-editor-btn-save:hover:not(:disabled) {
269
+ background: #0056b3;
270
+ }
271
+
272
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-modal {
273
+ background: #1e1e1e;
274
+ color: #f8f9fa;
275
+ border: 1px solid #434d5f;
276
+ }
277
+
278
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-header,
279
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-footer {
280
+ background: #2a3442;
281
+ border-color: #434d5f;
282
+ }
283
+
284
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-header h2 {
285
+ color: #f8f9fa;
286
+ }
287
+
288
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn,
289
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-fullscreen-btn,
290
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-close-btn {
291
+ color: #c1cede;
292
+ }
293
+
294
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn:hover:not(:disabled),
295
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-fullscreen-btn:hover,
296
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-close-btn:hover {
297
+ background: #404a5a;
298
+ color: #f8fafc;
299
+ }
300
+
301
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
302
+ background: #3b82f6;
303
+ color: #ffffff;
304
+ }
305
+
306
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active:hover {
307
+ background: #2563eb;
308
+ }
309
+
310
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-loading,
311
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-footer-info {
312
+ color: #cbd5e1;
313
+ }
314
+
315
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-spinner {
316
+ border-color: #3f4b60;
317
+ border-top-color: #58a6ff;
318
+ }
319
+
320
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-error {
321
+ background: #3f2124;
322
+ color: #fecaca;
323
+ border-color: #ef4444;
324
+ }
325
+
326
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-warning {
327
+ background: #3b3220;
328
+ color: #fde68a;
329
+ border-color: #f59e0b;
330
+ }
331
+
332
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-cancel {
333
+ background: #334155;
334
+ border-color: #475569;
335
+ color: #f1f5f9;
336
+ }
337
+
338
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-cancel:hover:not(:disabled) {
339
+ background: #475569;
340
+ border-color: #64748b;
341
+ }
342
+
343
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
344
+ background: #3b82f6;
345
+ }
346
+
347
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
348
+ background: #2563eb;
349
+ }
350
+
351
+ /* Responsive design */
352
+ @media (max-width: 768px) {
353
+ .rte-source-editor-overlay {
354
+ padding: 10px;
355
+ }
356
+
357
+ .rte-source-editor-modal {
358
+ max-height: 95vh;
359
+ }
360
+
361
+ .rte-source-editor-header {
362
+ padding: 12px 16px;
363
+ }
364
+
365
+ .rte-source-editor-footer {
366
+ padding: 12px 16px;
367
+ flex-direction: column;
368
+ gap: 12px;
369
+ align-items: stretch;
370
+ }
371
+
372
+ .rte-source-editor-footer-actions {
373
+ justify-content: stretch;
374
+ }
375
+
376
+ .rte-source-editor-btn {
377
+ flex: 1;
378
+ text-align: center;
379
+ }
380
+ }`, te = () => ({
381
+ name: "code",
382
+ // Toolbar button configuration
383
+ toolbar: [
384
+ {
385
+ label: "Source",
386
+ command: "toggleSourceView",
387
+ // type: "button",
388
+ icon: '<svg width="24" height="24" focusable="false"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 0 1 0-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7ZM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 0 0-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7Z"></path></g></svg>',
389
+ shortcut: "Mod-Shift-S"
390
+ }
391
+ ],
392
+ // Native command implementations
393
+ commands: {
394
+ /**
395
+ * Toggle HTML source view
396
+ * Opens a dialog to edit raw HTML
397
+ */
398
+ toggleSourceView: () => {
399
+ const l = (() => {
400
+ const a = window.getSelection();
401
+ if (a && a.anchorNode) {
402
+ let e = a.anchorNode instanceof HTMLElement ? a.anchorNode : a.anchorNode.parentElement;
403
+ for (; e; ) {
404
+ if (e.classList?.contains("rte-content"))
405
+ return e;
406
+ e = e.parentElement;
407
+ }
408
+ }
409
+ if (document.activeElement) {
410
+ let e = document.activeElement;
411
+ if (e.classList?.contains("rte-content"))
412
+ return e;
413
+ for (; e && e !== document.body; ) {
414
+ if (e.classList?.contains("rte-content"))
415
+ return e;
416
+ const n = e.querySelector(
417
+ ".rte-content"
418
+ );
419
+ if (n) return n;
420
+ e = e.parentElement;
421
+ }
422
+ }
423
+ const o = document.querySelector("[data-editora-editor]");
424
+ if (o) {
425
+ const e = o.querySelector(
426
+ ".rte-content"
427
+ );
428
+ if (e) return e;
429
+ }
430
+ return document.querySelector(".rte-content");
431
+ })();
432
+ if (!l)
433
+ return console.error("[CodePlugin] Editor content area not found"), alert(
434
+ "Editor content area not found. Please click inside the editor first."
435
+ ), !1;
436
+ const A = l.innerHTML, N = (a) => {
437
+ let o = "", e = 0;
438
+ const n = 2, u = a.split(/(<\/?[a-zA-Z][^>]*>)/);
439
+ for (const r of u)
440
+ r.trim() && (r.match(/^<\/[a-zA-Z]/) ? (e = Math.max(0, e - 1), o += `
441
+ ` + " ".repeat(e * n) + r) : r.match(/^<[a-zA-Z]/) && !r.match(/\/>$/) ? (o += `
442
+ ` + " ".repeat(e * n) + r, e++) : r.match(/^<[a-zA-Z].*\/>$/) ? o += `
443
+ ` + " ".repeat(e * n) + r : o += r.trim());
444
+ return o.trim();
445
+ };
446
+ return (() => {
447
+ document.querySelectorAll(".rte-source-editor-overlay").forEach((t) => t.remove());
448
+ const o = N(A);
449
+ let e = null, n = "dark", u = !1, r = !1, p = !1, w = !1;
450
+ const D = !!l.closest(L) || document.body.matches(L) || document.documentElement.matches(L), i = document.createElement("div");
451
+ Z(i), i.className = "rte-source-editor-overlay", D && i.classList.add("rte-theme-dark");
452
+ const d = document.createElement("div");
453
+ d.className = "rte-source-editor-modal", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "source-editor-title");
454
+ const h = document.createElement("div");
455
+ h.className = "rte-source-editor-header", h.innerHTML = `
456
+ <h2 id="source-editor-title">Source Editor</h2>
457
+ <div class="rte-source-editor-header-toolbar">
458
+ <button class="rte-source-editor-toolbar-btn theme-toggle-btn" title="Switch theme">
459
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
460
+ <circle cx="12" cy="12" r="5"/>
461
+ <line x1="12" y1="1" x2="12" y2="3"/>
462
+ <line x1="12" y1="21" x2="12" y2="23"/>
463
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
464
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
465
+ <line x1="1" y1="12" x2="3" y2="12"/>
466
+ <line x1="21" y1="12" x2="23" y2="12"/>
467
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
468
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
469
+ </svg>
470
+ </button>
471
+ <button class="rte-source-editor-toolbar-btn readonly-toggle-btn" title="Toggle read-only">
472
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
473
+ <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
474
+ <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
475
+ </svg>
476
+ </button>
477
+ </div>
478
+ <div class="rte-source-editor-header-actions">
479
+ <button class="rte-source-editor-fullscreen-btn" title="Toggle fullscreen">
480
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
481
+ <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
482
+ </svg>
483
+ </button>
484
+ <button class="rte-source-editor-close-btn" aria-label="Close source editor">
485
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
486
+ <line x1="18" y1="6" x2="6" y2="18"/>
487
+ <line x1="6" y1="6" x2="18" y2="18"/>
488
+ </svg>
489
+ </button>
490
+ </div>
491
+ `;
492
+ const E = document.createElement("div");
493
+ E.className = "rte-source-editor-body";
494
+ const v = document.createElement("div");
495
+ v.className = "rte-source-editor-content";
496
+ const C = document.createElement("div");
497
+ C.className = "rte-source-editor-warning", C.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
498
+ const b = document.createElement("div");
499
+ b.className = "rte-source-editor-light-editor", b.style.height = "400px", v.appendChild(C), v.appendChild(b), E.appendChild(v);
500
+ const f = document.createElement("div");
501
+ if (f.className = "rte-source-editor-footer", f.innerHTML = `
502
+ <div class="rte-source-editor-footer-info">
503
+ <span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
504
+ </div>
505
+ <div class="rte-source-editor-footer-actions">
506
+ <button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
507
+ <button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
508
+ </div>
509
+ `, d.appendChild(h), d.appendChild(E), d.appendChild(f), i.appendChild(d), !document.getElementById("rte-source-editor-styles")) {
510
+ const t = document.createElement("style");
511
+ t.id = "rte-source-editor-styles", t.textContent = J, document.head.appendChild(t);
512
+ }
513
+ const x = h.querySelector(
514
+ ".theme-toggle-btn"
515
+ ), m = h.querySelector(
516
+ ".readonly-toggle-btn"
517
+ ), y = h.querySelector(
518
+ ".rte-source-editor-fullscreen-btn"
519
+ ), T = h.querySelector(
520
+ ".rte-source-editor-close-btn"
521
+ ), H = f.querySelector(
522
+ ".rte-source-editor-btn-cancel"
523
+ ), z = f.querySelector(
524
+ ".rte-source-editor-btn-save"
525
+ ), B = f.querySelector(
526
+ ".unsaved-changes"
527
+ ), M = [], s = (t, c, S, k) => {
528
+ t.addEventListener(c, S, k), M.push(
529
+ () => t.removeEventListener(c, S, k)
530
+ );
531
+ }, q = (t) => {
532
+ p !== t && (p = t, B && (B.style.display = p ? "inline" : "none"));
533
+ }, g = () => {
534
+ if (!w) {
535
+ for (w = !0; M.length; )
536
+ M.pop()?.();
537
+ e && (e.destroy(), e = null), i.isConnected && i.remove();
538
+ }
539
+ }, O = () => {
540
+ n = n === "dark" ? "light" : "dark", e?.setTheme(n), x && (x.innerHTML = n === "light" ? `
541
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
542
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
543
+ </svg>
544
+ ` : `
545
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
546
+ <circle cx="12" cy="12" r="5"/>
547
+ <line x1="12" y1="1" x2="12" y2="3"/>
548
+ <line x1="12" y1="21" x2="12" y2="23"/>
549
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
550
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
551
+ <line x1="1" y1="12" x2="3" y2="12"/>
552
+ <line x1="21" y1="12" x2="23" y2="12"/>
553
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
554
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
555
+ </svg>
556
+ `);
557
+ }, R = () => {
558
+ u = !u, e?.setReadOnly(u), m && (m.classList.toggle("active", u), m.innerHTML = u ? `
559
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
560
+ <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
561
+ <circle cx="12" cy="16" r="1"/>
562
+ <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
563
+ </svg>
564
+ ` : `
565
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
566
+ <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
567
+ <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
568
+ </svg>
569
+ `);
570
+ }, j = () => {
571
+ r = !r, i.classList.toggle("fullscreen", r), b.style.height = r ? "calc(100vh - 200px)" : "400px", y && (y.innerHTML = r ? `
572
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
573
+ <path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
574
+ </svg>
575
+ ` : `
576
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
577
+ <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
578
+ </svg>
579
+ `);
580
+ }, F = () => {
581
+ p && !confirm("You have unsaved changes. Are you sure you want to cancel?") || g();
582
+ }, V = () => {
583
+ try {
584
+ const t = e?.getValue() || "", c = document.createElement("div");
585
+ c.innerHTML = t, c.querySelectorAll(
586
+ 'script, iframe[src^="javascript:"], object, embed'
587
+ ).forEach((k) => k.remove()), l.innerHTML = c.innerHTML;
588
+ try {
589
+ l.dispatchEvent(
590
+ new InputEvent("input", {
591
+ bubbles: !0,
592
+ cancelable: !1,
593
+ inputType: "insertReplacementText"
594
+ })
595
+ );
596
+ } catch {
597
+ l.dispatchEvent(
598
+ new Event("input", { bubbles: !0 })
599
+ );
600
+ }
601
+ l.dispatchEvent(
602
+ new Event("change", { bubbles: !0 })
603
+ ), q(!1), g();
604
+ } catch (t) {
605
+ alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", t);
606
+ }
607
+ };
608
+ x && s(x, "click", O), m && s(m, "click", R), y && s(y, "click", j), T && s(T, "click", g), H && s(H, "click", F), z && s(z, "click", V), s(i, "click", (t) => {
609
+ t.target === i && g();
610
+ }), s(document, "keydown", (t) => {
611
+ const c = t;
612
+ c.key === "Escape" && (c.preventDefault(), g());
613
+ }), document.body.appendChild(i), requestAnimationFrame(() => {
614
+ if (!(w || !i.isConnected))
615
+ try {
616
+ e = I(b, {
617
+ value: o,
618
+ theme: "dark",
619
+ readOnly: !1,
620
+ extensions: [
621
+ new U(),
622
+ new P(),
623
+ new _(),
624
+ new $(),
625
+ new K(),
626
+ new Y(),
627
+ new G()
628
+ ]
629
+ }), e.on("change", () => {
630
+ const t = e?.getValue() || "";
631
+ q(t !== o);
632
+ }), requestAnimationFrame(() => e?.focus());
633
+ } catch (t) {
634
+ console.error("Failed to initialize code editor:", t);
635
+ }
636
+ });
637
+ })(), !0;
638
+ }
639
+ },
640
+ // Keyboard shortcuts
641
+ keymap: {
642
+ "Mod-Shift-s": "toggleSourceView",
643
+ "Mod-Shift-S": "toggleSourceView"
644
+ }
645
+ });
646
+ export {
647
+ te as C
648
+ };