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