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