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