@editora/plugins 1.0.1 → 1.0.4

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 (105) hide show
  1. package/README.md +173 -110
  2. package/dist/a11y-checker.cjs.js +109 -0
  3. package/dist/a11y-checker.esm.js +509 -0
  4. package/dist/anchor.cjs.js +176 -0
  5. package/dist/anchor.esm.js +400 -0
  6. package/dist/background-color.cjs.js +218 -0
  7. package/dist/background-color.esm.js +482 -0
  8. package/dist/blockquote.cjs.js +1 -0
  9. package/dist/blockquote.esm.js +47 -0
  10. package/dist/bold.cjs.js +1 -0
  11. package/dist/bold.esm.js +44 -0
  12. package/dist/capitalization.cjs.js +1 -0
  13. package/dist/capitalization.esm.js +78 -0
  14. package/dist/checklist.cjs.js +1 -0
  15. package/dist/checklist.esm.js +305 -0
  16. package/dist/clear-formatting.cjs.js +1 -0
  17. package/dist/clear-formatting.esm.js +138 -0
  18. package/dist/code-sample.cjs.js +161 -0
  19. package/dist/code-sample.esm.js +381 -0
  20. package/dist/code.cjs.js +598 -0
  21. package/dist/code.esm.js +2034 -0
  22. package/dist/colorSelectionApply-C0iOfMWb.js +1 -0
  23. package/dist/colorSelectionApply-D8r_gV32.mjs +63 -0
  24. package/dist/comments.cjs.js +354 -0
  25. package/dist/comments.esm.js +692 -0
  26. package/dist/direction.cjs.js +1 -0
  27. package/dist/direction.esm.js +129 -0
  28. package/dist/document-manager.cjs.js +1 -0
  29. package/dist/document-manager.esm.js +6 -0
  30. package/dist/{documentManager-D86di_ZO.mjs → documentManager-DRUc1-Cs.mjs} +3 -3
  31. package/dist/{documentManager-Cw420fPO.js → documentManager-_tQQfQi9.js} +3 -3
  32. package/dist/editorContainerHelpers-C7kdWnS0.mjs +26 -0
  33. package/dist/editorContainerHelpers-CFbfiOJI.js +1 -0
  34. package/dist/embed-iframe.cjs.js +361 -0
  35. package/dist/embed-iframe.esm.js +556 -0
  36. package/dist/emojis.cjs.js +284 -0
  37. package/dist/emojis.esm.js +1080 -0
  38. package/dist/font-family.cjs.js +1 -0
  39. package/dist/font-family.esm.js +152 -0
  40. package/dist/font-size.cjs.js +1 -0
  41. package/dist/font-size.esm.js +278 -0
  42. package/dist/footnote.cjs.js +85 -0
  43. package/dist/footnote.esm.js +397 -0
  44. package/dist/fullscreen.cjs.js +1 -0
  45. package/dist/fullscreen.esm.js +73 -0
  46. package/dist/heading.cjs.js +1 -0
  47. package/dist/heading.esm.js +63 -0
  48. package/dist/history.cjs.js +1 -0
  49. package/dist/history.esm.js +246 -0
  50. package/dist/indent.cjs.js +1 -0
  51. package/dist/indent.esm.js +146 -0
  52. package/dist/index-Bskk414V.mjs +145 -0
  53. package/dist/index-D3pJyAsj.js +1 -0
  54. package/dist/index.cjs.js +1 -1
  55. package/dist/{index.es-B4xMKvwd.js → index.es-Cz1qItab.js} +1 -1
  56. package/dist/{index.es-lzohzZmW.mjs → index.es-DEcRmSTY.mjs} +1 -1
  57. package/dist/index.esm.js +89 -49
  58. package/dist/italic.cjs.js +1 -0
  59. package/dist/italic.esm.js +40 -0
  60. package/dist/line-height.cjs.js +1 -0
  61. package/dist/line-height.esm.js +145 -0
  62. package/dist/link.cjs.js +138 -0
  63. package/dist/link.esm.js +276 -0
  64. package/dist/list.cjs.js +1 -0
  65. package/dist/list.esm.js +102 -0
  66. package/dist/lite.cjs.js +1 -0
  67. package/dist/lite.esm.js +61 -0
  68. package/dist/math.cjs.js +45 -0
  69. package/dist/math.esm.js +249 -0
  70. package/dist/media-manager.cjs.js +619 -0
  71. package/dist/media-manager.esm.js +994 -0
  72. package/dist/merge-tag.cjs.js +93 -0
  73. package/dist/merge-tag.esm.js +412 -0
  74. package/dist/page-break.cjs.js +72 -0
  75. package/dist/page-break.esm.js +295 -0
  76. package/dist/plugins.css +1 -1
  77. package/dist/preview.cjs.js +230 -0
  78. package/dist/preview.esm.js +321 -0
  79. package/dist/print.cjs.js +254 -0
  80. package/dist/print.esm.js +309 -0
  81. package/dist/purify.es-DHhaBdbu.mjs +470 -0
  82. package/dist/purify.es-T2a3nLiC.js +3 -0
  83. package/dist/shared-config.cjs.js +1 -0
  84. package/dist/shared-config.esm.js +30 -0
  85. package/dist/special-characters.cjs.js +257 -0
  86. package/dist/special-characters.esm.js +772 -0
  87. package/dist/spell-check.cjs.js +512 -0
  88. package/dist/spell-check.esm.js +1013 -0
  89. package/dist/strikethrough.cjs.js +1 -0
  90. package/dist/strikethrough.esm.js +71 -0
  91. package/dist/table.cjs.js +35 -0
  92. package/dist/table.esm.js +477 -0
  93. package/dist/template.cjs.js +356 -0
  94. package/dist/template.esm.js +560 -0
  95. package/dist/text-alignment.cjs.js +1 -0
  96. package/dist/text-alignment.esm.js +105 -0
  97. package/dist/text-color.cjs.js +300 -0
  98. package/dist/text-color.esm.js +507 -0
  99. package/dist/underline.cjs.js +1 -0
  100. package/dist/underline.esm.js +34 -0
  101. package/index.d.ts +62 -0
  102. package/package.json +217 -5
  103. package/LICENSE +0 -21
  104. package/dist/index-CnEGPLxN.js +0 -3752
  105. package/dist/index-xwiBh2x6.mjs +0 -11739
@@ -0,0 +1,619 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./shared-config.cjs.js");let T=null,s=null,d=null,R=[],A=!1,q=null,U=0,P=0,z=0,$=0,_=1,I=null;const j='[data-theme="dark"], .dark, .editora-theme-dark',O=()=>{if(typeof document>"u"||document.getElementById("rte-media-dialog-styles"))return;const e=document.createElement("style");e.id="rte-media-dialog-styles",e.textContent=`
2
+ .rte-media-overlay {
3
+ --rte-media-overlay-bg: rgba(15, 23, 36, 0.56);
4
+ --rte-media-bg: #ffffff;
5
+ --rte-media-text: #101828;
6
+ --rte-media-muted: #5f6b7d;
7
+ --rte-media-border: #d6dbe4;
8
+ --rte-media-surface: #f7f9fc;
9
+ --rte-media-surface-hover: #eef2f7;
10
+ --rte-media-accent: #1f75fe;
11
+ --rte-media-accent-hover: #165fd6;
12
+ --rte-media-danger: #dc3545;
13
+ --rte-media-danger-hover: #b92735;
14
+ --rte-media-ring: rgba(31, 117, 254, 0.18);
15
+ position: fixed;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ bottom: 0;
20
+ background: var(--rte-media-overlay-bg);
21
+ backdrop-filter: blur(2px);
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+ z-index: 99999;
26
+ padding: 16px;
27
+ box-sizing: border-box;
28
+ }
29
+
30
+ .rte-media-overlay.rte-ui-theme-dark {
31
+ --rte-media-overlay-bg: rgba(2, 8, 20, 0.72);
32
+ --rte-media-bg: #202938;
33
+ --rte-media-text: #e8effc;
34
+ --rte-media-muted: #a5b1c5;
35
+ --rte-media-border: #49566c;
36
+ --rte-media-surface: #2a3444;
37
+ --rte-media-surface-hover: #344256;
38
+ --rte-media-accent: #58a6ff;
39
+ --rte-media-accent-hover: #4598f4;
40
+ --rte-media-danger: #ff7b72;
41
+ --rte-media-danger-hover: #ff645b;
42
+ --rte-media-ring: rgba(88, 166, 255, 0.22);
43
+ }
44
+
45
+ .rte-media-dialog {
46
+ width: min(92vw, 640px);
47
+ max-height: 90vh;
48
+ display: flex;
49
+ flex-direction: column;
50
+ overflow: hidden;
51
+ background: var(--rte-media-bg);
52
+ color: var(--rte-media-text);
53
+ border: 1px solid var(--rte-media-border);
54
+ border-radius: 12px;
55
+ box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
56
+ }
57
+
58
+ .rte-media-dialog.rte-media-dialog-compact {
59
+ width: min(92vw, 520px);
60
+ }
61
+
62
+ .rte-media-header {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: space-between;
66
+ padding: 16px 20px;
67
+ border-bottom: 1px solid var(--rte-media-border);
68
+ background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
69
+ }
70
+
71
+ .rte-media-title {
72
+ margin: 0;
73
+ font-size: 18px;
74
+ font-weight: 600;
75
+ color: var(--rte-media-text);
76
+ }
77
+
78
+ .rte-media-close-btn {
79
+ width: 32px;
80
+ height: 32px;
81
+ border: none;
82
+ border-radius: 8px;
83
+ background: transparent;
84
+ color: var(--rte-media-muted);
85
+ font-size: 24px;
86
+ line-height: 1;
87
+ cursor: pointer;
88
+ transition: background-color 0.16s ease, color 0.16s ease;
89
+ }
90
+
91
+ .rte-media-close-btn:hover {
92
+ background: var(--rte-media-surface-hover);
93
+ color: var(--rte-media-text);
94
+ }
95
+
96
+ .rte-media-tabs {
97
+ display: grid;
98
+ grid-template-columns: 1fr 1fr;
99
+ border-bottom: 1px solid var(--rte-media-border);
100
+ gap: 0;
101
+ }
102
+
103
+ .rte-media-tab {
104
+ border: none;
105
+ border-right: 1px solid var(--rte-media-border);
106
+ padding: 12px 14px;
107
+ background: var(--rte-media-surface);
108
+ color: var(--rte-media-muted);
109
+ font-size: 14px;
110
+ font-weight: 600;
111
+ cursor: pointer;
112
+ transition: background-color 0.16s ease, color 0.16s ease;
113
+ }
114
+
115
+ .rte-media-tab:last-child {
116
+ border-right: none;
117
+ }
118
+
119
+ .rte-media-tab:hover {
120
+ background: var(--rte-media-surface-hover);
121
+ color: var(--rte-media-text);
122
+ }
123
+
124
+ .rte-media-tab.active {
125
+ background: var(--rte-media-accent);
126
+ color: #fff;
127
+ }
128
+
129
+ .rte-media-body {
130
+ padding: 20px;
131
+ overflow-y: auto;
132
+ flex: 1;
133
+ }
134
+
135
+ .rte-media-field {
136
+ margin-bottom: 16px;
137
+ }
138
+
139
+ .rte-media-grid {
140
+ display: grid;
141
+ grid-template-columns: 1fr 1fr;
142
+ gap: 12px;
143
+ margin-bottom: 16px;
144
+ }
145
+
146
+ .rte-media-label {
147
+ display: block;
148
+ margin-bottom: 8px;
149
+ color: var(--rte-media-text);
150
+ font-size: 14px;
151
+ font-weight: 600;
152
+ }
153
+
154
+ .rte-media-input,
155
+ .rte-media-textarea {
156
+ width: 100%;
157
+ box-sizing: border-box;
158
+ padding: 10px 12px;
159
+ border: 1px solid var(--rte-media-border);
160
+ border-radius: 8px;
161
+ background: var(--rte-media-surface);
162
+ color: var(--rte-media-text);
163
+ font-size: 14px;
164
+ transition: border-color 0.16s ease, box-shadow 0.16s ease;
165
+ }
166
+
167
+ .rte-media-input::placeholder,
168
+ .rte-media-textarea::placeholder {
169
+ color: var(--rte-media-muted);
170
+ }
171
+
172
+ .rte-media-input:focus,
173
+ .rte-media-textarea:focus {
174
+ outline: none;
175
+ border-color: var(--rte-media-accent);
176
+ box-shadow: 0 0 0 3px var(--rte-media-ring);
177
+ }
178
+
179
+ .rte-media-textarea {
180
+ min-height: 92px;
181
+ resize: vertical;
182
+ font-family: inherit;
183
+ }
184
+
185
+ .rte-media-dropzone {
186
+ border: 2px dashed var(--rte-media-border);
187
+ border-radius: 12px;
188
+ padding: 36px 18px;
189
+ text-align: center;
190
+ cursor: pointer;
191
+ background: var(--rte-media-surface);
192
+ transition: border-color 0.16s ease, background-color 0.16s ease;
193
+ }
194
+
195
+ .rte-media-dropzone:hover,
196
+ .rte-media-dropzone.is-dragover {
197
+ border-color: var(--rte-media-accent);
198
+ background: var(--rte-media-surface-hover);
199
+ }
200
+
201
+ .rte-media-dropzone-icon {
202
+ font-size: 40px;
203
+ margin-bottom: 10px;
204
+ line-height: 1;
205
+ }
206
+
207
+ .rte-media-dropzone-title {
208
+ margin: 0 0 8px 0;
209
+ font-size: 16px;
210
+ font-weight: 600;
211
+ color: var(--rte-media-text);
212
+ }
213
+
214
+ .rte-media-muted {
215
+ margin: 0 0 8px 0;
216
+ color: var(--rte-media-muted);
217
+ font-size: 14px;
218
+ }
219
+
220
+ .rte-media-hint {
221
+ margin: 0;
222
+ color: var(--rte-media-muted);
223
+ font-size: 12px;
224
+ }
225
+
226
+ .rte-media-progress {
227
+ margin-top: 16px;
228
+ }
229
+
230
+ .rte-media-progress-track {
231
+ height: 8px;
232
+ border-radius: 999px;
233
+ background: var(--rte-media-surface);
234
+ overflow: hidden;
235
+ border: 1px solid var(--rte-media-border);
236
+ }
237
+
238
+ .rte-media-progress-bar {
239
+ height: 100%;
240
+ width: 0;
241
+ background: var(--rte-media-accent);
242
+ transition: width 0.3s ease;
243
+ }
244
+
245
+ .rte-media-progress-text {
246
+ margin-top: 8px;
247
+ text-align: center;
248
+ color: var(--rte-media-muted);
249
+ font-size: 13px;
250
+ }
251
+
252
+ .rte-media-preview {
253
+ border: 1px solid var(--rte-media-border);
254
+ border-radius: 10px;
255
+ padding: 10px;
256
+ text-align: center;
257
+ background: var(--rte-media-surface);
258
+ }
259
+
260
+ .rte-media-preview img,
261
+ .rte-media-preview video {
262
+ max-width: 100%;
263
+ max-height: 240px;
264
+ }
265
+
266
+ .rte-media-helper {
267
+ margin-top: 8px;
268
+ margin-bottom: 0;
269
+ font-size: 12px;
270
+ color: var(--rte-media-muted);
271
+ line-height: 1.5;
272
+ }
273
+
274
+ .rte-media-footer {
275
+ display: flex;
276
+ justify-content: flex-end;
277
+ gap: 10px;
278
+ padding: 16px 20px;
279
+ border-top: 1px solid var(--rte-media-border);
280
+ background: var(--rte-media-surface);
281
+ }
282
+
283
+ .rte-media-footer.rte-media-footer-spread {
284
+ justify-content: space-between;
285
+ align-items: center;
286
+ }
287
+
288
+ .rte-media-btn {
289
+ border-radius: 8px;
290
+ border: 1px solid transparent;
291
+ padding: 10px 16px;
292
+ font-size: 14px;
293
+ font-weight: 600;
294
+ cursor: pointer;
295
+ transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
296
+ }
297
+
298
+ .rte-media-btn-secondary {
299
+ background: var(--rte-media-bg);
300
+ border-color: var(--rte-media-border);
301
+ color: var(--rte-media-text);
302
+ }
303
+
304
+ .rte-media-btn-secondary:hover {
305
+ background: var(--rte-media-surface-hover);
306
+ }
307
+
308
+ .rte-media-btn-primary {
309
+ background: var(--rte-media-accent);
310
+ color: #fff;
311
+ }
312
+
313
+ .rte-media-btn-primary:hover {
314
+ background: var(--rte-media-accent-hover);
315
+ }
316
+
317
+ .rte-media-btn-primary:disabled {
318
+ opacity: 0.55;
319
+ cursor: not-allowed;
320
+ }
321
+
322
+ .rte-media-btn-danger {
323
+ background: var(--rte-media-danger);
324
+ color: #fff;
325
+ }
326
+
327
+ .rte-media-btn-danger:hover {
328
+ background: var(--rte-media-danger-hover);
329
+ }
330
+
331
+ .rte-media-checkbox-label {
332
+ display: inline-flex;
333
+ align-items: center;
334
+ gap: 8px;
335
+ color: var(--rte-media-text);
336
+ font-size: 14px;
337
+ cursor: pointer;
338
+ }
339
+
340
+ .rte-media-checkbox-label input {
341
+ accent-color: var(--rte-media-accent);
342
+ }
343
+
344
+ .rte-media-actions {
345
+ display: flex;
346
+ gap: 10px;
347
+ }
348
+
349
+ .rte-media-spacer {
350
+ flex: 1;
351
+ }
352
+
353
+ .media-floating-toolbar {
354
+ --rte-media-toolbar-bg: #ffffff;
355
+ --rte-media-toolbar-border: #d6dbe4;
356
+ --rte-media-toolbar-text: #344054;
357
+ --rte-media-toolbar-hover-bg: #f3f6fb;
358
+ --rte-media-toolbar-hover-text: #101828;
359
+ --rte-media-toolbar-active-bg: #e6edf7;
360
+ --rte-media-toolbar-separator: #d9e1eb;
361
+ --rte-media-toolbar-danger-hover-bg: #fee2e2;
362
+ --rte-media-toolbar-danger-hover-text: #b42318;
363
+ position: absolute;
364
+ display: none;
365
+ align-items: center;
366
+ gap: 2px;
367
+ padding: 4px;
368
+ border: 1px solid var(--rte-media-toolbar-border);
369
+ border-radius: 8px;
370
+ background: var(--rte-media-toolbar-bg);
371
+ color: var(--rte-media-toolbar-text);
372
+ box-shadow: 0 10px 24px rgba(15, 23, 36, 0.18);
373
+ z-index: 10000;
374
+ pointer-events: auto;
375
+ backdrop-filter: blur(6px);
376
+ }
377
+
378
+ .media-floating-toolbar.rte-ui-theme-dark,
379
+ ${j} .media-floating-toolbar {
380
+ --rte-media-toolbar-bg: #24303f;
381
+ --rte-media-toolbar-border: #4a5a71;
382
+ --rte-media-toolbar-text: #d9e6fb;
383
+ --rte-media-toolbar-hover-bg: #33445a;
384
+ --rte-media-toolbar-hover-text: #f4f8ff;
385
+ --rte-media-toolbar-active-bg: #415875;
386
+ --rte-media-toolbar-separator: #566884;
387
+ --rte-media-toolbar-danger-hover-bg: #5f2a32;
388
+ --rte-media-toolbar-danger-hover-text: #ffd7d5;
389
+ box-shadow: 0 16px 30px rgba(2, 8, 20, 0.42);
390
+ }
391
+
392
+ .media-floating-toolbar-btn {
393
+ width: 30px;
394
+ height: 30px;
395
+ border: none;
396
+ border-radius: 6px;
397
+ background: transparent;
398
+ color: inherit;
399
+ display: inline-flex;
400
+ align-items: center;
401
+ justify-content: center;
402
+ cursor: pointer;
403
+ transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
404
+ }
405
+
406
+ .media-floating-toolbar-btn:hover {
407
+ background: var(--rte-media-toolbar-hover-bg);
408
+ color: var(--rte-media-toolbar-hover-text);
409
+ }
410
+
411
+ .media-floating-toolbar-btn:active {
412
+ background: var(--rte-media-toolbar-active-bg);
413
+ transform: scale(0.96);
414
+ }
415
+
416
+ .media-floating-toolbar-btn.btn-remove:hover {
417
+ background: var(--rte-media-toolbar-danger-hover-bg);
418
+ color: var(--rte-media-toolbar-danger-hover-text);
419
+ }
420
+
421
+ .media-floating-toolbar-separator {
422
+ width: 1px;
423
+ height: 20px;
424
+ margin: 0 2px;
425
+ background: var(--rte-media-toolbar-separator);
426
+ }
427
+ `,document.head.appendChild(e)},G=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.anchorNode;return(t instanceof HTMLElement?t:t?.parentElement)?.closest(".rte-content, .editora-content")||null},X=e=>{if(e)return e;const t=G();if(t)return t;if(I)return I;const r=document.activeElement;return r?r.closest(".rte-content, .editora-content")||r:null},F=e=>{const t=X(e);return t?!!t.closest(j):!1},D=e=>{O();const t=document.createElement("div");return t.className="rte-media-overlay",F(e)&&t.classList.add("rte-ui-theme-dark"),t},B=(e=!1)=>{const t=document.createElement("div");return t.className=e?"rte-media-dialog rte-media-dialog-compact":"rte-media-dialog",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","true"),t},V=(e,t)=>{const r=window.getSelection();r&&r.rangeCount>0&&(T=r.getRangeAt(0).cloneRange());const i=D(t),a=B();let o="upload",n="",c="",m="",b="";const v=()=>{a.innerHTML=`
428
+ <div class="rte-media-header">
429
+ <h2 class="rte-media-title">Insert ${e==="image"?"Image":"Video"}</h2>
430
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
431
+ </div>
432
+
433
+ <div class="rte-media-tabs">
434
+ <button class="tab-upload rte-media-tab ${o==="upload"?"active":""}" type="button">Upload</button>
435
+ <button class="tab-url rte-media-tab ${o==="url"?"active":""}" type="button">URL</button>
436
+ </div>
437
+
438
+ <div class="rte-media-body">
439
+ ${o==="upload"?`
440
+ <div id="upload-section">
441
+ <div class="dropzone rte-media-dropzone">
442
+ <div class="rte-media-dropzone-icon">📁</div>
443
+ <p class="rte-media-dropzone-title">Drag and drop your ${e} here</p>
444
+ <p class="rte-media-muted">or click to browse</p>
445
+ <p class="rte-media-hint">Max file size: 50MB</p>
446
+ </div>
447
+ <input type="file" id="file-input" accept="${e==="image"?"image/*":"video/*"}" style="display: none;">
448
+ <div id="upload-progress" class="rte-media-progress" style="display: none;">
449
+ <div class="rte-media-progress-track">
450
+ <div id="progress-bar" class="rte-media-progress-bar"></div>
451
+ </div>
452
+ <p id="progress-text" class="rte-media-progress-text">Uploading...</p>
453
+ </div>
454
+ </div>
455
+ `:`
456
+ <div id="url-section">
457
+ <div class="rte-media-field">
458
+ <label class="rte-media-label">URL</label>
459
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${e}.${e==="image"?"jpg":"mp4"}" value="${n}">
460
+ </div>
461
+ ${e==="image"?`
462
+ <div class="rte-media-field">
463
+ <label class="rte-media-label">Alt Text (for accessibility)</label>
464
+ <input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${b}">
465
+ </div>
466
+ `:""}
467
+ <div class="rte-media-grid">
468
+ <div class="rte-media-field">
469
+ <label class="rte-media-label">Width (px)</label>
470
+ <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${c}">
471
+ </div>
472
+ <div class="rte-media-field">
473
+ <label class="rte-media-label">Height (px)</label>
474
+ <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${m}">
475
+ </div>
476
+ </div>
477
+ ${n?`
478
+ <div class="rte-media-field">
479
+ <label class="rte-media-label">Preview</label>
480
+ <div class="rte-media-preview">
481
+ ${e==="image"?`<img src="${n}" alt="Preview">`:`<video src="${n}" controls></video>`}
482
+ </div>
483
+ </div>
484
+ `:""}
485
+ </div>
486
+ `}
487
+ </div>
488
+
489
+ <div class="rte-media-footer">
490
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
491
+ <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!n&&o==="url"?"disabled":""}>Insert</button>
492
+ </div>
493
+ `};v(),i.appendChild(a),document.body.appendChild(i);const h=()=>{i.parentNode&&i.parentNode.removeChild(i)},E=()=>{if(!n)return;const l=e==="image"?document.createElement("img"):document.createElement("video");l.src=n,l.setAttribute("data-media-type",e),e==="image"&&b&&(l.alt=b),c&&(l.style.width=`${c}px`,l.setAttribute("width",c)),m&&(l.style.height=`${m}px`,l.setAttribute("height",m)),e==="video"&&(l.controls=!0),!c&&!m?l.style.cssText="max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;":l.style.cssText=`display: block; margin: 1em 0; cursor: pointer; ${c?`width: ${c}px;`:"max-width: 100%;"} ${m?`height: ${m}px;`:"height: auto;"}`,T&&(T.deleteContents(),T.insertNode(l)),h()},y=async l=>{const g=a.querySelector("#upload-progress"),p=a.querySelector("#progress-bar"),x=a.querySelector("#progress-text");if(g&&p&&x){g.style.display="block";let M=0;const f=setInterval(()=>{M+=Math.random()*30,M>90&&(M=90),p.style.width=`${M}%`},200);try{const k=new FileReader;k.onload=()=>{clearInterval(f),p.style.width="100%",x.textContent="Upload complete",setTimeout(()=>{n=k.result,o="url",v(),u()},500)},k.readAsDataURL(l)}catch{clearInterval(f),x.textContent="Upload failed"}}},u=()=>{const l=a.querySelector(".close-btn"),g=a.querySelector(".cancel-btn"),p=a.querySelector("#insert-btn"),x=a.querySelector(".tab-upload"),M=a.querySelector(".tab-url");if(l?.addEventListener("click",h),g?.addEventListener("click",h),p?.addEventListener("click",E),x?.addEventListener("click",()=>{o="upload",v(),u()}),M?.addEventListener("click",()=>{o="url",v(),u()}),o==="upload"){const f=a.querySelector(".dropzone"),k=a.querySelector("#file-input");f?.addEventListener("click",()=>k?.click()),f?.addEventListener("dragover",L=>{L.preventDefault(),f.classList.add("is-dragover")}),f?.addEventListener("dragleave",()=>{f.classList.remove("is-dragover")}),f?.addEventListener("drop",L=>{L.preventDefault(),f.classList.remove("is-dragover");const S=L.dataTransfer?.files[0];S&&y(S)}),k?.addEventListener("change",L=>{const S=L.target.files?.[0];S&&y(S)})}if(o==="url"){const f=a.querySelector("#url-input"),k=a.querySelector("#alt-input"),L=a.querySelector("#width-input"),S=a.querySelector("#height-input");f?.addEventListener("input",()=>{n=f.value,v(),u()}),k?.addEventListener("input",()=>{b=k.value}),L?.addEventListener("input",()=>{c=L.value}),S?.addEventListener("input",()=>{m=S.value})}};u(),i.addEventListener("click",l=>{l.target===i&&h()})},Y=()=>{["nw","ne","sw","se"].forEach(t=>{const r=document.createElement("div");r.className=`media-resize-handle-${t}`,r.style.cssText=`
494
+ position: fixed;
495
+ width: 10px;
496
+ height: 10px;
497
+ background: #007bff;
498
+ border: 2px solid white;
499
+ border-radius: 50%;
500
+ cursor: ${t}-resize;
501
+ z-index: 10001;
502
+ display: none;
503
+ box-shadow: 0 1px 3px rgba(0,0,0,0.3);
504
+ `,r.setAttribute("data-position",t),document.body.appendChild(r),R.push(r)})},C=()=>{if(!s){R.forEach(r=>r.style.display="none");return}const e=s.getBoundingClientRect(),t={nw:{x:e.left-5,y:e.top-5},ne:{x:e.right-5,y:e.top-5},sw:{x:e.left-5,y:e.bottom-5},se:{x:e.right-5,y:e.bottom-5}};R.forEach(r=>{const i=r.getAttribute("data-position"),a=t[i];r.style.left=`${a.x}px`,r.style.top=`${a.y}px`,r.style.display="block"})},Z=e=>{const t=D(e),r=B(!0);r.innerHTML=`
505
+ <div class="rte-media-header">
506
+ <h2 class="rte-media-title">Edit Alt Text</h2>
507
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
508
+ </div>
509
+ <div class="rte-media-body">
510
+ <label class="rte-media-label">Alternative Text (for accessibility)</label>
511
+ <textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${e.alt||""}</textarea>
512
+ <p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
513
+ </div>
514
+ <div class="rte-media-footer">
515
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
516
+ <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
517
+ </div>
518
+ `,t.appendChild(r),document.body.appendChild(t);const i=r.querySelector("#alt-text-input"),a=r.querySelector(".close-btn"),o=r.querySelector(".cancel-btn"),n=r.querySelector(".save-btn"),c=()=>{t.parentNode&&t.parentNode.removeChild(t)};a.addEventListener("click",c),o.addEventListener("click",c),t.addEventListener("click",m=>{m.target===t&&c()}),n.addEventListener("click",()=>{e.alt=i.value,c()}),i.focus(),i.select()},K=e=>{const t=e.closest("a"),r=t?.getAttribute("href")||"",i=t?.getAttribute("target")||"_self",a=t?.getAttribute("title")||"",o=D(e),n=B(!0);n.innerHTML=`
519
+ <div class="rte-media-header">
520
+ <h2 class="rte-media-title">${t?"Edit Link":"Add Link"}</h2>
521
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
522
+ </div>
523
+ <div class="rte-media-body">
524
+ <div class="rte-media-field">
525
+ <label class="rte-media-label">URL</label>
526
+ <input id="link-url" type="url" class="rte-media-input" value="${r}" placeholder="https://example.com" />
527
+ </div>
528
+ <div class="rte-media-field">
529
+ <label class="rte-media-label">Title (tooltip)</label>
530
+ <input id="link-title" type="text" class="rte-media-input" value="${a}" placeholder="Optional tooltip text" />
531
+ </div>
532
+ <label class="rte-media-checkbox-label">
533
+ <input id="link-target" type="checkbox" ${i==="_blank"?"checked":""} />
534
+ Open in new window/tab
535
+ </label>
536
+ </div>
537
+ <div class="rte-media-footer rte-media-footer-spread">
538
+ ${t?'<button class="remove-link-btn rte-media-btn rte-media-btn-danger" type="button">Remove Link</button>':'<span class="rte-media-spacer"></span>'}
539
+ <div class="rte-media-actions">
540
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
541
+ <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
542
+ </div>
543
+ </div>
544
+ `,o.appendChild(n),document.body.appendChild(o);const c=n.querySelector("#link-url"),m=n.querySelector("#link-title"),b=n.querySelector("#link-target"),v=n.querySelector(".close-btn"),h=n.querySelector(".cancel-btn"),E=n.querySelector(".save-btn"),y=n.querySelector(".remove-link-btn"),u=()=>{o.parentNode&&o.parentNode.removeChild(o)};v.addEventListener("click",u),h.addEventListener("click",u),o.addEventListener("click",l=>{l.target===o&&u()}),E.addEventListener("click",()=>{const l=c.value.trim();if(l){const g=l.startsWith("http")?l:`https://${l}`;if(t)t.setAttribute("href",g),t.setAttribute("target",b.checked?"_blank":"_self"),b.checked?t.setAttribute("rel","noopener noreferrer"):t.removeAttribute("rel"),m.value.trim()?t.setAttribute("title",m.value.trim()):t.removeAttribute("title");else{const p=document.createElement("a");p.href=g,p.target=b.checked?"_blank":"_self",b.checked&&(p.rel="noopener noreferrer"),m.value.trim()&&(p.title=m.value.trim()),e.replaceWith(p),p.appendChild(e)}u(),d&&s&&H(s)}}),y?.addEventListener("click",()=>{t&&confirm("Remove link from this media?")&&(t.replaceWith(e),u(),d&&s&&H(s))}),c.focus()},J=e=>{const t=D(e),r=B();let i="url",a=e.src;const o=()=>{r.innerHTML=`
545
+ <div class="rte-media-header">
546
+ <h2 class="rte-media-title">Replace Image</h2>
547
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
548
+ </div>
549
+
550
+ <div class="rte-media-tabs">
551
+ <button class="tab-upload rte-media-tab ${i==="upload"?"active":""}" type="button">Upload</button>
552
+ <button class="tab-url rte-media-tab ${i==="url"?"active":""}" type="button">URL</button>
553
+ </div>
554
+
555
+ <div class="rte-media-body">
556
+ ${i==="upload"?`
557
+ <div id="upload-section">
558
+ <div class="dropzone rte-media-dropzone">
559
+ <div class="rte-media-dropzone-icon">📁</div>
560
+ <p class="rte-media-dropzone-title">Drag and drop your image here</p>
561
+ <p class="rte-media-muted">or click to browse</p>
562
+ </div>
563
+ <input type="file" id="file-input" accept="image/*" style="display: none;">
564
+ <div id="upload-progress" class="rte-media-progress" style="display: none;">
565
+ <div class="rte-media-progress-track">
566
+ <div id="progress-bar" class="rte-media-progress-bar"></div>
567
+ </div>
568
+ <p id="progress-text" class="rte-media-progress-text">Uploading...</p>
569
+ </div>
570
+ </div>
571
+ `:`
572
+ <div id="url-section">
573
+ <div class="rte-media-field">
574
+ <label class="rte-media-label">Image URL</label>
575
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${a}">
576
+ </div>
577
+ ${a?`
578
+ <div class="rte-media-field">
579
+ <label class="rte-media-label">Preview</label>
580
+ <div class="rte-media-preview">
581
+ <img src="${a}" alt="Preview" onerror="this.parentElement.innerHTML='<p class=&quot;rte-media-muted&quot;>Failed to load image</p>'">
582
+ </div>
583
+ </div>
584
+ `:""}
585
+ </div>
586
+ `}
587
+ </div>
588
+
589
+ <div class="rte-media-footer">
590
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
591
+ <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!a&&i==="url"?"disabled":""}>Replace</button>
592
+ </div>
593
+ `};o(),t.appendChild(r),document.body.appendChild(t);const n=()=>{t.parentNode&&t.parentNode.removeChild(t)},c=()=>{a&&(e.src=a,n())},m=async v=>{const h=r.querySelector("#upload-progress"),E=r.querySelector("#progress-bar"),y=r.querySelector("#progress-text");if(h&&E&&y){h.style.display="block";let u=0;const l=setInterval(()=>{u+=Math.random()*30,u>90&&(u=90),E.style.width=`${u}%`},200);try{const g=new FileReader;g.onload=()=>{clearInterval(l),E.style.width="100%",y.textContent="Upload complete",setTimeout(()=>{a=g.result,i="url",o(),b()},500)},g.readAsDataURL(v)}catch{clearInterval(l),y.textContent="Upload failed"}}},b=()=>{const v=r.querySelector(".close-btn"),h=r.querySelector(".cancel-btn"),E=r.querySelector("#replace-btn"),y=r.querySelector(".tab-upload"),u=r.querySelector(".tab-url");if(v?.addEventListener("click",n),h?.addEventListener("click",n),E?.addEventListener("click",c),y?.addEventListener("click",()=>{i="upload",o(),b()}),u?.addEventListener("click",()=>{i="url",o(),b()}),i==="upload"){const l=r.querySelector(".dropzone"),g=r.querySelector("#file-input");l?.addEventListener("click",()=>g?.click()),l?.addEventListener("dragover",p=>{p.preventDefault(),l.classList.add("is-dragover")}),l?.addEventListener("dragleave",()=>{l.classList.remove("is-dragover")}),l?.addEventListener("drop",p=>{p.preventDefault(),l.classList.remove("is-dragover");const x=p.dataTransfer?.files[0];x&&m(x)}),g?.addEventListener("change",p=>{const x=p.target.files?.[0];x&&m(x)})}if(i==="url"){const l=r.querySelector("#url-input");l?.addEventListener("input",()=>{a=l.value,o(),b()})}};b(),t.addEventListener("click",v=>{v.target===t&&n()})},w=()=>{if(!d||!s)return;const e=d.offsetHeight||40,t=s.offsetTop,r=s.offsetLeft,i=s.offsetWidth,a=t-e-8,o=r+i/2-(d.offsetWidth||120)/2;d.style.top=`${a}px`,d.style.left=`${o}px`,setTimeout(()=>{d&&(d.style.display="flex")},100)},H=e=>{d&&(d._cleanup&&d._cleanup(),d.remove());const t=e.parentElement;if(t){const n=t.style.position;(!n||n==="static")&&(t.style.position="relative",t._originalPosition=n),d=document.createElement("div"),d.className="media-floating-toolbar",F(e)&&d.classList.add("rte-ui-theme-dark"),t.insertBefore(d,t.firstChild),w()}const r=e.tagName==="IMG",i=e.closest("a");d.innerHTML=`
594
+ <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
595
+ <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>
596
+ </button>
597
+ <button class="media-floating-toolbar-btn btn-align-center" title="Align Center" type="button">
598
+ <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>
599
+ </button>
600
+ <button class="media-floating-toolbar-btn btn-align-right" title="Align Right" type="button">
601
+ <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>
602
+ </button>
603
+ <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
604
+ ${r?`
605
+ <button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
606
+ <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>
607
+ </button>`:""}
608
+ <button class="media-floating-toolbar-btn btn-link" title="${i?"Edit/Remove Link":"Add Link"}" type="button">
609
+ <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>
610
+ </button>
611
+ ${r?`
612
+ <button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
613
+ <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>
614
+ </button>`:""}
615
+ <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
616
+ <button class="media-floating-toolbar-btn btn-remove" title="Remove" type="button">
617
+ <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>
618
+ </button>
619
+ `,setTimeout(()=>{w()},0);const a=()=>w();let o=s.parentElement;for(;o;)o.addEventListener("scroll",a),o=o.parentElement;window.addEventListener("scroll",a),window.addEventListener("resize",a),d._cleanup=()=>{let n=s?.parentElement;for(;n;)n.removeEventListener("scroll",a),n=n.parentElement;window.removeEventListener("scroll",a),window.removeEventListener("resize",a)},d.querySelector(".btn-align-left")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="0",e.style.marginRight="auto",w()}),d.querySelector(".btn-align-center")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto",w()}),d.querySelector(".btn-align-right")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="0",w()}),d.querySelector(".btn-alt")?.addEventListener("click",()=>{e.tagName==="IMG"&&Z(e)}),d.querySelector(".btn-link")?.addEventListener("click",()=>{K(e)}),d.querySelector(".btn-replace")?.addEventListener("click",()=>{e.tagName==="IMG"&&J(e)}),d.querySelector(".btn-resize")?.addEventListener("click",()=>{const n=prompt("Enter width in pixels:",String(e.width||e.offsetWidth));if(n&&!isNaN(parseInt(n))){const c=parseInt(n);e.style.width=`${c}px`,e.setAttribute("width",String(c)),C(),w()}}),d.querySelector(".btn-remove")?.addEventListener("click",()=>{confirm("Remove this media?")&&(e.remove(),d&&(d._cleanup&&d._cleanup(),d.remove(),d=null),s=null,C())}),d._cleanup=()=>{window.removeEventListener("scroll",w),window.removeEventListener("resize",w)}},W=e=>{I=e||null,Y(),document.addEventListener("click",t=>{const r=t.target;if(r.tagName==="IMG"||r.tagName==="VIDEO"){const i=r;let a=!1;if(I?a=I.contains(i):a=!!i.closest('[contenteditable="true"]'),a){t.preventDefault(),t.stopPropagation(),s=i,s.style.display="block",H(i),C();return}}if(!r.closest(".btn-link, .btn-resize, .btn-remove")&&d&&!r.closest("button")){if(d._cleanup&&d._cleanup(),d.remove(),d=null,s&&s.parentElement){const i=s.parentElement;i._originalPosition!==void 0&&(i.style.position=i._originalPosition,delete i._originalPosition)}s=null,C()}}),R.forEach(t=>{t.addEventListener("mousedown",r=>{if(!s)return;r.preventDefault(),r.stopPropagation(),A=!0,q=t.getAttribute("data-position"),U=r.clientX,P=r.clientY;const i=s.getBoundingClientRect();z=i.width,$=i.height,_=z/$,document.body.style.userSelect="none",document.body.style.cursor=`${q}-resize`})}),document.addEventListener("mousemove",t=>{if(!A||!s||!q)return;const r=t.clientX-U,i=t.clientY-P;let a=z,o=$;switch(q){case"se":a=z+r,o=$+i;break;case"sw":a=z-r,o=$+i;break;case"ne":a=z+r,o=$-i;break;case"nw":a=z-r,o=$-i;break}Math.abs(r)>Math.abs(i)?o=a/_:a=o*_,a=Math.max(50,a),o=Math.max(50,o),s.style.width=`${a}px`,s.style.height=`${o}px`,s.setAttribute("width",String(Math.round(a))),s.setAttribute("height",String(Math.round(o))),C(),w()}),document.addEventListener("mouseup",()=>{A&&(A=!1,q=null,document.body.style.userSelect="",document.body.style.cursor="")}),window.addEventListener("scroll",C),window.addEventListener("resize",C)};typeof window<"u"&&!window.__mediaManagerInitialized&&(window.__mediaManagerInitialized=!0,W());const Q=()=>({name:"image",initialize:e=>{const t=e?.editorElement;W(t)},toolbar:[{label:"Image",command:"insertImage",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>'},{label:"Video",command:"insertVideo",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>'}],commands:{insertImage:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:void 0;return V("image",r),!0},insertVideo:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:void 0;return V("video",r),!0}},keymap:{"Mod-Shift-i":"insertImage"}}),ee={apiEndpoints:{upload:"/media/upload",library:"/media/library",delete:"/media/library"},maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif","video/mp4","video/webm"],headers:{}};let N={...ee};function te(e){N={...N,...e}}function re(){return{...N}}exports.MediaManagerPlugin=Q;exports.getMediaManagerConfig=re;exports.setMediaManagerConfig=te;