@editora/plugins 1.0.22 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +1 -1
  2. package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
  3. package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
  4. package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
  5. package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
  6. package/dist/a11y-checker.cjs.js +3 -3
  7. package/dist/a11y-checker.esm.js +6 -4
  8. package/dist/anchor.cjs.js +4 -4
  9. package/dist/anchor.esm.js +19 -18
  10. package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
  11. package/dist/anchoredPopover-Cygmit_o.js +1 -0
  12. package/dist/approval-workflow.cjs.js +7 -7
  13. package/dist/approval-workflow.esm.js +55 -54
  14. package/dist/background-color.cjs.js +2 -2
  15. package/dist/background-color.esm.js +72 -67
  16. package/dist/blocks-library.cjs.js +18 -19
  17. package/dist/blocks-library.esm.js +41 -42
  18. package/dist/citations.cjs.js +4 -4
  19. package/dist/citations.esm.js +50 -50
  20. package/dist/code-sample.cjs.js +10 -10
  21. package/dist/code-sample.esm.js +4 -4
  22. package/dist/code.cjs.js +1 -1
  23. package/dist/code.esm.js +1 -1
  24. package/dist/comments.cjs.js +23 -11
  25. package/dist/comments.esm.js +167 -149
  26. package/dist/conditional-content.cjs.js +2 -2
  27. package/dist/conditional-content.esm.js +2 -2
  28. package/dist/confirmDialog-D3S8BhIM.js +42 -0
  29. package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
  30. package/dist/content-rules.cjs.js +6 -6
  31. package/dist/content-rules.esm.js +51 -51
  32. package/dist/data-binding.cjs.js +2 -2
  33. package/dist/data-binding.esm.js +2 -2
  34. package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
  35. package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
  36. package/dist/document-manager.cjs.js +1 -1
  37. package/dist/document-manager.esm.js +1 -1
  38. package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
  39. package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
  40. package/dist/embed-iframe.cjs.js +6 -6
  41. package/dist/embed-iframe.esm.js +6 -6
  42. package/dist/emojis.cjs.js +5 -5
  43. package/dist/emojis.esm.js +3 -3
  44. package/dist/enterprise.cjs.js +1 -1
  45. package/dist/enterprise.esm.js +12 -12
  46. package/dist/format-painter.cjs.js +1 -1
  47. package/dist/format-painter.esm.js +172 -151
  48. package/dist/heading.cjs.js +1 -1
  49. package/dist/heading.esm.js +96 -83
  50. package/dist/history.cjs.js +1 -1
  51. package/dist/history.esm.js +176 -97
  52. package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
  53. package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
  54. package/dist/index.cjs.js +1 -1
  55. package/dist/index.esm.js +90 -83
  56. package/dist/katex-Cc3-mvOY.js +257 -0
  57. package/dist/katex-DoRnZ_sp.mjs +11682 -0
  58. package/dist/katex.min--Ws3c9be.mjs +5 -0
  59. package/dist/katex.min-Dk2VscxB.js +2 -0
  60. package/dist/link.cjs.js +3 -3
  61. package/dist/link.esm.js +3 -3
  62. package/dist/list.cjs.js +1 -1
  63. package/dist/list.esm.js +140 -52
  64. package/dist/math.cjs.js +14 -14
  65. package/dist/math.esm.js +149 -136
  66. package/dist/media-manager.cjs.js +1 -619
  67. package/dist/media-manager.esm.js +30 -1017
  68. package/dist/mentions.cjs.js +12 -12
  69. package/dist/mentions.esm.js +149 -143
  70. package/dist/merge-tag.cjs.js +5 -3
  71. package/dist/merge-tag.esm.js +5 -3
  72. package/dist/notify-BkbzMopb.js +32 -0
  73. package/dist/notify-zOp-mUOJ.mjs +59 -0
  74. package/dist/pii-redaction.cjs.js +1 -1
  75. package/dist/pii-redaction.esm.js +1 -1
  76. package/dist/preview.cjs.js +1 -1
  77. package/dist/preview.esm.js +1 -1
  78. package/dist/shared-config.cjs.js +1 -1
  79. package/dist/shared-config.esm.js +14 -14
  80. package/dist/slash-commands.cjs.js +5 -5
  81. package/dist/slash-commands.esm.js +259 -236
  82. package/dist/smart-paste.cjs.js +1 -1
  83. package/dist/smart-paste.esm.js +1 -1
  84. package/dist/special-characters.cjs.js +3 -3
  85. package/dist/special-characters.esm.js +3 -3
  86. package/dist/spell-check.cjs.js +9 -9
  87. package/dist/spell-check.esm.js +288 -251
  88. package/dist/table.cjs.js +14 -14
  89. package/dist/table.esm.js +175 -154
  90. package/dist/template.cjs.js +5 -3
  91. package/dist/template.esm.js +15 -13
  92. package/dist/text-color.cjs.js +4 -4
  93. package/dist/text-color.esm.js +38 -34
  94. package/dist/translation-workflow.cjs.js +9 -9
  95. package/dist/translation-workflow.esm.js +98 -95
  96. package/dist/version-diff.cjs.js +4 -4
  97. package/dist/version-diff.esm.js +36 -36
  98. package/index.d.ts +183 -2
  99. package/package.json +6 -5
  100. package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
  101. package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
  102. package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
  103. package/dist/dialogHelpers-zU6zpMIA.js +0 -12
@@ -1,1022 +1,35 @@
1
- import { e as U } from "./escapeHtml-DyksyvcZ.mjs";
2
- import { i as Y } from "./dialogHelpers-5d5BuOCW.mjs";
3
- import "./shared-config.esm.js";
4
- let A = null, p = null, s = null;
5
- const R = [];
6
- let D = !1, I = null, j = 0, F = 0, $ = 0, C = 0, N = 1, T = null;
7
- const O = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
8
- const r = (a) => {
9
- a.key !== "Escape" || !e.isConnected || (a.preventDefault(), a.stopPropagation(), t());
10
- };
11
- return document.addEventListener("keydown", r, !0), () => {
12
- document.removeEventListener("keydown", r, !0);
13
- };
14
- }, Z = () => {
15
- if (typeof document > "u" || document.getElementById("rte-media-dialog-styles")) return;
16
- const e = document.createElement("style");
17
- e.id = "rte-media-dialog-styles", e.textContent = `
18
- .rte-media-overlay {
19
- --rte-media-overlay-bg: rgba(15, 23, 36, 0.56);
20
- --rte-media-bg: #ffffff;
21
- --rte-media-text: #101828;
22
- --rte-media-muted: #5f6b7d;
23
- --rte-media-border: #d6dbe4;
24
- --rte-media-surface: #f7f9fc;
25
- --rte-media-surface-hover: #eef2f7;
26
- --rte-media-accent: #1f75fe;
27
- --rte-media-accent-hover: #165fd6;
28
- --rte-media-danger: #dc3545;
29
- --rte-media-danger-hover: #b92735;
30
- --rte-media-ring: rgba(31, 117, 254, 0.18);
31
- position: fixed;
32
- top: 0;
33
- left: 0;
34
- right: 0;
35
- bottom: 0;
36
- background: var(--rte-media-overlay-bg);
37
- backdrop-filter: blur(2px);
38
- display: flex;
39
- align-items: center;
40
- justify-content: center;
41
- z-index: 99999;
42
- padding: 16px;
43
- box-sizing: border-box;
44
- }
45
-
46
- .rte-media-overlay.rte-ui-theme-dark {
47
- --rte-media-overlay-bg: rgba(2, 8, 20, 0.72);
48
- --rte-media-bg: #202938;
49
- --rte-media-text: #e8effc;
50
- --rte-media-muted: #a5b1c5;
51
- --rte-media-border: #49566c;
52
- --rte-media-surface: #2a3444;
53
- --rte-media-surface-hover: #344256;
54
- --rte-media-accent: #58a6ff;
55
- --rte-media-accent-hover: #4598f4;
56
- --rte-media-danger: #ff7b72;
57
- --rte-media-danger-hover: #ff645b;
58
- --rte-media-ring: rgba(88, 166, 255, 0.22);
59
- }
60
-
61
- .rte-media-dialog {
62
- width: min(92vw, 640px);
63
- max-height: 90vh;
64
- display: flex;
65
- flex-direction: column;
66
- overflow: hidden;
67
- background: var(--rte-media-bg);
68
- color: var(--rte-media-text);
69
- border: 1px solid var(--rte-media-border);
70
- border-radius: 12px;
71
- box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
72
- }
73
-
74
- .rte-media-dialog.rte-media-dialog-compact {
75
- width: min(92vw, 520px);
76
- }
77
-
78
- .rte-media-header {
79
- display: flex;
80
- align-items: center;
81
- justify-content: space-between;
82
- padding: 16px 20px;
83
- border-bottom: 1px solid var(--rte-media-border);
84
- background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
85
- }
86
-
87
- .rte-media-title {
88
- margin: 0;
89
- font-size: 18px;
90
- font-weight: 600;
91
- color: var(--rte-media-text);
92
- }
93
-
94
- .rte-media-close-btn {
95
- width: 32px;
96
- height: 32px;
97
- border: none;
98
- border-radius: 8px;
99
- background: transparent;
100
- color: var(--rte-media-muted);
101
- font-size: 24px;
102
- line-height: 1;
103
- cursor: pointer;
104
- transition: background-color 0.16s ease, color 0.16s ease;
105
- }
106
-
107
- .rte-media-close-btn:hover {
108
- background: var(--rte-media-surface-hover);
109
- color: var(--rte-media-text);
110
- }
111
-
112
- .rte-media-tabs {
113
- display: grid;
114
- grid-template-columns: 1fr 1fr;
115
- border-bottom: 1px solid var(--rte-media-border);
116
- gap: 0;
117
- }
118
-
119
- .rte-media-tab {
120
- border: none;
121
- border-right: 1px solid var(--rte-media-border);
122
- padding: 12px 14px;
123
- background: var(--rte-media-surface);
124
- color: var(--rte-media-muted);
125
- font-size: 14px;
126
- font-weight: 600;
127
- cursor: pointer;
128
- transition: background-color 0.16s ease, color 0.16s ease;
129
- }
130
-
131
- .rte-media-tab:last-child {
132
- border-right: none;
133
- }
134
-
135
- .rte-media-tab:hover {
136
- background: var(--rte-media-surface-hover);
137
- color: var(--rte-media-text);
138
- }
139
-
140
- .rte-media-tab.active {
141
- background: var(--rte-media-accent);
142
- color: #fff;
143
- }
144
-
145
- .rte-media-body {
146
- padding: 20px;
147
- overflow-y: auto;
148
- flex: 1;
149
- }
150
-
151
- .rte-media-field {
152
- margin-bottom: 16px;
153
- }
154
-
155
- .rte-media-grid {
156
- display: grid;
157
- grid-template-columns: 1fr 1fr;
158
- gap: 12px;
159
- margin-bottom: 16px;
160
- }
161
-
162
- .rte-media-label {
163
- display: block;
164
- margin-bottom: 8px;
165
- color: var(--rte-media-text);
166
- font-size: 14px;
167
- font-weight: 600;
168
- }
169
-
170
- .rte-media-input,
171
- .rte-media-textarea {
172
- width: 100%;
173
- box-sizing: border-box;
174
- padding: 10px 12px;
175
- border: 1px solid var(--rte-media-border);
176
- border-radius: 8px;
177
- background: var(--rte-media-surface);
178
- color: var(--rte-media-text);
179
- font-size: 14px;
180
- transition: border-color 0.16s ease, box-shadow 0.16s ease;
181
- }
182
-
183
- .rte-media-input::placeholder,
184
- .rte-media-textarea::placeholder {
185
- color: var(--rte-media-muted);
186
- }
187
-
188
- .rte-media-input:focus,
189
- .rte-media-textarea:focus {
190
- outline: none;
191
- border-color: var(--rte-media-accent);
192
- box-shadow: 0 0 0 3px var(--rte-media-ring);
193
- }
194
-
195
- .rte-media-textarea {
196
- min-height: 92px;
197
- resize: vertical;
198
- font-family: inherit;
199
- }
200
-
201
- .rte-media-dropzone {
202
- border: 2px dashed var(--rte-media-border);
203
- border-radius: 12px;
204
- padding: 36px 18px;
205
- text-align: center;
206
- cursor: pointer;
207
- background: var(--rte-media-surface);
208
- transition: border-color 0.16s ease, background-color 0.16s ease;
209
- }
210
-
211
- .rte-media-dropzone:hover,
212
- .rte-media-dropzone.is-dragover {
213
- border-color: var(--rte-media-accent);
214
- background: var(--rte-media-surface-hover);
215
- }
216
-
217
- .rte-media-dropzone-icon {
218
- font-size: 40px;
219
- margin-bottom: 10px;
220
- line-height: 1;
221
- }
222
-
223
- .rte-media-dropzone-title {
224
- margin: 0 0 8px 0;
225
- font-size: 16px;
226
- font-weight: 600;
227
- color: var(--rte-media-text);
228
- }
229
-
230
- .rte-media-muted {
231
- margin: 0 0 8px 0;
232
- color: var(--rte-media-muted);
233
- font-size: 14px;
234
- }
235
-
236
- .rte-media-hint {
237
- margin: 0;
238
- color: var(--rte-media-muted);
239
- font-size: 12px;
240
- }
241
-
242
- .rte-media-progress {
243
- margin-top: 16px;
244
- }
245
-
246
- .rte-media-progress-track {
247
- height: 8px;
248
- border-radius: 999px;
249
- background: var(--rte-media-surface);
250
- overflow: hidden;
251
- border: 1px solid var(--rte-media-border);
252
- }
253
-
254
- .rte-media-progress-bar {
255
- height: 100%;
256
- width: 0;
257
- background: var(--rte-media-accent);
258
- transition: width 0.3s ease;
259
- }
260
-
261
- .rte-media-progress-text {
262
- margin-top: 8px;
263
- text-align: center;
264
- color: var(--rte-media-muted);
265
- font-size: 13px;
266
- }
267
-
268
- .rte-media-preview {
269
- border: 1px solid var(--rte-media-border);
270
- border-radius: 10px;
271
- padding: 10px;
272
- text-align: center;
273
- background: var(--rte-media-surface);
274
- }
275
-
276
- .rte-media-preview img,
277
- .rte-media-preview video {
278
- max-width: 100%;
279
- max-height: 240px;
280
- }
281
-
282
- .rte-media-helper {
283
- margin-top: 8px;
284
- margin-bottom: 0;
285
- font-size: 12px;
286
- color: var(--rte-media-muted);
287
- line-height: 1.5;
288
- }
289
-
290
- .rte-media-footer {
291
- display: flex;
292
- justify-content: flex-end;
293
- gap: 10px;
294
- padding: 16px 20px;
295
- border-top: 1px solid var(--rte-media-border);
296
- background: var(--rte-media-surface);
297
- }
298
-
299
- .rte-media-footer.rte-media-footer-spread {
300
- justify-content: space-between;
301
- align-items: center;
302
- }
303
-
304
- .rte-media-btn {
305
- border-radius: 8px;
306
- border: 1px solid transparent;
307
- padding: 10px 16px;
308
- font-size: 14px;
309
- font-weight: 600;
310
- cursor: pointer;
311
- transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
312
- }
313
-
314
- .rte-media-btn-secondary {
315
- background: var(--rte-media-bg);
316
- border-color: var(--rte-media-border);
317
- color: var(--rte-media-text);
318
- }
319
-
320
- .rte-media-btn-secondary:hover {
321
- background: var(--rte-media-surface-hover);
322
- }
323
-
324
- .rte-media-btn-primary {
325
- background: var(--rte-media-accent);
326
- color: #fff;
327
- }
328
-
329
- .rte-media-btn-primary:hover {
330
- background: var(--rte-media-accent-hover);
331
- }
332
-
333
- .rte-media-btn-primary:disabled {
334
- opacity: 0.55;
335
- cursor: not-allowed;
336
- }
337
-
338
- .rte-media-btn-danger {
339
- background: var(--rte-media-danger);
340
- color: #fff;
341
- }
342
-
343
- .rte-media-btn-danger:hover {
344
- background: var(--rte-media-danger-hover);
345
- }
346
-
347
- .rte-media-checkbox-label {
348
- display: inline-flex;
349
- align-items: center;
350
- gap: 8px;
351
- color: var(--rte-media-text);
352
- font-size: 14px;
353
- cursor: pointer;
354
- }
355
-
356
- .rte-media-checkbox-label input {
357
- accent-color: var(--rte-media-accent);
358
- }
359
-
360
- .rte-media-actions {
361
- display: flex;
362
- gap: 10px;
363
- }
364
-
365
- .rte-media-spacer {
366
- flex: 1;
367
- }
368
-
369
- .media-floating-toolbar {
370
- --rte-media-toolbar-bg: #ffffff;
371
- --rte-media-toolbar-border: #d6dbe4;
372
- --rte-media-toolbar-text: #344054;
373
- --rte-media-toolbar-hover-bg: #f3f6fb;
374
- --rte-media-toolbar-hover-text: #101828;
375
- --rte-media-toolbar-active-bg: #e6edf7;
376
- --rte-media-toolbar-separator: #d9e1eb;
377
- --rte-media-toolbar-danger-hover-bg: #fee2e2;
378
- --rte-media-toolbar-danger-hover-text: #b42318;
379
- position: absolute;
380
- display: none;
381
- align-items: center;
382
- gap: 2px;
383
- padding: 4px;
384
- border: 1px solid var(--rte-media-toolbar-border);
385
- border-radius: 8px;
386
- background: var(--rte-media-toolbar-bg);
387
- color: var(--rte-media-toolbar-text);
388
- box-shadow: 0 10px 24px rgba(15, 23, 36, 0.18);
389
- z-index: 10000;
390
- pointer-events: auto;
391
- backdrop-filter: blur(6px);
392
- }
393
-
394
- .media-floating-toolbar.rte-ui-theme-dark,
395
- ${O} .media-floating-toolbar {
396
- --rte-media-toolbar-bg: #24303f;
397
- --rte-media-toolbar-border: #4a5a71;
398
- --rte-media-toolbar-text: #d9e6fb;
399
- --rte-media-toolbar-hover-bg: #33445a;
400
- --rte-media-toolbar-hover-text: #f4f8ff;
401
- --rte-media-toolbar-active-bg: #415875;
402
- --rte-media-toolbar-separator: #566884;
403
- --rte-media-toolbar-danger-hover-bg: #5f2a32;
404
- --rte-media-toolbar-danger-hover-text: #ffd7d5;
405
- box-shadow: 0 16px 30px rgba(2, 8, 20, 0.42);
406
- }
407
-
408
- .media-floating-toolbar-btn {
409
- width: 30px;
410
- height: 30px;
411
- border: none;
412
- border-radius: 6px;
413
- background: transparent;
414
- color: inherit;
415
- display: inline-flex;
416
- align-items: center;
417
- justify-content: center;
418
- cursor: pointer;
419
- transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
420
- }
421
-
422
- .media-floating-toolbar-btn:hover {
423
- background: var(--rte-media-toolbar-hover-bg);
424
- color: var(--rte-media-toolbar-hover-text);
425
- }
426
-
427
- .media-floating-toolbar-btn:active {
428
- background: var(--rte-media-toolbar-active-bg);
429
- transform: scale(0.96);
430
- }
431
-
432
- .media-floating-toolbar-btn.btn-remove:hover {
433
- background: var(--rte-media-toolbar-danger-hover-bg);
434
- color: var(--rte-media-toolbar-danger-hover-text);
435
- }
436
-
437
- .media-floating-toolbar-separator {
438
- width: 1px;
439
- height: 20px;
440
- margin: 0 2px;
441
- background: var(--rte-media-toolbar-separator);
442
- }
443
- `, document.head.appendChild(e);
444
- }, K = () => {
445
- const e = window.getSelection();
446
- if (!e || e.rangeCount === 0) return null;
447
- const t = e.anchorNode;
448
- return (t instanceof HTMLElement ? t : t?.parentElement)?.closest(".rte-content, .editora-content") || null;
449
- }, J = (e) => {
450
- if (e) return e;
451
- const t = K();
452
- if (t) return t;
453
- if (T) return T;
454
- const r = document.activeElement;
455
- return r ? r.closest(".rte-content, .editora-content") || r : null;
456
- }, G = (e) => {
457
- const t = J(e);
458
- return t ? !!t.closest(O) : !1;
459
- }, H = (e) => {
460
- Z();
461
- const t = document.createElement("div");
462
- return Y(t), t.className = "rte-media-overlay", G(e) && t.classList.add("rte-ui-theme-dark"), t;
463
- }, _ = (e = !1) => {
464
- const t = document.createElement("div");
465
- return t.className = e ? "rte-media-dialog rte-media-dialog-compact" : "rte-media-dialog", t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "true"), t;
466
- }, W = (e, t) => {
467
- document.querySelectorAll(".rte-media-overlay").forEach((n) => n.remove());
468
- const r = window.getSelection();
469
- r && r.rangeCount > 0 && (A = r.getRangeAt(0).cloneRange());
470
- const a = H(t), i = _();
471
- let o = "upload", d = "", l = "", c = "", g = "";
472
- const v = () => {
473
- i.innerHTML = `
474
- <div class="rte-media-header">
475
- <h2 class="rte-media-title">Insert ${e === "image" ? "Image" : "Video"}</h2>
476
- <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
477
- </div>
478
-
479
- <div class="rte-media-tabs">
480
- <button class="tab-upload rte-media-tab ${o === "upload" ? "active" : ""}" type="button">Upload</button>
481
- <button class="tab-url rte-media-tab ${o === "url" ? "active" : ""}" type="button">URL</button>
482
- </div>
483
-
484
- <div class="rte-media-body">
485
- ${o === "upload" ? `
486
- <div id="upload-section">
487
- <div class="dropzone rte-media-dropzone">
488
- <div class="rte-media-dropzone-icon">📁</div>
489
- <p class="rte-media-dropzone-title">Drag and drop your ${e} here</p>
490
- <p class="rte-media-muted">or click to browse</p>
491
- <p class="rte-media-hint">Max file size: 50MB</p>
492
- </div>
493
- <input type="file" id="file-input" accept="${e === "image" ? "image/*" : "video/*"}" style="display: none;">
494
- <div id="upload-progress" class="rte-media-progress" style="display: none;">
495
- <div class="rte-media-progress-track">
496
- <div id="progress-bar" class="rte-media-progress-bar"></div>
497
- </div>
498
- <p id="progress-text" class="rte-media-progress-text">Uploading...</p>
499
- </div>
500
- </div>
501
- ` : `
502
- <div id="url-section">
503
- <div class="rte-media-field">
504
- <label class="rte-media-label">URL</label>
505
- <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${e}.${e === "image" ? "jpg" : "mp4"}" value="${d}">
506
- </div>
507
- ${e === "image" ? `
508
- <div class="rte-media-field">
509
- <label class="rte-media-label">Alt Text (for accessibility)</label>
510
- <input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${g}">
511
- </div>
512
- ` : ""}
513
- <div class="rte-media-grid">
514
- <div class="rte-media-field">
515
- <label class="rte-media-label">Width (px)</label>
516
- <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${l}">
517
- </div>
518
- <div class="rte-media-field">
519
- <label class="rte-media-label">Height (px)</label>
520
- <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
521
- </div>
522
- </div>
523
- ${d ? `
524
- <div class="rte-media-field">
525
- <label class="rte-media-label">Preview</label>
526
- <div class="rte-media-preview">
527
- ${e === "image" ? `<img src="${d}" alt="Preview">` : `<video src="${d}" controls></video>`}
528
- </div>
529
- </div>
530
- ` : ""}
531
- </div>
532
- `}
533
- </div>
534
-
535
- <div class="rte-media-footer">
536
- <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
537
- <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d && o === "url" ? "disabled" : ""}>Insert</button>
538
- </div>
539
- `;
540
- };
541
- v(), a.appendChild(i), document.body.appendChild(a);
542
- let k = () => {
543
- };
544
- const h = () => {
545
- k(), a.parentNode && a.parentNode.removeChild(a);
546
- };
547
- k = B(a, h);
548
- const L = () => {
549
- if (!d) return;
550
- const n = e === "image" ? document.createElement("img") : document.createElement("video");
551
- n.src = d, n.setAttribute("data-media-type", e), e === "image" && g && (n.alt = g), l && (n.style.width = `${l}px`, n.setAttribute("width", l)), c && (n.style.height = `${c}px`, n.setAttribute("height", c)), e === "video" && (n.controls = !0), !l && !c ? n.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : n.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${l ? `width: ${l}px;` : "max-width: 100%;"} ${c ? `height: ${c}px;` : "height: auto;"}`, A && (A.deleteContents(), A.insertNode(n)), h();
552
- }, x = async (n) => {
553
- const b = i.querySelector("#upload-progress"), u = i.querySelector("#progress-bar"), y = i.querySelector("#progress-text");
554
- if (b && u && y) {
555
- b.style.display = "block";
556
- let M = 0;
557
- const f = setInterval(() => {
558
- M += Math.random() * 30, M > 90 && (M = 90), u.style.width = `${M}%`;
559
- }, 200);
560
- try {
561
- const w = new FileReader();
562
- w.onload = () => {
563
- clearInterval(f), u.style.width = "100%", y.textContent = "Upload complete", setTimeout(() => {
564
- d = w.result, o = "url", v(), m();
565
- }, 500);
566
- }, w.readAsDataURL(n);
567
- } catch {
568
- clearInterval(f), y.textContent = "Upload failed";
569
- }
570
- }
571
- }, m = () => {
572
- const n = i.querySelector(".close-btn"), b = i.querySelector(".cancel-btn"), u = i.querySelector("#insert-btn"), y = i.querySelector(".tab-upload"), M = i.querySelector(".tab-url");
573
- if (n?.addEventListener("click", h), b?.addEventListener("click", h), u?.addEventListener("click", L), y?.addEventListener("click", () => {
574
- o = "upload", v(), m();
575
- }), M?.addEventListener("click", () => {
576
- o = "url", v(), m();
577
- }), o === "upload") {
578
- const f = i.querySelector(".dropzone"), w = i.querySelector("#file-input");
579
- f?.addEventListener("click", () => w?.click()), f?.addEventListener("dragover", (S) => {
580
- S.preventDefault(), f.classList.add("is-dragover");
581
- }), f?.addEventListener("dragleave", () => {
582
- f.classList.remove("is-dragover");
583
- }), f?.addEventListener("drop", (S) => {
584
- S.preventDefault(), f.classList.remove("is-dragover");
585
- const z = S.dataTransfer?.files[0];
586
- z && x(z);
587
- }), w?.addEventListener("change", (S) => {
588
- const z = S.target.files?.[0];
589
- z && x(z);
590
- });
591
- }
592
- if (o === "url") {
593
- const f = i.querySelector("#url-input"), w = i.querySelector("#alt-input"), S = i.querySelector("#width-input"), z = i.querySelector("#height-input");
594
- f?.addEventListener("input", () => {
595
- d = f.value, v(), m();
596
- }), w?.addEventListener("input", () => {
597
- g = w.value;
598
- }), S?.addEventListener("input", () => {
599
- l = S.value;
600
- }), z?.addEventListener("input", () => {
601
- c = z.value;
602
- });
603
- }
604
- };
605
- m(), a.addEventListener("click", (n) => {
606
- n.target === a && h();
607
- });
608
- }, Q = () => {
609
- ["nw", "ne", "sw", "se"].forEach((t) => {
610
- const r = document.createElement("div");
611
- r.className = `media-resize-handle-${t}`, r.style.cssText = `
612
- position: fixed;
613
- width: 10px;
614
- height: 10px;
615
- background: #007bff;
616
- border: 2px solid white;
617
- border-radius: 50%;
618
- cursor: ${t}-resize;
619
- z-index: 10001;
620
- display: none;
621
- box-shadow: 0 1px 3px rgba(0,0,0,0.3);
622
- `, r.setAttribute("data-position", t), document.body.appendChild(r), R.push(r);
623
- });
624
- }, q = () => {
625
- if (!p) {
626
- R.forEach((r) => r.style.display = "none");
627
- return;
628
- }
629
- const e = p.getBoundingClientRect(), t = {
630
- nw: { x: e.left - 5, y: e.top - 5 },
631
- ne: { x: e.right - 5, y: e.top - 5 },
632
- sw: { x: e.left - 5, y: e.bottom - 5 },
633
- se: { x: e.right - 5, y: e.bottom - 5 }
634
- };
635
- R.forEach((r) => {
636
- const a = r.getAttribute("data-position"), i = t[a];
637
- r.style.left = `${i.x}px`, r.style.top = `${i.y}px`, r.style.display = "block";
638
- });
639
- }, ee = (e) => {
640
- const t = H(e), r = _(!0);
641
- r.innerHTML = `
642
- <div class="rte-media-header">
643
- <h2 class="rte-media-title">Edit Alt Text</h2>
644
- <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
645
- </div>
646
- <div class="rte-media-body">
647
- <label class="rte-media-label">Alternative Text (for accessibility)</label>
648
- <textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${U(e.alt || "")}</textarea>
649
- <p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
650
- </div>
651
- <div class="rte-media-footer">
652
- <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
653
- <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
654
- </div>
655
- `, t.appendChild(r), document.body.appendChild(t);
656
- const a = r.querySelector("#alt-text-input"), i = r.querySelector(".close-btn"), o = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
657
- let l = () => {
658
- };
659
- const c = () => {
660
- l(), t.parentNode && t.parentNode.removeChild(t);
661
- };
662
- l = B(t, c), i.addEventListener("click", c), o.addEventListener("click", c), t.addEventListener("click", (g) => {
663
- g.target === t && c();
664
- }), d.addEventListener("click", () => {
665
- e.alt = a.value, c();
666
- }), a.focus(), a.select();
667
- }, te = (e) => {
668
- const t = e.closest("a"), r = t?.getAttribute("href") || "", a = t?.getAttribute("target") || "_self", i = t?.getAttribute("title") || "", o = H(e), d = _(!0);
669
- d.innerHTML = `
670
- <div class="rte-media-header">
671
- <h2 class="rte-media-title">${t ? "Edit Link" : "Add Link"}</h2>
672
- <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
673
- </div>
674
- <div class="rte-media-body">
675
- <div class="rte-media-field">
676
- <label class="rte-media-label">URL</label>
677
- <input id="link-url" type="url" class="rte-media-input" value="${U(r)}" placeholder="https://example.com" />
678
- </div>
679
- <div class="rte-media-field">
680
- <label class="rte-media-label">Title (tooltip)</label>
681
- <input id="link-title" type="text" class="rte-media-input" value="${U(i)}" placeholder="Optional tooltip text" />
682
- </div>
683
- <label class="rte-media-checkbox-label">
684
- <input id="link-target" type="checkbox" ${a === "_blank" ? "checked" : ""} />
685
- Open in new window/tab
686
- </label>
687
- </div>
688
- <div class="rte-media-footer rte-media-footer-spread">
689
- ${t ? '<button class="remove-link-btn rte-media-btn rte-media-btn-danger" type="button">Remove Link</button>' : '<span class="rte-media-spacer"></span>'}
690
- <div class="rte-media-actions">
691
- <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
692
- <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
693
- </div>
694
- </div>
695
- `, o.appendChild(d), document.body.appendChild(o);
696
- const l = d.querySelector("#link-url"), c = d.querySelector("#link-title"), g = d.querySelector("#link-target"), v = d.querySelector(".close-btn"), k = d.querySelector(".cancel-btn"), h = d.querySelector(".save-btn"), L = d.querySelector(".remove-link-btn");
697
- let x = () => {
698
- };
699
- const m = () => {
700
- x(), o.parentNode && o.parentNode.removeChild(o);
701
- };
702
- x = B(o, m), v.addEventListener("click", m), k.addEventListener("click", m), o.addEventListener("click", (n) => {
703
- n.target === o && m();
704
- }), h.addEventListener("click", () => {
705
- const n = l.value.trim();
706
- if (n) {
707
- const b = n.startsWith("http") ? n : `https://${n}`;
708
- if (t)
709
- t.setAttribute("href", b), t.setAttribute("target", g.checked ? "_blank" : "_self"), g.checked ? t.setAttribute("rel", "noopener noreferrer") : t.removeAttribute("rel"), c.value.trim() ? t.setAttribute("title", c.value.trim()) : t.removeAttribute("title");
710
- else {
711
- const u = document.createElement("a");
712
- u.href = b, u.target = g.checked ? "_blank" : "_self", g.checked && (u.rel = "noopener noreferrer"), c.value.trim() && (u.title = c.value.trim()), e.replaceWith(u), u.appendChild(e);
713
- }
714
- m(), s && p && P(p);
715
- }
716
- }), L?.addEventListener("click", () => {
717
- t && confirm("Remove link from this media?") && (t.replaceWith(e), m(), s && p && P(p));
718
- }), l.focus();
719
- }, re = (e) => {
720
- const t = H(e), r = _();
721
- let a = "url", i = e.src;
722
- const o = () => {
723
- r.innerHTML = `
724
- <div class="rte-media-header">
725
- <h2 class="rte-media-title">Replace Image</h2>
726
- <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
727
- </div>
728
-
729
- <div class="rte-media-tabs">
730
- <button class="tab-upload rte-media-tab ${a === "upload" ? "active" : ""}" type="button">Upload</button>
731
- <button class="tab-url rte-media-tab ${a === "url" ? "active" : ""}" type="button">URL</button>
732
- </div>
733
-
734
- <div class="rte-media-body">
735
- ${a === "upload" ? `
736
- <div id="upload-section">
737
- <div class="dropzone rte-media-dropzone">
738
- <div class="rte-media-dropzone-icon">📁</div>
739
- <p class="rte-media-dropzone-title">Drag and drop your image here</p>
740
- <p class="rte-media-muted">or click to browse</p>
741
- </div>
742
- <input type="file" id="file-input" accept="image/*" style="display: none;">
743
- <div id="upload-progress" class="rte-media-progress" style="display: none;">
744
- <div class="rte-media-progress-track">
745
- <div id="progress-bar" class="rte-media-progress-bar"></div>
746
- </div>
747
- <p id="progress-text" class="rte-media-progress-text">Uploading...</p>
748
- </div>
749
- </div>
750
- ` : `
751
- <div id="url-section">
752
- <div class="rte-media-field">
753
- <label class="rte-media-label">Image URL</label>
754
- <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${i}">
755
- </div>
756
- ${i ? `
757
- <div class="rte-media-field">
758
- <label class="rte-media-label">Preview</label>
759
- <div class="rte-media-preview">
760
- <img src="${i}" alt="Preview" onerror="this.parentElement.innerHTML='<p class=&quot;rte-media-muted&quot;>Failed to load image</p>'">
761
- </div>
762
- </div>
763
- ` : ""}
764
- </div>
765
- `}
766
- </div>
767
-
768
- <div class="rte-media-footer">
769
- <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
770
- <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!i && a === "url" ? "disabled" : ""}>Replace</button>
771
- </div>
772
- `;
773
- };
774
- o(), t.appendChild(r), document.body.appendChild(t);
775
- let d = () => {
776
- };
777
- const l = () => {
778
- d(), t.parentNode && t.parentNode.removeChild(t);
779
- };
780
- d = B(t, l);
781
- const c = () => {
782
- i && (e.src = i, l());
783
- }, g = async (k) => {
784
- const h = r.querySelector("#upload-progress"), L = r.querySelector("#progress-bar"), x = r.querySelector("#progress-text");
785
- if (h && L && x) {
786
- h.style.display = "block";
787
- let m = 0;
788
- const n = setInterval(() => {
789
- m += Math.random() * 30, m > 90 && (m = 90), L.style.width = `${m}%`;
790
- }, 200);
791
- try {
792
- const b = new FileReader();
793
- b.onload = () => {
794
- clearInterval(n), L.style.width = "100%", x.textContent = "Upload complete", setTimeout(() => {
795
- i = b.result, a = "url", o(), v();
796
- }, 500);
797
- }, b.readAsDataURL(k);
798
- } catch {
799
- clearInterval(n), x.textContent = "Upload failed";
800
- }
801
- }
802
- }, v = () => {
803
- const k = r.querySelector(".close-btn"), h = r.querySelector(".cancel-btn"), L = r.querySelector("#replace-btn"), x = r.querySelector(".tab-upload"), m = r.querySelector(".tab-url");
804
- if (k?.addEventListener("click", l), h?.addEventListener("click", l), L?.addEventListener("click", c), x?.addEventListener("click", () => {
805
- a = "upload", o(), v();
806
- }), m?.addEventListener("click", () => {
807
- a = "url", o(), v();
808
- }), a === "upload") {
809
- const n = r.querySelector(".dropzone"), b = r.querySelector("#file-input");
810
- n?.addEventListener("click", () => b?.click()), n?.addEventListener("dragover", (u) => {
811
- u.preventDefault(), n.classList.add("is-dragover");
812
- }), n?.addEventListener("dragleave", () => {
813
- n.classList.remove("is-dragover");
814
- }), n?.addEventListener("drop", (u) => {
815
- u.preventDefault(), n.classList.remove("is-dragover");
816
- const y = u.dataTransfer?.files[0];
817
- y && g(y);
818
- }), b?.addEventListener("change", (u) => {
819
- const y = u.target.files?.[0];
820
- y && g(y);
821
- });
822
- }
823
- if (a === "url") {
824
- const n = r.querySelector("#url-input");
825
- n?.addEventListener("input", () => {
826
- i = n.value, o(), v();
827
- });
828
- }
829
- };
830
- v(), t.addEventListener("click", (k) => {
831
- k.target === t && l();
832
- });
833
- }, E = () => {
834
- if (!s || !p) return;
835
- const e = s.offsetHeight || 40, t = p.offsetTop, r = p.offsetLeft, a = p.offsetWidth, i = t - e - 8, o = r + a / 2 - (s.offsetWidth || 120) / 2;
836
- s.style.top = `${i}px`, s.style.left = `${o}px`, setTimeout(() => {
837
- s && (s.style.display = "flex");
838
- }, 100);
839
- }, P = (e) => {
840
- s && (s._cleanup && s._cleanup(), s.remove());
841
- const t = e.parentElement;
842
- if (t) {
843
- const l = t.style.position;
844
- (!l || l === "static") && (t.style.position = "relative", t._originalPosition = l), s = document.createElement("div"), s.className = "media-floating-toolbar", G(e) && s.classList.add("rte-ui-theme-dark"), t.insertBefore(s, t.firstChild), E();
845
- }
846
- const r = s;
847
- if (!r) return;
848
- const a = e.tagName === "IMG", i = e.closest("a");
849
- r.innerHTML = `
850
- <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
851
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line></svg>
852
- </button>
853
- <button class="media-floating-toolbar-btn btn-align-center" title="Align Center" type="button">
854
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="10" x2="6" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="18" y1="18" x2="6" y2="18"></line></svg>
855
- </button>
856
- <button class="media-floating-toolbar-btn btn-align-right" title="Align Right" type="button">
857
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="21" y1="10" x2="7" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="7" y2="18"></line></svg>
858
- </button>
859
- <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
860
- ${a ? `
861
- <button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
862
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>
863
- </button>` : ""}
864
- <button class="media-floating-toolbar-btn btn-link" title="${i ? "Edit/Remove Link" : "Add Link"}" type="button">
865
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
866
- </button>
867
- ${a ? `
868
- <button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
869
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
870
- </button>` : ""}
871
- <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
872
- <button class="media-floating-toolbar-btn btn-remove" title="Remove" type="button">
873
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>
874
- </button>
875
- `, setTimeout(() => {
876
- E();
877
- }, 0);
878
- const o = () => E();
879
- let d = e.parentElement;
880
- for (; d; )
881
- d.addEventListener("scroll", o), d = d.parentElement;
882
- window.addEventListener("scroll", o), window.addEventListener("resize", o), r._cleanup = () => {
883
- let l = e.parentElement;
884
- for (; l; )
885
- l.removeEventListener("scroll", o), l = l.parentElement;
886
- window.removeEventListener("scroll", o), window.removeEventListener("resize", o);
887
- }, r.querySelector(".btn-align-left")?.addEventListener("click", () => {
888
- e.style.display = "block", e.style.marginLeft = "0", e.style.marginRight = "auto", E();
889
- }), r.querySelector(".btn-align-center")?.addEventListener("click", () => {
890
- e.style.display = "block", e.style.marginLeft = "auto", e.style.marginRight = "auto", E();
891
- }), r.querySelector(".btn-align-right")?.addEventListener("click", () => {
892
- e.style.display = "block", e.style.marginLeft = "auto", e.style.marginRight = "0", E();
893
- }), r.querySelector(".btn-alt")?.addEventListener("click", () => {
894
- e.tagName === "IMG" && ee(e);
895
- }), r.querySelector(".btn-link")?.addEventListener("click", () => {
896
- te(e);
897
- }), r.querySelector(".btn-replace")?.addEventListener("click", () => {
898
- e.tagName === "IMG" && re(e);
899
- }), r.querySelector(".btn-resize")?.addEventListener("click", () => {
900
- const l = prompt("Enter width in pixels:", String(e.width || e.offsetWidth));
901
- if (l && !isNaN(parseInt(l))) {
902
- const c = parseInt(l);
903
- e.style.width = `${c}px`, e.setAttribute("width", String(c)), q(), E();
904
- }
905
- }), r.querySelector(".btn-remove")?.addEventListener("click", () => {
906
- confirm("Remove this media?") && (e.remove(), s && (s._cleanup && s._cleanup(), s.remove(), s = null), p = null, q());
907
- }), r._cleanup = () => {
908
- window.removeEventListener("scroll", E), window.removeEventListener("resize", E);
909
- };
910
- }, X = (e) => {
911
- T = e || null, Q(), document.addEventListener("click", (t) => {
912
- const r = t.target;
913
- if (r.tagName === "IMG" || r.tagName === "VIDEO") {
914
- const a = r;
915
- let i = !1;
916
- if (T ? i = T.contains(a) : i = !!a.closest('[contenteditable="true"]'), i) {
917
- t.preventDefault(), t.stopPropagation(), p = a, p.style.display = "block", P(a), q();
918
- return;
919
- }
920
- }
921
- if (!r.closest(".btn-link, .btn-resize, .btn-remove") && s && !r.closest("button")) {
922
- if (s._cleanup && s._cleanup(), s.remove(), s = null, p && p.parentElement) {
923
- const a = p.parentElement;
924
- a._originalPosition !== void 0 && (a.style.position = a._originalPosition, delete a._originalPosition);
925
- }
926
- p = null, q();
927
- }
928
- }), R.forEach((t) => {
929
- t.addEventListener("mousedown", (r) => {
930
- if (!p) return;
931
- r.preventDefault(), r.stopPropagation(), D = !0, I = t.getAttribute("data-position"), j = r.clientX, F = r.clientY;
932
- const a = p.getBoundingClientRect();
933
- $ = a.width, C = a.height, N = $ / C, document.body.style.userSelect = "none", document.body.style.cursor = `${I}-resize`;
934
- });
935
- }), document.addEventListener("mousemove", (t) => {
936
- if (!D || !p || !I) return;
937
- const r = t.clientX - j, a = t.clientY - F;
938
- let i = $, o = C;
939
- switch (I) {
940
- case "se":
941
- i = $ + r, o = C + a;
942
- break;
943
- case "sw":
944
- i = $ - r, o = C + a;
945
- break;
946
- case "ne":
947
- i = $ + r, o = C - a;
948
- break;
949
- case "nw":
950
- i = $ - r, o = C - a;
951
- break;
952
- }
953
- Math.abs(r) > Math.abs(a) ? o = i / N : i = o * N, i = Math.max(50, i), o = Math.max(50, o), p.style.width = `${i}px`, p.style.height = `${o}px`, p.setAttribute("width", String(Math.round(i))), p.setAttribute("height", String(Math.round(o))), q(), E();
954
- }), document.addEventListener("mouseup", () => {
955
- D && (D = !1, I = null, document.body.style.userSelect = "", document.body.style.cursor = "");
956
- }), window.addEventListener("scroll", q), window.addEventListener("resize", q);
957
- };
958
- typeof window < "u" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, X());
959
- const le = () => ({
960
- name: "image",
961
- initialize: (e) => {
962
- const t = e?.editorElement;
963
- X(t);
1
+ import { M as i, a as d, c as r, b as s, d as c, g as m, p as n, s as t } from "./MediaManagerPlugin.native-DZrmcmnm.mjs";
2
+ const e = [
3
+ {
4
+ id: "image",
5
+ label: "Image",
6
+ description: "Upload or choose an image",
7
+ command: "insertImage",
8
+ keywords: ["picture", "photo", "img", "upload"]
964
9
  },
965
- toolbar: [
966
- {
967
- label: "Image",
968
- command: "insertImage",
969
- icon: '<svg width="24px" height="24px" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><g><rect fill="none" height="22" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="30" x="1" y="5"></rect><polygon fill="none" points="31,27 21,17 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><polygon fill="none" points="18,20 9,11 1,19 1,27 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><circle cx="19" cy="11" fill="none" r="2" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></circle></g></svg>'
970
- },
971
- {
972
- label: "Video",
973
- command: "insertVideo",
974
- icon: '<svg width="24" height="24" focusable="false"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"></path></svg>'
975
- }
976
- ],
977
- commands: {
978
- insertImage: (e, t) => {
979
- const r = t?.contentElement instanceof HTMLElement ? t.contentElement : void 0;
980
- return W("image", r), !0;
981
- },
982
- insertVideo: (e, t) => {
983
- const r = t?.contentElement instanceof HTMLElement ? t.contentElement : void 0;
984
- return W("video", r), !0;
985
- }
10
+ {
11
+ id: "audio",
12
+ label: "Audio",
13
+ description: "Upload or choose an audio file",
14
+ command: "insertAudio",
15
+ keywords: ["sound", "music", "podcast", "mp3"]
986
16
  },
987
- keymap: {
988
- "Mod-Shift-i": "insertImage"
17
+ {
18
+ id: "video",
19
+ label: "Video",
20
+ description: "Upload or choose a video",
21
+ command: "insertVideo",
22
+ keywords: ["movie", "clip", "mp4"]
989
23
  }
990
- }), ae = {
991
- apiEndpoints: {
992
- upload: "/media/upload",
993
- library: "/media/library",
994
- delete: "/media/library"
995
- },
996
- maxFileSize: 10 * 1024 * 1024,
997
- // 10MB
998
- allowedTypes: [
999
- "image/jpeg",
1000
- "image/png",
1001
- "image/gif",
1002
- "video/mp4",
1003
- "video/webm"
1004
- ],
1005
- headers: {
1006
- // Add default headers if needed (e.g., API key)
1007
- // 'Authorization': 'Bearer YOUR_API_KEY',
1008
- // 'X-API-Key': 'YOUR_API_KEY'
1009
- }
1010
- };
1011
- let V = { ...ae };
1012
- function de(e) {
1013
- V = { ...V, ...e };
1014
- }
1015
- function se() {
1016
- return { ...V };
1017
- }
24
+ ];
1018
25
  export {
1019
- le as MediaManagerPlugin,
1020
- se as getMediaManagerConfig,
1021
- de as setMediaManagerConfig
26
+ i as MediaManagerPlugin,
27
+ d as MediaUploadError,
28
+ r as createBase64Provider,
29
+ s as createCallbackProvider,
30
+ c as createRestProvider,
31
+ m as getMediaManagerConfig,
32
+ e as mediaSlashItems,
33
+ n as parseEmbedUrl,
34
+ t as setMediaManagerConfig
1022
35
  };