@editora/core 1.0.3 → 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 (131) hide show
  1. package/README.md +34 -0
  2. package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
  3. package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
  4. package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
  5. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
  6. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
  7. package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-0Zari_zp.mjs} +329 -310
  8. package/dist/CodeSamplePlugin.native-B-KS1pOl.mjs +384 -0
  9. package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
  10. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
  11. package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
  12. package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
  13. package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
  14. package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
  15. package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
  16. package/dist/HistoryPlugin.native-DCrPdeSW.mjs +257 -0
  17. package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
  18. package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
  19. package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
  20. package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
  21. package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
  22. package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
  23. package/dist/MergeTagPlugin.native-CU9LtsfD.mjs +416 -0
  24. package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
  25. package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
  26. package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
  27. package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
  28. package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
  29. package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
  30. package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
  31. package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
  32. package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
  33. package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
  34. package/dist/core.css +1 -1
  35. package/dist/editora.min.js +31 -29
  36. package/dist/editora.umd.js +31 -29
  37. package/dist/index-CqWQFb3D.js +10 -0
  38. package/dist/index-OwnkG39N.mjs +2227 -0
  39. package/dist/index.cjs.js +14 -18
  40. package/dist/index.esm.js +204 -521
  41. package/dist/plugin-loader.js +26 -26
  42. package/dist/webcomponent-core.js +1286 -295
  43. package/dist/webcomponent-core.min.css +1 -1
  44. package/dist/webcomponent-core.min.js +100 -75
  45. package/dist/webcomponent.cjs.js +1 -1
  46. package/dist/webcomponent.esm.js +1 -1
  47. package/dist/webcomponent.js +1252 -261
  48. package/dist/webcomponent.min.css +1 -1
  49. package/dist/webcomponent.min.js +3616 -2109
  50. package/index.d.ts +355 -0
  51. package/package.json +19 -17
  52. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
  53. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
  54. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
  55. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
  56. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
  57. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
  58. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
  59. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
  60. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
  61. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
  62. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
  63. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
  64. package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
  65. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
  66. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
  67. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
  68. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
  69. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
  70. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
  71. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
  72. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
  73. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
  74. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
  75. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
  76. package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
  77. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
  78. package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
  79. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
  80. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
  81. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
  82. package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
  83. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
  84. package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
  85. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
  86. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
  87. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
  88. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
  89. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
  90. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
  91. package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
  92. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
  93. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
  94. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
  95. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
  96. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
  97. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
  98. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
  99. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
  100. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
  101. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
  102. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
  103. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
  104. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
  105. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
  106. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
  107. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
  108. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
  109. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
  110. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
  111. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
  112. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
  113. package/dist/documentManager-irzj9n3V.mjs.map +0 -1
  114. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
  115. package/dist/editora.min.js.map +0 -1
  116. package/dist/editora.umd.js.map +0 -1
  117. package/dist/index-BF5RBhL9.js +0 -4
  118. package/dist/index-BF5RBhL9.js.map +0 -1
  119. package/dist/index-BPsf460l.mjs +0 -1243
  120. package/dist/index-BPsf460l.mjs.map +0 -1
  121. package/dist/index.cjs.js.map +0 -1
  122. package/dist/index.es-CuicffkQ.mjs.map +0 -1
  123. package/dist/index.esm.js.map +0 -1
  124. package/dist/plugin-loader.js.map +0 -1
  125. package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
  126. package/dist/webcomponent-core.js.map +0 -1
  127. package/dist/webcomponent-core.min.js.map +0 -1
  128. package/dist/webcomponent.cjs.js.map +0 -1
  129. package/dist/webcomponent.esm.js.map +0 -1
  130. package/dist/webcomponent.js.map +0 -1
  131. package/dist/webcomponent.min.js.map +0 -1
@@ -0,0 +1,970 @@
1
+ let R = null, c = null, l = null, _ = [], D = !1, T = null, V = 0, P = 0, q = 0, C = 0, N = 1, A = null;
2
+ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
3
+ if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles")) return;
4
+ const t = document.createElement("style");
5
+ t.id = "rte-media-dialog-styles", t.textContent = `
6
+ .rte-media-overlay {
7
+ --rte-media-overlay-bg: rgba(15, 23, 36, 0.56);
8
+ --rte-media-bg: #ffffff;
9
+ --rte-media-text: #101828;
10
+ --rte-media-muted: #5f6b7d;
11
+ --rte-media-border: #d6dbe4;
12
+ --rte-media-surface: #f7f9fc;
13
+ --rte-media-surface-hover: #eef2f7;
14
+ --rte-media-accent: #1f75fe;
15
+ --rte-media-accent-hover: #165fd6;
16
+ --rte-media-danger: #dc3545;
17
+ --rte-media-danger-hover: #b92735;
18
+ --rte-media-ring: rgba(31, 117, 254, 0.18);
19
+ position: fixed;
20
+ top: 0;
21
+ left: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ background: var(--rte-media-overlay-bg);
25
+ backdrop-filter: blur(2px);
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ z-index: 99999;
30
+ padding: 16px;
31
+ box-sizing: border-box;
32
+ }
33
+
34
+ .rte-media-overlay.rte-ui-theme-dark {
35
+ --rte-media-overlay-bg: rgba(2, 8, 20, 0.72);
36
+ --rte-media-bg: #202938;
37
+ --rte-media-text: #e8effc;
38
+ --rte-media-muted: #a5b1c5;
39
+ --rte-media-border: #49566c;
40
+ --rte-media-surface: #2a3444;
41
+ --rte-media-surface-hover: #344256;
42
+ --rte-media-accent: #58a6ff;
43
+ --rte-media-accent-hover: #4598f4;
44
+ --rte-media-danger: #ff7b72;
45
+ --rte-media-danger-hover: #ff645b;
46
+ --rte-media-ring: rgba(88, 166, 255, 0.22);
47
+ }
48
+
49
+ .rte-media-dialog {
50
+ width: min(92vw, 640px);
51
+ max-height: 90vh;
52
+ display: flex;
53
+ flex-direction: column;
54
+ overflow: hidden;
55
+ background: var(--rte-media-bg);
56
+ color: var(--rte-media-text);
57
+ border: 1px solid var(--rte-media-border);
58
+ border-radius: 12px;
59
+ box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
60
+ }
61
+
62
+ .rte-media-dialog.rte-media-dialog-compact {
63
+ width: min(92vw, 520px);
64
+ }
65
+
66
+ .rte-media-header {
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: space-between;
70
+ padding: 16px 20px;
71
+ border-bottom: 1px solid var(--rte-media-border);
72
+ background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
73
+ }
74
+
75
+ .rte-media-title {
76
+ margin: 0;
77
+ font-size: 18px;
78
+ font-weight: 600;
79
+ color: var(--rte-media-text);
80
+ }
81
+
82
+ .rte-media-close-btn {
83
+ width: 32px;
84
+ height: 32px;
85
+ border: none;
86
+ border-radius: 8px;
87
+ background: transparent;
88
+ color: var(--rte-media-muted);
89
+ font-size: 24px;
90
+ line-height: 1;
91
+ cursor: pointer;
92
+ transition: background-color 0.16s ease, color 0.16s ease;
93
+ }
94
+
95
+ .rte-media-close-btn:hover {
96
+ background: var(--rte-media-surface-hover);
97
+ color: var(--rte-media-text);
98
+ }
99
+
100
+ .rte-media-tabs {
101
+ display: grid;
102
+ grid-template-columns: 1fr 1fr;
103
+ border-bottom: 1px solid var(--rte-media-border);
104
+ gap: 0;
105
+ }
106
+
107
+ .rte-media-tab {
108
+ border: none;
109
+ border-right: 1px solid var(--rte-media-border);
110
+ padding: 12px 14px;
111
+ background: var(--rte-media-surface);
112
+ color: var(--rte-media-muted);
113
+ font-size: 14px;
114
+ font-weight: 600;
115
+ cursor: pointer;
116
+ transition: background-color 0.16s ease, color 0.16s ease;
117
+ }
118
+
119
+ .rte-media-tab:last-child {
120
+ border-right: none;
121
+ }
122
+
123
+ .rte-media-tab:hover {
124
+ background: var(--rte-media-surface-hover);
125
+ color: var(--rte-media-text);
126
+ }
127
+
128
+ .rte-media-tab.active {
129
+ background: var(--rte-media-accent);
130
+ color: #fff;
131
+ }
132
+
133
+ .rte-media-body {
134
+ padding: 20px;
135
+ overflow-y: auto;
136
+ flex: 1;
137
+ }
138
+
139
+ .rte-media-field {
140
+ margin-bottom: 16px;
141
+ }
142
+
143
+ .rte-media-grid {
144
+ display: grid;
145
+ grid-template-columns: 1fr 1fr;
146
+ gap: 12px;
147
+ margin-bottom: 16px;
148
+ }
149
+
150
+ .rte-media-label {
151
+ display: block;
152
+ margin-bottom: 8px;
153
+ color: var(--rte-media-text);
154
+ font-size: 14px;
155
+ font-weight: 600;
156
+ }
157
+
158
+ .rte-media-input,
159
+ .rte-media-textarea {
160
+ width: 100%;
161
+ box-sizing: border-box;
162
+ padding: 10px 12px;
163
+ border: 1px solid var(--rte-media-border);
164
+ border-radius: 8px;
165
+ background: var(--rte-media-surface);
166
+ color: var(--rte-media-text);
167
+ font-size: 14px;
168
+ transition: border-color 0.16s ease, box-shadow 0.16s ease;
169
+ }
170
+
171
+ .rte-media-input::placeholder,
172
+ .rte-media-textarea::placeholder {
173
+ color: var(--rte-media-muted);
174
+ }
175
+
176
+ .rte-media-input:focus,
177
+ .rte-media-textarea:focus {
178
+ outline: none;
179
+ border-color: var(--rte-media-accent);
180
+ box-shadow: 0 0 0 3px var(--rte-media-ring);
181
+ }
182
+
183
+ .rte-media-textarea {
184
+ min-height: 92px;
185
+ resize: vertical;
186
+ font-family: inherit;
187
+ }
188
+
189
+ .rte-media-dropzone {
190
+ border: 2px dashed var(--rte-media-border);
191
+ border-radius: 12px;
192
+ padding: 36px 18px;
193
+ text-align: center;
194
+ cursor: pointer;
195
+ background: var(--rte-media-surface);
196
+ transition: border-color 0.16s ease, background-color 0.16s ease;
197
+ }
198
+
199
+ .rte-media-dropzone:hover,
200
+ .rte-media-dropzone.is-dragover {
201
+ border-color: var(--rte-media-accent);
202
+ background: var(--rte-media-surface-hover);
203
+ }
204
+
205
+ .rte-media-dropzone-icon {
206
+ font-size: 40px;
207
+ margin-bottom: 10px;
208
+ line-height: 1;
209
+ }
210
+
211
+ .rte-media-dropzone-title {
212
+ margin: 0 0 8px 0;
213
+ font-size: 16px;
214
+ font-weight: 600;
215
+ color: var(--rte-media-text);
216
+ }
217
+
218
+ .rte-media-muted {
219
+ margin: 0 0 8px 0;
220
+ color: var(--rte-media-muted);
221
+ font-size: 14px;
222
+ }
223
+
224
+ .rte-media-hint {
225
+ margin: 0;
226
+ color: var(--rte-media-muted);
227
+ font-size: 12px;
228
+ }
229
+
230
+ .rte-media-progress {
231
+ margin-top: 16px;
232
+ }
233
+
234
+ .rte-media-progress-track {
235
+ height: 8px;
236
+ border-radius: 999px;
237
+ background: var(--rte-media-surface);
238
+ overflow: hidden;
239
+ border: 1px solid var(--rte-media-border);
240
+ }
241
+
242
+ .rte-media-progress-bar {
243
+ height: 100%;
244
+ width: 0;
245
+ background: var(--rte-media-accent);
246
+ transition: width 0.3s ease;
247
+ }
248
+
249
+ .rte-media-progress-text {
250
+ margin-top: 8px;
251
+ text-align: center;
252
+ color: var(--rte-media-muted);
253
+ font-size: 13px;
254
+ }
255
+
256
+ .rte-media-preview {
257
+ border: 1px solid var(--rte-media-border);
258
+ border-radius: 10px;
259
+ padding: 10px;
260
+ text-align: center;
261
+ background: var(--rte-media-surface);
262
+ }
263
+
264
+ .rte-media-preview img,
265
+ .rte-media-preview video {
266
+ max-width: 100%;
267
+ max-height: 240px;
268
+ }
269
+
270
+ .rte-media-helper {
271
+ margin-top: 8px;
272
+ margin-bottom: 0;
273
+ font-size: 12px;
274
+ color: var(--rte-media-muted);
275
+ line-height: 1.5;
276
+ }
277
+
278
+ .rte-media-footer {
279
+ display: flex;
280
+ justify-content: flex-end;
281
+ gap: 10px;
282
+ padding: 16px 20px;
283
+ border-top: 1px solid var(--rte-media-border);
284
+ background: var(--rte-media-surface);
285
+ }
286
+
287
+ .rte-media-footer.rte-media-footer-spread {
288
+ justify-content: space-between;
289
+ align-items: center;
290
+ }
291
+
292
+ .rte-media-btn {
293
+ border-radius: 8px;
294
+ border: 1px solid transparent;
295
+ padding: 10px 16px;
296
+ font-size: 14px;
297
+ font-weight: 600;
298
+ cursor: pointer;
299
+ transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
300
+ }
301
+
302
+ .rte-media-btn-secondary {
303
+ background: var(--rte-media-bg);
304
+ border-color: var(--rte-media-border);
305
+ color: var(--rte-media-text);
306
+ }
307
+
308
+ .rte-media-btn-secondary:hover {
309
+ background: var(--rte-media-surface-hover);
310
+ }
311
+
312
+ .rte-media-btn-primary {
313
+ background: var(--rte-media-accent);
314
+ color: #fff;
315
+ }
316
+
317
+ .rte-media-btn-primary:hover {
318
+ background: var(--rte-media-accent-hover);
319
+ }
320
+
321
+ .rte-media-btn-primary:disabled {
322
+ opacity: 0.55;
323
+ cursor: not-allowed;
324
+ }
325
+
326
+ .rte-media-btn-danger {
327
+ background: var(--rte-media-danger);
328
+ color: #fff;
329
+ }
330
+
331
+ .rte-media-btn-danger:hover {
332
+ background: var(--rte-media-danger-hover);
333
+ }
334
+
335
+ .rte-media-checkbox-label {
336
+ display: inline-flex;
337
+ align-items: center;
338
+ gap: 8px;
339
+ color: var(--rte-media-text);
340
+ font-size: 14px;
341
+ cursor: pointer;
342
+ }
343
+
344
+ .rte-media-checkbox-label input {
345
+ accent-color: var(--rte-media-accent);
346
+ }
347
+
348
+ .rte-media-actions {
349
+ display: flex;
350
+ gap: 10px;
351
+ }
352
+
353
+ .rte-media-spacer {
354
+ flex: 1;
355
+ }
356
+
357
+ .media-floating-toolbar {
358
+ --rte-media-toolbar-bg: #ffffff;
359
+ --rte-media-toolbar-border: #d6dbe4;
360
+ --rte-media-toolbar-text: #344054;
361
+ --rte-media-toolbar-hover-bg: #f3f6fb;
362
+ --rte-media-toolbar-hover-text: #101828;
363
+ --rte-media-toolbar-active-bg: #e6edf7;
364
+ --rte-media-toolbar-separator: #d9e1eb;
365
+ --rte-media-toolbar-danger-hover-bg: #fee2e2;
366
+ --rte-media-toolbar-danger-hover-text: #b42318;
367
+ position: absolute;
368
+ display: none;
369
+ align-items: center;
370
+ gap: 2px;
371
+ padding: 4px;
372
+ border: 1px solid var(--rte-media-toolbar-border);
373
+ border-radius: 8px;
374
+ background: var(--rte-media-toolbar-bg);
375
+ color: var(--rte-media-toolbar-text);
376
+ box-shadow: 0 10px 24px rgba(15, 23, 36, 0.18);
377
+ z-index: 10000;
378
+ pointer-events: auto;
379
+ backdrop-filter: blur(6px);
380
+ }
381
+
382
+ .media-floating-toolbar.rte-ui-theme-dark,
383
+ ${j} .media-floating-toolbar {
384
+ --rte-media-toolbar-bg: #24303f;
385
+ --rte-media-toolbar-border: #4a5a71;
386
+ --rte-media-toolbar-text: #d9e6fb;
387
+ --rte-media-toolbar-hover-bg: #33445a;
388
+ --rte-media-toolbar-hover-text: #f4f8ff;
389
+ --rte-media-toolbar-active-bg: #415875;
390
+ --rte-media-toolbar-separator: #566884;
391
+ --rte-media-toolbar-danger-hover-bg: #5f2a32;
392
+ --rte-media-toolbar-danger-hover-text: #ffd7d5;
393
+ box-shadow: 0 16px 30px rgba(2, 8, 20, 0.42);
394
+ }
395
+
396
+ .media-floating-toolbar-btn {
397
+ width: 30px;
398
+ height: 30px;
399
+ border: none;
400
+ border-radius: 6px;
401
+ background: transparent;
402
+ color: inherit;
403
+ display: inline-flex;
404
+ align-items: center;
405
+ justify-content: center;
406
+ cursor: pointer;
407
+ transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
408
+ }
409
+
410
+ .media-floating-toolbar-btn:hover {
411
+ background: var(--rte-media-toolbar-hover-bg);
412
+ color: var(--rte-media-toolbar-hover-text);
413
+ }
414
+
415
+ .media-floating-toolbar-btn:active {
416
+ background: var(--rte-media-toolbar-active-bg);
417
+ transform: scale(0.96);
418
+ }
419
+
420
+ .media-floating-toolbar-btn.btn-remove:hover {
421
+ background: var(--rte-media-toolbar-danger-hover-bg);
422
+ color: var(--rte-media-toolbar-danger-hover-text);
423
+ }
424
+
425
+ .media-floating-toolbar-separator {
426
+ width: 1px;
427
+ height: 20px;
428
+ margin: 0 2px;
429
+ background: var(--rte-media-toolbar-separator);
430
+ }
431
+ `, document.head.appendChild(t);
432
+ }, O = () => {
433
+ const t = window.getSelection();
434
+ if (!t || t.rangeCount === 0) return null;
435
+ const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
436
+ return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
437
+ }, X = (t) => {
438
+ if (t) return t;
439
+ const e = O();
440
+ if (e) return e;
441
+ if (A) return A;
442
+ const r = document.activeElement;
443
+ return r ? r.closest(".rte-content, .editora-content") || r : null;
444
+ }, W = (t) => {
445
+ const e = X(t);
446
+ return e ? !!e.closest(j) : !1;
447
+ }, H = (t) => {
448
+ G();
449
+ const e = document.createElement("div");
450
+ return e.className = "rte-media-overlay", W(t) && e.classList.add("rte-ui-theme-dark"), e;
451
+ }, I = (t = !1) => {
452
+ const e = document.createElement("div");
453
+ return e.className = t ? "rte-media-dialog rte-media-dialog-compact" : "rte-media-dialog", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e;
454
+ }, U = (t, e) => {
455
+ const r = window.getSelection();
456
+ r && r.rangeCount > 0 && (R = r.getRangeAt(0).cloneRange());
457
+ const o = H(e), a = I();
458
+ let n = "upload", s = "", b = "", p = "", g = "";
459
+ const f = () => {
460
+ a.innerHTML = `
461
+ <div class="rte-media-header">
462
+ <h2 class="rte-media-title">Insert ${t === "image" ? "Image" : "Video"}</h2>
463
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
464
+ </div>
465
+
466
+ <div class="rte-media-tabs">
467
+ <button class="tab-upload rte-media-tab ${n === "upload" ? "active" : ""}" type="button">Upload</button>
468
+ <button class="tab-url rte-media-tab ${n === "url" ? "active" : ""}" type="button">URL</button>
469
+ </div>
470
+
471
+ <div class="rte-media-body">
472
+ ${n === "upload" ? `
473
+ <div id="upload-section">
474
+ <div class="dropzone rte-media-dropzone">
475
+ <div class="rte-media-dropzone-icon">📁</div>
476
+ <p class="rte-media-dropzone-title">Drag and drop your ${t} here</p>
477
+ <p class="rte-media-muted">or click to browse</p>
478
+ <p class="rte-media-hint">Max file size: 50MB</p>
479
+ </div>
480
+ <input type="file" id="file-input" accept="${t === "image" ? "image/*" : "video/*"}" style="display: none;">
481
+ <div id="upload-progress" class="rte-media-progress" style="display: none;">
482
+ <div class="rte-media-progress-track">
483
+ <div id="progress-bar" class="rte-media-progress-bar"></div>
484
+ </div>
485
+ <p id="progress-text" class="rte-media-progress-text">Uploading...</p>
486
+ </div>
487
+ </div>
488
+ ` : `
489
+ <div id="url-section">
490
+ <div class="rte-media-field">
491
+ <label class="rte-media-label">URL</label>
492
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${s}">
493
+ </div>
494
+ ${t === "image" ? `
495
+ <div class="rte-media-field">
496
+ <label class="rte-media-label">Alt Text (for accessibility)</label>
497
+ <input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${g}">
498
+ </div>
499
+ ` : ""}
500
+ <div class="rte-media-grid">
501
+ <div class="rte-media-field">
502
+ <label class="rte-media-label">Width (px)</label>
503
+ <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${b}">
504
+ </div>
505
+ <div class="rte-media-field">
506
+ <label class="rte-media-label">Height (px)</label>
507
+ <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${p}">
508
+ </div>
509
+ </div>
510
+ ${s ? `
511
+ <div class="rte-media-field">
512
+ <label class="rte-media-label">Preview</label>
513
+ <div class="rte-media-preview">
514
+ ${t === "image" ? `<img src="${s}" alt="Preview">` : `<video src="${s}" controls></video>`}
515
+ </div>
516
+ </div>
517
+ ` : ""}
518
+ </div>
519
+ `}
520
+ </div>
521
+
522
+ <div class="rte-media-footer">
523
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
524
+ <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!s && n === "url" ? "disabled" : ""}>Insert</button>
525
+ </div>
526
+ `;
527
+ };
528
+ f(), o.appendChild(a), document.body.appendChild(o);
529
+ const y = () => {
530
+ o.parentNode && o.parentNode.removeChild(o);
531
+ }, k = () => {
532
+ if (!s) return;
533
+ const i = t === "image" ? document.createElement("img") : document.createElement("video");
534
+ i.src = s, i.setAttribute("data-media-type", t), t === "image" && g && (i.alt = g), b && (i.style.width = `${b}px`, i.setAttribute("width", b)), p && (i.style.height = `${p}px`, i.setAttribute("height", p)), t === "video" && (i.controls = !0), !b && !p ? i.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : i.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${b ? `width: ${b}px;` : "max-width: 100%;"} ${p ? `height: ${p}px;` : "height: auto;"}`, R && (R.deleteContents(), R.insertNode(i)), y();
535
+ }, h = async (i) => {
536
+ const u = a.querySelector("#upload-progress"), v = a.querySelector("#progress-bar"), E = a.querySelector("#progress-text");
537
+ if (u && v && E) {
538
+ u.style.display = "block";
539
+ let w = 0;
540
+ const m = setInterval(() => {
541
+ w += Math.random() * 30, w > 90 && (w = 90), v.style.width = `${w}%`;
542
+ }, 200);
543
+ try {
544
+ const x = new FileReader();
545
+ x.onload = () => {
546
+ clearInterval(m), v.style.width = "100%", E.textContent = "Upload complete", setTimeout(() => {
547
+ s = x.result, n = "url", f(), d();
548
+ }, 500);
549
+ }, x.readAsDataURL(i);
550
+ } catch (x) {
551
+ clearInterval(m), E.textContent = "Upload failed";
552
+ }
553
+ }
554
+ }, d = () => {
555
+ const i = a.querySelector(".close-btn"), u = a.querySelector(".cancel-btn"), v = a.querySelector("#insert-btn"), E = a.querySelector(".tab-upload"), w = a.querySelector(".tab-url");
556
+ if (i == null || i.addEventListener("click", y), u == null || u.addEventListener("click", y), v == null || v.addEventListener("click", k), E == null || E.addEventListener("click", () => {
557
+ n = "upload", f(), d();
558
+ }), w == null || w.addEventListener("click", () => {
559
+ n = "url", f(), d();
560
+ }), n === "upload") {
561
+ const m = a.querySelector(".dropzone"), x = a.querySelector("#file-input");
562
+ m == null || m.addEventListener("click", () => x == null ? void 0 : x.click()), m == null || m.addEventListener("dragover", (L) => {
563
+ L.preventDefault(), m.classList.add("is-dragover");
564
+ }), m == null || m.addEventListener("dragleave", () => {
565
+ m.classList.remove("is-dragover");
566
+ }), m == null || m.addEventListener("drop", (L) => {
567
+ var M;
568
+ L.preventDefault(), m.classList.remove("is-dragover");
569
+ const S = (M = L.dataTransfer) == null ? void 0 : M.files[0];
570
+ S && h(S);
571
+ }), x == null || x.addEventListener("change", (L) => {
572
+ var M;
573
+ const S = (M = L.target.files) == null ? void 0 : M[0];
574
+ S && h(S);
575
+ });
576
+ }
577
+ if (n === "url") {
578
+ const m = a.querySelector("#url-input"), x = a.querySelector("#alt-input"), L = a.querySelector("#width-input"), S = a.querySelector("#height-input");
579
+ m == null || m.addEventListener("input", () => {
580
+ s = m.value, f(), d();
581
+ }), x == null || x.addEventListener("input", () => {
582
+ g = x.value;
583
+ }), L == null || L.addEventListener("input", () => {
584
+ b = L.value;
585
+ }), S == null || S.addEventListener("input", () => {
586
+ p = S.value;
587
+ });
588
+ }
589
+ };
590
+ d(), o.addEventListener("click", (i) => {
591
+ i.target === o && y();
592
+ });
593
+ }, Y = () => {
594
+ ["nw", "ne", "sw", "se"].forEach((e) => {
595
+ const r = document.createElement("div");
596
+ r.className = `media-resize-handle-${e}`, r.style.cssText = `
597
+ position: fixed;
598
+ width: 10px;
599
+ height: 10px;
600
+ background: #007bff;
601
+ border: 2px solid white;
602
+ border-radius: 50%;
603
+ cursor: ${e}-resize;
604
+ z-index: 10001;
605
+ display: none;
606
+ box-shadow: 0 1px 3px rgba(0,0,0,0.3);
607
+ `, r.setAttribute("data-position", e), document.body.appendChild(r), _.push(r);
608
+ });
609
+ }, z = () => {
610
+ if (!c) {
611
+ _.forEach((r) => r.style.display = "none");
612
+ return;
613
+ }
614
+ const t = c.getBoundingClientRect(), e = {
615
+ nw: { x: t.left - 5, y: t.top - 5 },
616
+ ne: { x: t.right - 5, y: t.top - 5 },
617
+ sw: { x: t.left - 5, y: t.bottom - 5 },
618
+ se: { x: t.right - 5, y: t.bottom - 5 }
619
+ };
620
+ _.forEach((r) => {
621
+ const o = r.getAttribute("data-position"), a = e[o];
622
+ r.style.left = `${a.x}px`, r.style.top = `${a.y}px`, r.style.display = "block";
623
+ });
624
+ }, Z = (t) => {
625
+ const e = H(t), r = I(!0);
626
+ r.innerHTML = `
627
+ <div class="rte-media-header">
628
+ <h2 class="rte-media-title">Edit Alt Text</h2>
629
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
630
+ </div>
631
+ <div class="rte-media-body">
632
+ <label class="rte-media-label">Alternative Text (for accessibility)</label>
633
+ <textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${t.alt || ""}</textarea>
634
+ <p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
635
+ </div>
636
+ <div class="rte-media-footer">
637
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
638
+ <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
639
+ </div>
640
+ `, e.appendChild(r), document.body.appendChild(e);
641
+ const o = r.querySelector("#alt-text-input"), a = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), s = r.querySelector(".save-btn"), b = () => {
642
+ e.parentNode && e.parentNode.removeChild(e);
643
+ };
644
+ a.addEventListener("click", b), n.addEventListener("click", b), e.addEventListener("click", (p) => {
645
+ p.target === e && b();
646
+ }), s.addEventListener("click", () => {
647
+ t.alt = o.value, b();
648
+ }), o.focus(), o.select();
649
+ }, K = (t) => {
650
+ const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "", o = (e == null ? void 0 : e.getAttribute("target")) || "_self", a = (e == null ? void 0 : e.getAttribute("title")) || "", n = H(t), s = I(!0);
651
+ s.innerHTML = `
652
+ <div class="rte-media-header">
653
+ <h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
654
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
655
+ </div>
656
+ <div class="rte-media-body">
657
+ <div class="rte-media-field">
658
+ <label class="rte-media-label">URL</label>
659
+ <input id="link-url" type="url" class="rte-media-input" value="${r}" placeholder="https://example.com" />
660
+ </div>
661
+ <div class="rte-media-field">
662
+ <label class="rte-media-label">Title (tooltip)</label>
663
+ <input id="link-title" type="text" class="rte-media-input" value="${a}" placeholder="Optional tooltip text" />
664
+ </div>
665
+ <label class="rte-media-checkbox-label">
666
+ <input id="link-target" type="checkbox" ${o === "_blank" ? "checked" : ""} />
667
+ Open in new window/tab
668
+ </label>
669
+ </div>
670
+ <div class="rte-media-footer rte-media-footer-spread">
671
+ ${e ? '<button class="remove-link-btn rte-media-btn rte-media-btn-danger" type="button">Remove Link</button>' : '<span class="rte-media-spacer"></span>'}
672
+ <div class="rte-media-actions">
673
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
674
+ <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
675
+ </div>
676
+ </div>
677
+ `, n.appendChild(s), document.body.appendChild(n);
678
+ const b = s.querySelector("#link-url"), p = s.querySelector("#link-title"), g = s.querySelector("#link-target"), f = s.querySelector(".close-btn"), y = s.querySelector(".cancel-btn"), k = s.querySelector(".save-btn"), h = s.querySelector(".remove-link-btn"), d = () => {
679
+ n.parentNode && n.parentNode.removeChild(n);
680
+ };
681
+ f.addEventListener("click", d), y.addEventListener("click", d), n.addEventListener("click", (i) => {
682
+ i.target === n && d();
683
+ }), k.addEventListener("click", () => {
684
+ const i = b.value.trim();
685
+ if (i) {
686
+ const u = i.startsWith("http") ? i : `https://${i}`;
687
+ if (e)
688
+ e.setAttribute("href", u), e.setAttribute("target", g.checked ? "_blank" : "_self"), g.checked ? e.setAttribute("rel", "noopener noreferrer") : e.removeAttribute("rel"), p.value.trim() ? e.setAttribute("title", p.value.trim()) : e.removeAttribute("title");
689
+ else {
690
+ const v = document.createElement("a");
691
+ v.href = u, v.target = g.checked ? "_blank" : "_self", g.checked && (v.rel = "noopener noreferrer"), p.value.trim() && (v.title = p.value.trim()), t.replaceWith(v), v.appendChild(t);
692
+ }
693
+ d(), l && c && B(c);
694
+ }
695
+ }), h == null || h.addEventListener("click", () => {
696
+ e && confirm("Remove link from this media?") && (e.replaceWith(t), d(), l && c && B(c));
697
+ }), b.focus();
698
+ }, J = (t) => {
699
+ const e = H(t), r = I();
700
+ let o = "url", a = t.src;
701
+ const n = () => {
702
+ r.innerHTML = `
703
+ <div class="rte-media-header">
704
+ <h2 class="rte-media-title">Replace Image</h2>
705
+ <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
706
+ </div>
707
+
708
+ <div class="rte-media-tabs">
709
+ <button class="tab-upload rte-media-tab ${o === "upload" ? "active" : ""}" type="button">Upload</button>
710
+ <button class="tab-url rte-media-tab ${o === "url" ? "active" : ""}" type="button">URL</button>
711
+ </div>
712
+
713
+ <div class="rte-media-body">
714
+ ${o === "upload" ? `
715
+ <div id="upload-section">
716
+ <div class="dropzone rte-media-dropzone">
717
+ <div class="rte-media-dropzone-icon">📁</div>
718
+ <p class="rte-media-dropzone-title">Drag and drop your image here</p>
719
+ <p class="rte-media-muted">or click to browse</p>
720
+ </div>
721
+ <input type="file" id="file-input" accept="image/*" style="display: none;">
722
+ <div id="upload-progress" class="rte-media-progress" style="display: none;">
723
+ <div class="rte-media-progress-track">
724
+ <div id="progress-bar" class="rte-media-progress-bar"></div>
725
+ </div>
726
+ <p id="progress-text" class="rte-media-progress-text">Uploading...</p>
727
+ </div>
728
+ </div>
729
+ ` : `
730
+ <div id="url-section">
731
+ <div class="rte-media-field">
732
+ <label class="rte-media-label">Image URL</label>
733
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${a}">
734
+ </div>
735
+ ${a ? `
736
+ <div class="rte-media-field">
737
+ <label class="rte-media-label">Preview</label>
738
+ <div class="rte-media-preview">
739
+ <img src="${a}" alt="Preview" onerror="this.parentElement.innerHTML='<p class=&quot;rte-media-muted&quot;>Failed to load image</p>'">
740
+ </div>
741
+ </div>
742
+ ` : ""}
743
+ </div>
744
+ `}
745
+ </div>
746
+
747
+ <div class="rte-media-footer">
748
+ <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
749
+ <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!a && o === "url" ? "disabled" : ""}>Replace</button>
750
+ </div>
751
+ `;
752
+ };
753
+ n(), e.appendChild(r), document.body.appendChild(e);
754
+ const s = () => {
755
+ e.parentNode && e.parentNode.removeChild(e);
756
+ }, b = () => {
757
+ a && (t.src = a, s());
758
+ }, p = async (f) => {
759
+ const y = r.querySelector("#upload-progress"), k = r.querySelector("#progress-bar"), h = r.querySelector("#progress-text");
760
+ if (y && k && h) {
761
+ y.style.display = "block";
762
+ let d = 0;
763
+ const i = setInterval(() => {
764
+ d += Math.random() * 30, d > 90 && (d = 90), k.style.width = `${d}%`;
765
+ }, 200);
766
+ try {
767
+ const u = new FileReader();
768
+ u.onload = () => {
769
+ clearInterval(i), k.style.width = "100%", h.textContent = "Upload complete", setTimeout(() => {
770
+ a = u.result, o = "url", n(), g();
771
+ }, 500);
772
+ }, u.readAsDataURL(f);
773
+ } catch (u) {
774
+ clearInterval(i), h.textContent = "Upload failed";
775
+ }
776
+ }
777
+ }, g = () => {
778
+ const f = r.querySelector(".close-btn"), y = r.querySelector(".cancel-btn"), k = r.querySelector("#replace-btn"), h = r.querySelector(".tab-upload"), d = r.querySelector(".tab-url");
779
+ if (f == null || f.addEventListener("click", s), y == null || y.addEventListener("click", s), k == null || k.addEventListener("click", b), h == null || h.addEventListener("click", () => {
780
+ o = "upload", n(), g();
781
+ }), d == null || d.addEventListener("click", () => {
782
+ o = "url", n(), g();
783
+ }), o === "upload") {
784
+ const i = r.querySelector(".dropzone"), u = r.querySelector("#file-input");
785
+ i == null || i.addEventListener("click", () => u == null ? void 0 : u.click()), i == null || i.addEventListener("dragover", (v) => {
786
+ v.preventDefault(), i.classList.add("is-dragover");
787
+ }), i == null || i.addEventListener("dragleave", () => {
788
+ i.classList.remove("is-dragover");
789
+ }), i == null || i.addEventListener("drop", (v) => {
790
+ var w;
791
+ v.preventDefault(), i.classList.remove("is-dragover");
792
+ const E = (w = v.dataTransfer) == null ? void 0 : w.files[0];
793
+ E && p(E);
794
+ }), u == null || u.addEventListener("change", (v) => {
795
+ var w;
796
+ const E = (w = v.target.files) == null ? void 0 : w[0];
797
+ E && p(E);
798
+ });
799
+ }
800
+ if (o === "url") {
801
+ const i = r.querySelector("#url-input");
802
+ i == null || i.addEventListener("input", () => {
803
+ a = i.value, n(), g();
804
+ });
805
+ }
806
+ };
807
+ g(), e.addEventListener("click", (f) => {
808
+ f.target === e && s();
809
+ });
810
+ }, $ = () => {
811
+ if (!l || !c) return;
812
+ const t = l.offsetHeight || 40, e = c.offsetTop, r = c.offsetLeft, o = c.offsetWidth, a = e - t - 8, n = r + o / 2 - (l.offsetWidth || 120) / 2;
813
+ l.style.top = `${a}px`, l.style.left = `${n}px`, setTimeout(() => {
814
+ l && (l.style.display = "flex");
815
+ }, 100);
816
+ }, B = (t) => {
817
+ var s, b, p, g, f, y, k, h;
818
+ l && (l._cleanup && l._cleanup(), l.remove());
819
+ const e = t.parentElement;
820
+ if (e) {
821
+ const d = e.style.position;
822
+ (!d || d === "static") && (e.style.position = "relative", e._originalPosition = d), l = document.createElement("div"), l.className = "media-floating-toolbar", W(t) && l.classList.add("rte-ui-theme-dark"), e.insertBefore(l, e.firstChild), $();
823
+ }
824
+ const r = t.tagName === "IMG", o = t.closest("a");
825
+ l.innerHTML = `
826
+ <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
827
+ <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>
828
+ </button>
829
+ <button class="media-floating-toolbar-btn btn-align-center" title="Align Center" type="button">
830
+ <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>
831
+ </button>
832
+ <button class="media-floating-toolbar-btn btn-align-right" title="Align Right" type="button">
833
+ <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>
834
+ </button>
835
+ <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
836
+ ${r ? `
837
+ <button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
838
+ <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>
839
+ </button>` : ""}
840
+ <button class="media-floating-toolbar-btn btn-link" title="${o ? "Edit/Remove Link" : "Add Link"}" type="button">
841
+ <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>
842
+ </button>
843
+ ${r ? `
844
+ <button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
845
+ <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>
846
+ </button>` : ""}
847
+ <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
848
+ <button class="media-floating-toolbar-btn btn-remove" title="Remove" type="button">
849
+ <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>
850
+ </button>
851
+ `, setTimeout(() => {
852
+ $();
853
+ }, 0);
854
+ const a = () => $();
855
+ let n = c.parentElement;
856
+ for (; n; )
857
+ n.addEventListener("scroll", a), n = n.parentElement;
858
+ window.addEventListener("scroll", a), window.addEventListener("resize", a), l._cleanup = () => {
859
+ let d = c == null ? void 0 : c.parentElement;
860
+ for (; d; )
861
+ d.removeEventListener("scroll", a), d = d.parentElement;
862
+ window.removeEventListener("scroll", a), window.removeEventListener("resize", a);
863
+ }, (s = l.querySelector(".btn-align-left")) == null || s.addEventListener("click", () => {
864
+ t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto", $();
865
+ }), (b = l.querySelector(".btn-align-center")) == null || b.addEventListener("click", () => {
866
+ t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", $();
867
+ }), (p = l.querySelector(".btn-align-right")) == null || p.addEventListener("click", () => {
868
+ t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", $();
869
+ }), (g = l.querySelector(".btn-alt")) == null || g.addEventListener("click", () => {
870
+ t.tagName === "IMG" && Z(t);
871
+ }), (f = l.querySelector(".btn-link")) == null || f.addEventListener("click", () => {
872
+ K(t);
873
+ }), (y = l.querySelector(".btn-replace")) == null || y.addEventListener("click", () => {
874
+ t.tagName === "IMG" && J(t);
875
+ }), (k = l.querySelector(".btn-resize")) == null || k.addEventListener("click", () => {
876
+ const d = prompt("Enter width in pixels:", String(t.width || t.offsetWidth));
877
+ if (d && !isNaN(parseInt(d))) {
878
+ const i = parseInt(d);
879
+ t.style.width = `${i}px`, t.setAttribute("width", String(i)), z(), $();
880
+ }
881
+ }), (h = l.querySelector(".btn-remove")) == null || h.addEventListener("click", () => {
882
+ confirm("Remove this media?") && (t.remove(), l && (l._cleanup && l._cleanup(), l.remove(), l = null), c = null, z());
883
+ }), l._cleanup = () => {
884
+ window.removeEventListener("scroll", $), window.removeEventListener("resize", $);
885
+ };
886
+ }, F = (t) => {
887
+ A = t || null, Y(), document.addEventListener("click", (e) => {
888
+ const r = e.target;
889
+ if (r.tagName === "IMG" || r.tagName === "VIDEO") {
890
+ const o = r;
891
+ let a = !1;
892
+ if (A ? a = A.contains(o) : a = !!o.closest('[contenteditable="true"]'), a) {
893
+ e.preventDefault(), e.stopPropagation(), c = o, c.style.display = "block", B(o), z();
894
+ return;
895
+ }
896
+ }
897
+ if (!r.closest(".btn-link, .btn-resize, .btn-remove") && l && !r.closest("button")) {
898
+ if (l._cleanup && l._cleanup(), l.remove(), l = null, c && c.parentElement) {
899
+ const o = c.parentElement;
900
+ o._originalPosition !== void 0 && (o.style.position = o._originalPosition, delete o._originalPosition);
901
+ }
902
+ c = null, z();
903
+ }
904
+ }), _.forEach((e) => {
905
+ e.addEventListener("mousedown", (r) => {
906
+ if (!c) return;
907
+ r.preventDefault(), r.stopPropagation(), D = !0, T = e.getAttribute("data-position"), V = r.clientX, P = r.clientY;
908
+ const o = c.getBoundingClientRect();
909
+ q = o.width, C = o.height, N = q / C, document.body.style.userSelect = "none", document.body.style.cursor = `${T}-resize`;
910
+ });
911
+ }), document.addEventListener("mousemove", (e) => {
912
+ if (!D || !c || !T) return;
913
+ const r = e.clientX - V, o = e.clientY - P;
914
+ let a = q, n = C;
915
+ switch (T) {
916
+ case "se":
917
+ a = q + r, n = C + o;
918
+ break;
919
+ case "sw":
920
+ a = q - r, n = C + o;
921
+ break;
922
+ case "ne":
923
+ a = q + r, n = C - o;
924
+ break;
925
+ case "nw":
926
+ a = q - r, n = C - o;
927
+ break;
928
+ }
929
+ Math.abs(r) > Math.abs(o) ? n = a / N : a = n * N, a = Math.max(50, a), n = Math.max(50, n), c.style.width = `${a}px`, c.style.height = `${n}px`, c.setAttribute("width", String(Math.round(a))), c.setAttribute("height", String(Math.round(n))), z(), $();
930
+ }), document.addEventListener("mouseup", () => {
931
+ D && (D = !1, T = null, document.body.style.userSelect = "", document.body.style.cursor = "");
932
+ }), window.addEventListener("scroll", z), window.addEventListener("resize", z);
933
+ };
934
+ typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, F());
935
+ const Q = () => ({
936
+ name: "image",
937
+ initialize: (t) => {
938
+ const e = t == null ? void 0 : t.editorElement;
939
+ F(e);
940
+ },
941
+ toolbar: [
942
+ {
943
+ label: "Image",
944
+ command: "insertImage",
945
+ 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>'
946
+ },
947
+ {
948
+ label: "Video",
949
+ command: "insertVideo",
950
+ 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>'
951
+ }
952
+ ],
953
+ commands: {
954
+ insertImage: (t, e) => {
955
+ const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
956
+ return U("image", r), !0;
957
+ },
958
+ insertVideo: (t, e) => {
959
+ const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
960
+ return U("video", r), !0;
961
+ }
962
+ },
963
+ keymap: {
964
+ "Mod-Shift-i": "insertImage"
965
+ }
966
+ });
967
+ export {
968
+ Q as MediaManagerPlugin
969
+ };
970
+ //# sourceMappingURL=MediaManagerPlugin.native-CgP5iInD.mjs.map