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