@editora/core 1.0.25 → 1.0.27
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-CRpX2G93.mjs → CodePlugin.native-DNJmRGdT.mjs} +106 -92
- package/dist/{CodePlugin.native-CPfKDrkr.mjs → CodePlugin.native-DhLs8BoM.mjs} +43 -29
- package/dist/CommentsPlugin.native-CxdTwTGE.mjs +2101 -0
- package/dist/{TablePlugin.native-CWxEFpV8.mjs → TablePlugin.native-1TvjRqv1.mjs} +59 -58
- package/dist/core.css +1 -1
- package/dist/plugin-loader.js +2 -2
- package/dist/webcomponent-core.js +1 -1
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +19 -20
- package/dist/webcomponent.js +3 -3
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1612 -1140
- package/package.json +12 -30
- package/dist/CommentsPlugin.native-DHCDUm9f.mjs +0 -809
|
@@ -0,0 +1,2101 @@
|
|
|
1
|
+
import { k as tt, f as nt, p as rt } from "./dialogHelpers-Dzn8DHoF.mjs";
|
|
2
|
+
import { r as ot } from "./historyHelpers-B0-4mq1E.mjs";
|
|
3
|
+
const W = 60, Y = 60 * W, F = 24 * Y;
|
|
4
|
+
function ae(e, t = Date.now(), n) {
|
|
5
|
+
const r = new Date(e).getTime();
|
|
6
|
+
if (Number.isNaN(r)) return "";
|
|
7
|
+
const o = Math.round((r - t) / 1e3), i = Math.abs(o);
|
|
8
|
+
let a = null;
|
|
9
|
+
try {
|
|
10
|
+
a = new Intl.RelativeTimeFormat(n, { numeric: "auto", style: "short" });
|
|
11
|
+
} catch (d) {
|
|
12
|
+
a = null;
|
|
13
|
+
}
|
|
14
|
+
if (i < W) return a ? a.format(0, "second") : "now";
|
|
15
|
+
if (i < Y) return a ? a.format(Math.round(o / W), "minute") : `${Math.round(i / W)}m ago`;
|
|
16
|
+
if (i < F) return a ? a.format(Math.round(o / Y), "hour") : `${Math.round(i / Y)}h ago`;
|
|
17
|
+
if (i < 7 * F) return a ? a.format(Math.round(o / F), "day") : `${Math.round(i / F)}d ago`;
|
|
18
|
+
const s = new Date(r), l = s.getFullYear() === new Date(t).getFullYear();
|
|
19
|
+
return s.toLocaleDateString(n, {
|
|
20
|
+
month: "short",
|
|
21
|
+
day: "numeric",
|
|
22
|
+
year: l ? void 0 : "numeric"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function De(e, t) {
|
|
26
|
+
const n = new Date(e);
|
|
27
|
+
return Number.isNaN(n.getTime()) ? "" : n.toLocaleString(t, { dateStyle: "medium", timeStyle: "short" });
|
|
28
|
+
}
|
|
29
|
+
function it(e) {
|
|
30
|
+
var o, i;
|
|
31
|
+
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
32
|
+
if (t.length === 0) return "?";
|
|
33
|
+
const n = (o = Array.from(t[0])[0]) != null ? o : "", r = t.length > 1 && (i = Array.from(t[t.length - 1])[0]) != null ? i : "";
|
|
34
|
+
return (n + r).toUpperCase() || "?";
|
|
35
|
+
}
|
|
36
|
+
const be = [
|
|
37
|
+
"hsl(215 55% 36%)",
|
|
38
|
+
"hsl(262 45% 45%)",
|
|
39
|
+
"hsl(330 52% 40%)",
|
|
40
|
+
"hsl(8 58% 40%)",
|
|
41
|
+
"hsl(28 70% 32%)",
|
|
42
|
+
"hsl(150 55% 28%)",
|
|
43
|
+
"hsl(180 60% 27%)",
|
|
44
|
+
"hsl(240 40% 48%)"
|
|
45
|
+
];
|
|
46
|
+
function at(e) {
|
|
47
|
+
let t = 0;
|
|
48
|
+
for (let n = 0; n < e.length; n += 1)
|
|
49
|
+
t = t * 31 + e.charCodeAt(n) >>> 0;
|
|
50
|
+
return be[t % be.length];
|
|
51
|
+
}
|
|
52
|
+
const xe = "rte-comments-panel-styles", lt = `
|
|
53
|
+
.rte-comments-panel,
|
|
54
|
+
.rte-comments-panel * {
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rte-comments-panel {
|
|
59
|
+
--rte-comments-panel-width: min(340px, 42vw);
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0;
|
|
62
|
+
right: 0;
|
|
63
|
+
bottom: 0;
|
|
64
|
+
width: var(--rte-comments-panel-width);
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
68
|
+
color: var(--rte-color-text-primary, #111827);
|
|
69
|
+
border-left: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
70
|
+
box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
|
|
71
|
+
font-size: 13px;
|
|
72
|
+
line-height: 1.45;
|
|
73
|
+
transform: translateX(100%);
|
|
74
|
+
opacity: 0;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
transition: transform 180ms ease, opacity 180ms ease;
|
|
77
|
+
/* Above the editor's sticky toolbar (z-index 100): on a narrow screen the panel lies over the editor, and
|
|
78
|
+
under the toolbar its header, and the button that closes it, could not be clicked. */
|
|
79
|
+
z-index: 110;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rte-comments-panel.is-open {
|
|
83
|
+
transform: translateX(0);
|
|
84
|
+
opacity: 1;
|
|
85
|
+
pointer-events: auto;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* The panel's width is set on the editor itself, not only on the panel: the toolbar and the text make room for the
|
|
89
|
+
panel with a margin of that width, and a variable set on the panel is not visible to them (the margin was
|
|
90
|
+
silently 0, so the panel lay over the toolbar and the text and its header could not be reached). */
|
|
91
|
+
[data-rte-comments-open="true"] {
|
|
92
|
+
--rte-comments-panel-width: min(340px, 42vw);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* The toolbar's wrapper is the element that is as wide as the editor, and it sits above the panel (it is sticky,
|
|
96
|
+
z-index 100): it has to give up the panel's width too, or its empty right-hand end covers the panel's header. */
|
|
97
|
+
[data-rte-comments-open="true"] :is(.rte-toolbar-wrapper, .rte-toolbar:not(.rte-toolbar-wrapper .rte-toolbar), .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
98
|
+
margin-right: var(--rte-comments-panel-width);
|
|
99
|
+
transition: margin-right 180ms ease;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.rte-comments-panel :is(button, textarea, [role="tab"]):focus-visible {
|
|
103
|
+
outline: 2px solid var(--rte-color-border-focus, #2563eb);
|
|
104
|
+
outline-offset: 1px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* ---- Header and tabs ---- */
|
|
108
|
+
|
|
109
|
+
.rte-comments-header {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
gap: 8px;
|
|
114
|
+
padding: 12px 12px 8px 16px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.rte-comments-title {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 8px;
|
|
121
|
+
min-width: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.rte-comments-title h3 {
|
|
125
|
+
margin: 0;
|
|
126
|
+
font-size: 15px;
|
|
127
|
+
font-weight: 600;
|
|
128
|
+
line-height: 1.3;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.rte-comments-count {
|
|
132
|
+
min-width: 20px;
|
|
133
|
+
padding: 0 6px;
|
|
134
|
+
border-radius: 999px;
|
|
135
|
+
background: var(--rte-color-bg-tertiary, #e2e8f0);
|
|
136
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
137
|
+
font-size: 11px;
|
|
138
|
+
font-weight: 600;
|
|
139
|
+
line-height: 20px;
|
|
140
|
+
text-align: center;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.rte-comments-header-actions {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 4px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.rte-comments-tabs {
|
|
150
|
+
display: flex;
|
|
151
|
+
gap: 2px;
|
|
152
|
+
margin: 0 16px;
|
|
153
|
+
padding: 2px;
|
|
154
|
+
border-radius: 8px;
|
|
155
|
+
background: var(--rte-color-bg-tertiary, #eef2f6);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.rte-comments-tab {
|
|
159
|
+
flex: 1;
|
|
160
|
+
border: 0;
|
|
161
|
+
border-radius: 6px;
|
|
162
|
+
padding: 5px 8px;
|
|
163
|
+
background: transparent;
|
|
164
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
165
|
+
font: inherit;
|
|
166
|
+
font-size: 12px;
|
|
167
|
+
font-weight: 500;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.rte-comments-tab:hover {
|
|
172
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.rte-comments-tab[aria-selected="true"] {
|
|
176
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
177
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
178
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.rte-comments-tab-count {
|
|
182
|
+
margin-left: 4px;
|
|
183
|
+
font-weight: 400;
|
|
184
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.rte-comments-body {
|
|
188
|
+
flex: 1;
|
|
189
|
+
min-height: 0;
|
|
190
|
+
overflow-y: auto;
|
|
191
|
+
padding: 12px 12px 16px;
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
gap: 10px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* ---- Buttons ---- */
|
|
198
|
+
|
|
199
|
+
.rte-comment-icon-btn,
|
|
200
|
+
.rte-comments-new,
|
|
201
|
+
.rte-comments-close {
|
|
202
|
+
display: inline-flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
gap: 6px;
|
|
206
|
+
border: 0;
|
|
207
|
+
border-radius: 6px;
|
|
208
|
+
background: transparent;
|
|
209
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
210
|
+
font: inherit;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.rte-comment-icon-btn,
|
|
215
|
+
.rte-comments-close {
|
|
216
|
+
width: 28px;
|
|
217
|
+
height: 28px;
|
|
218
|
+
padding: 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.rte-comments-new {
|
|
222
|
+
height: 28px;
|
|
223
|
+
padding: 0 10px 0 8px;
|
|
224
|
+
font-size: 12px;
|
|
225
|
+
font-weight: 500;
|
|
226
|
+
color: var(--rte-color-primary, #2563eb);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.rte-comment-icon-btn:hover,
|
|
230
|
+
.rte-comments-new:hover,
|
|
231
|
+
.rte-comments-close:hover {
|
|
232
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
233
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* Not the grey hover of the other buttons: the primary colour on that grey is below 4.5:1 in the dark theme. */
|
|
237
|
+
.rte-comments-new:hover {
|
|
238
|
+
background: color-mix(in srgb, var(--rte-color-primary, #2563eb) 12%, transparent);
|
|
239
|
+
color: var(--rte-color-primary, #2563eb);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.rte-comment-icon-btn[data-action="resolve"]:hover {
|
|
243
|
+
background: color-mix(in srgb, var(--rte-color-success, #15803d) 14%, transparent);
|
|
244
|
+
color: var(--rte-color-success, #15803d);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.rte-comment-icon-btn svg,
|
|
248
|
+
.rte-comments-new svg,
|
|
249
|
+
.rte-comments-close svg {
|
|
250
|
+
width: 16px;
|
|
251
|
+
height: 16px;
|
|
252
|
+
flex: none;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.rte-comment-btn {
|
|
256
|
+
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
257
|
+
border-radius: 7px;
|
|
258
|
+
padding: 5px 12px;
|
|
259
|
+
font: inherit;
|
|
260
|
+
font-size: 12px;
|
|
261
|
+
font-weight: 500;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
264
|
+
color: var(--rte-color-text-secondary, #334155);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.rte-comment-btn:hover {
|
|
268
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
269
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.rte-comment-btn.ghost {
|
|
273
|
+
border-color: transparent;
|
|
274
|
+
background: transparent;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.rte-comment-btn.primary {
|
|
278
|
+
border-color: var(--rte-color-primary, #2563eb);
|
|
279
|
+
background: var(--rte-color-primary, #2563eb);
|
|
280
|
+
color: var(--rte-color-text-inverse, #ffffff);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.rte-comment-btn.primary:hover {
|
|
284
|
+
background: var(--rte-color-primary-hover, #1d4ed8);
|
|
285
|
+
border-color: var(--rte-color-primary-hover, #1d4ed8);
|
|
286
|
+
color: var(--rte-color-text-inverse, #ffffff);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.rte-comment-btn:disabled,
|
|
290
|
+
.rte-comment-btn.primary:disabled {
|
|
291
|
+
border-color: var(--rte-color-border-light, #e2e8f0);
|
|
292
|
+
background: var(--rte-color-bg-tertiary, #e2e8f0);
|
|
293
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
294
|
+
cursor: not-allowed;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* ---- Cards (a thread, and the form for a new comment) ---- */
|
|
298
|
+
|
|
299
|
+
.rte-comment-item,
|
|
300
|
+
.rte-comment-composer {
|
|
301
|
+
border: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
302
|
+
border-radius: 10px;
|
|
303
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
304
|
+
padding: 12px;
|
|
305
|
+
transition: border-color 120ms ease, box-shadow 120ms ease;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.rte-comment-item:hover {
|
|
309
|
+
border-color: var(--rte-color-border, #cbd5e1);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.rte-comment-item.is-active,
|
|
313
|
+
.rte-comment-composer {
|
|
314
|
+
border-color: var(--rte-color-primary, #2563eb);
|
|
315
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--rte-color-primary, #2563eb) 14%, transparent);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.rte-comment-item.resolved .rte-comment-text,
|
|
319
|
+
.rte-comment-item.resolved .rte-comment-selection {
|
|
320
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.rte-comment-header,
|
|
324
|
+
.rte-comment-reply-header {
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
gap: 8px;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.rte-comment-avatar {
|
|
331
|
+
flex: none;
|
|
332
|
+
width: 28px;
|
|
333
|
+
height: 28px;
|
|
334
|
+
border-radius: 50%;
|
|
335
|
+
color: #ffffff;
|
|
336
|
+
font-size: 11px;
|
|
337
|
+
font-weight: 600;
|
|
338
|
+
line-height: 28px;
|
|
339
|
+
text-align: center;
|
|
340
|
+
user-select: none;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.rte-comment-avatar {
|
|
344
|
+
position: relative;
|
|
345
|
+
overflow: hidden;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* The picture covers the initials; if it fails to load it is removed and the initials show. */
|
|
349
|
+
.rte-comment-avatar img {
|
|
350
|
+
position: absolute;
|
|
351
|
+
inset: 0;
|
|
352
|
+
width: 100%;
|
|
353
|
+
height: 100%;
|
|
354
|
+
object-fit: cover;
|
|
355
|
+
border-radius: 50%;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.rte-comment-avatar.small {
|
|
359
|
+
width: 22px;
|
|
360
|
+
height: 22px;
|
|
361
|
+
font-size: 9px;
|
|
362
|
+
line-height: 22px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.rte-comment-meta {
|
|
366
|
+
flex: 1;
|
|
367
|
+
min-width: 0;
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-direction: column;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.rte-comment-author {
|
|
373
|
+
overflow: hidden;
|
|
374
|
+
text-overflow: ellipsis;
|
|
375
|
+
white-space: nowrap;
|
|
376
|
+
font-size: 13px;
|
|
377
|
+
font-weight: 600;
|
|
378
|
+
line-height: 1.3;
|
|
379
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.rte-comment-when {
|
|
383
|
+
display: flex;
|
|
384
|
+
align-items: baseline;
|
|
385
|
+
gap: 4px;
|
|
386
|
+
font-size: 11px;
|
|
387
|
+
line-height: 1.3;
|
|
388
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.rte-comment-date {
|
|
392
|
+
font-size: 11px;
|
|
393
|
+
line-height: 1.3;
|
|
394
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.rte-comment-header-actions {
|
|
398
|
+
display: flex;
|
|
399
|
+
align-items: center;
|
|
400
|
+
gap: 2px;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.rte-comment-more {
|
|
404
|
+
position: relative;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.rte-comment-menu {
|
|
408
|
+
position: absolute;
|
|
409
|
+
top: calc(100% + 4px);
|
|
410
|
+
right: 0;
|
|
411
|
+
z-index: 2;
|
|
412
|
+
min-width: 140px;
|
|
413
|
+
padding: 4px;
|
|
414
|
+
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
415
|
+
border-radius: 8px;
|
|
416
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
417
|
+
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.rte-comment-menu[hidden] {
|
|
421
|
+
display: none;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.rte-comment-menu-item {
|
|
425
|
+
display: flex;
|
|
426
|
+
align-items: center;
|
|
427
|
+
gap: 8px;
|
|
428
|
+
width: 100%;
|
|
429
|
+
border: 0;
|
|
430
|
+
border-radius: 6px;
|
|
431
|
+
padding: 6px 8px;
|
|
432
|
+
background: transparent;
|
|
433
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
434
|
+
font: inherit;
|
|
435
|
+
font-size: 13px;
|
|
436
|
+
text-align: left;
|
|
437
|
+
cursor: pointer;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.rte-comment-menu-item svg {
|
|
441
|
+
width: 15px;
|
|
442
|
+
height: 15px;
|
|
443
|
+
flex: none;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.rte-comment-menu-item:hover,
|
|
447
|
+
.rte-comment-menu-item:focus-visible {
|
|
448
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.rte-comment-menu-item.danger {
|
|
452
|
+
color: var(--rte-color-danger, #b91c1c);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.rte-comment-menu-item.danger:hover,
|
|
456
|
+
.rte-comment-menu-item.danger:focus-visible {
|
|
457
|
+
background: color-mix(in srgb, var(--rte-color-danger, #b91c1c) 10%, transparent);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/* What the comment is about: one line of the quoted text. */
|
|
461
|
+
.rte-comment-selection {
|
|
462
|
+
display: block;
|
|
463
|
+
width: 100%;
|
|
464
|
+
margin: 10px 0 0;
|
|
465
|
+
padding: 4px 8px;
|
|
466
|
+
border: 0;
|
|
467
|
+
border-left: 3px solid var(--rte-color-warning, #d97706);
|
|
468
|
+
border-radius: 0 4px 4px 0;
|
|
469
|
+
background: var(--rte-color-bg-secondary, #f8fafc);
|
|
470
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
471
|
+
font: inherit;
|
|
472
|
+
font-size: 12px;
|
|
473
|
+
text-align: left;
|
|
474
|
+
overflow: hidden;
|
|
475
|
+
text-overflow: ellipsis;
|
|
476
|
+
white-space: nowrap;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
button.rte-comment-selection {
|
|
480
|
+
cursor: pointer;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
button.rte-comment-selection:hover {
|
|
484
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.rte-comment-text {
|
|
488
|
+
margin-top: 10px;
|
|
489
|
+
font-size: 13px;
|
|
490
|
+
line-height: 1.5;
|
|
491
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
492
|
+
white-space: pre-wrap;
|
|
493
|
+
overflow-wrap: anywhere;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.rte-comment-status {
|
|
497
|
+
display: flex;
|
|
498
|
+
align-items: center;
|
|
499
|
+
gap: 4px;
|
|
500
|
+
margin-top: 8px;
|
|
501
|
+
font-size: 11px;
|
|
502
|
+
color: var(--rte-color-success, #15803d);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.rte-comment-status svg {
|
|
506
|
+
width: 12px;
|
|
507
|
+
height: 12px;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/* ---- Replies ---- */
|
|
511
|
+
|
|
512
|
+
.rte-comment-replies {
|
|
513
|
+
display: flex;
|
|
514
|
+
flex-direction: column;
|
|
515
|
+
gap: 12px;
|
|
516
|
+
margin-top: 12px;
|
|
517
|
+
padding-top: 12px;
|
|
518
|
+
border-top: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.rte-comment-reply-header .rte-comment-icon-btn {
|
|
522
|
+
width: 24px;
|
|
523
|
+
height: 24px;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.rte-comment-reply-header .rte-comment-icon-btn svg {
|
|
527
|
+
width: 14px;
|
|
528
|
+
height: 14px;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.rte-comment-reply-text {
|
|
532
|
+
margin: 4px 0 0 30px;
|
|
533
|
+
font-size: 13px;
|
|
534
|
+
line-height: 1.5;
|
|
535
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
536
|
+
white-space: pre-wrap;
|
|
537
|
+
overflow-wrap: anywhere;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.rte-comment-more-replies {
|
|
541
|
+
align-self: flex-start;
|
|
542
|
+
border: 0;
|
|
543
|
+
padding: 0;
|
|
544
|
+
background: transparent;
|
|
545
|
+
color: var(--rte-color-primary, #2563eb);
|
|
546
|
+
font: inherit;
|
|
547
|
+
font-size: 12px;
|
|
548
|
+
font-weight: 500;
|
|
549
|
+
cursor: pointer;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.rte-comment-more-replies:hover {
|
|
553
|
+
text-decoration: underline;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/* ---- Reply box: one line until it is used ---- */
|
|
557
|
+
|
|
558
|
+
.rte-comment-reply-box {
|
|
559
|
+
margin-top: 12px;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.rte-comment-reply .rte-comment-edit {
|
|
563
|
+
margin: 6px 0 0 30px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.rte-comment-edit {
|
|
567
|
+
margin-top: 10px;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.new-comment-textarea,
|
|
571
|
+
.rte-comment-reply-textarea,
|
|
572
|
+
.rte-comment-edit-textarea {
|
|
573
|
+
display: block;
|
|
574
|
+
width: 100%;
|
|
575
|
+
resize: none;
|
|
576
|
+
min-height: 34px;
|
|
577
|
+
max-height: 160px;
|
|
578
|
+
font: inherit;
|
|
579
|
+
font-size: 13px;
|
|
580
|
+
line-height: 1.45;
|
|
581
|
+
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
582
|
+
border-radius: 8px;
|
|
583
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
584
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
585
|
+
padding: 7px 10px;
|
|
586
|
+
outline: none;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.new-comment-textarea {
|
|
590
|
+
min-height: 64px;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.new-comment-textarea::placeholder,
|
|
594
|
+
.rte-comment-reply-textarea::placeholder,
|
|
595
|
+
.rte-comment-edit-textarea::placeholder {
|
|
596
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.new-comment-textarea:focus,
|
|
600
|
+
.rte-comment-reply-textarea:focus,
|
|
601
|
+
.rte-comment-edit-textarea:focus {
|
|
602
|
+
border-color: var(--rte-color-border-focus, #2563eb);
|
|
603
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--rte-color-border-focus, #2563eb) 20%, transparent);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.rte-comment-form-actions {
|
|
607
|
+
display: flex;
|
|
608
|
+
justify-content: flex-end;
|
|
609
|
+
gap: 6px;
|
|
610
|
+
margin-top: 8px;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.rte-comment-reply-box:not(:focus-within):not(.has-text) .rte-comment-form-actions {
|
|
614
|
+
display: none;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/* ---- New comment ---- */
|
|
618
|
+
|
|
619
|
+
.rte-comment-composer .rte-comment-selection {
|
|
620
|
+
margin: 0 0 10px;
|
|
621
|
+
display: flex;
|
|
622
|
+
align-items: center;
|
|
623
|
+
gap: 6px;
|
|
624
|
+
padding-right: 4px;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.rte-comment-composer .rte-comment-selection span {
|
|
628
|
+
flex: 1;
|
|
629
|
+
min-width: 0;
|
|
630
|
+
overflow: hidden;
|
|
631
|
+
text-overflow: ellipsis;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.rte-comment-composer .rte-comment-selection .rte-comment-icon-btn {
|
|
635
|
+
width: 22px;
|
|
636
|
+
height: 22px;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.rte-comment-composer-hint {
|
|
640
|
+
margin: 0 0 8px;
|
|
641
|
+
font-size: 12px;
|
|
642
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.rte-comment-error {
|
|
646
|
+
margin: 8px 0 0;
|
|
647
|
+
font-size: 12px;
|
|
648
|
+
color: var(--rte-color-danger, #b91c1c);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/* ---- Empty state ---- */
|
|
652
|
+
|
|
653
|
+
.rte-comments-empty {
|
|
654
|
+
display: flex;
|
|
655
|
+
flex-direction: column;
|
|
656
|
+
align-items: center;
|
|
657
|
+
gap: 6px;
|
|
658
|
+
padding: 36px 16px;
|
|
659
|
+
text-align: center;
|
|
660
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.rte-comments-empty svg {
|
|
664
|
+
width: 32px;
|
|
665
|
+
height: 32px;
|
|
666
|
+
margin-bottom: 4px;
|
|
667
|
+
opacity: 0.6;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
.rte-comments-empty strong {
|
|
671
|
+
font-size: 14px;
|
|
672
|
+
font-weight: 600;
|
|
673
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.rte-comments-empty p {
|
|
677
|
+
margin: 0;
|
|
678
|
+
max-width: 240px;
|
|
679
|
+
font-size: 12px;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/* ---- "Comment deleted - Undo" ---- */
|
|
683
|
+
|
|
684
|
+
.rte-comments-toast {
|
|
685
|
+
position: absolute;
|
|
686
|
+
left: 12px;
|
|
687
|
+
right: 12px;
|
|
688
|
+
bottom: 12px;
|
|
689
|
+
display: flex;
|
|
690
|
+
align-items: center;
|
|
691
|
+
justify-content: space-between;
|
|
692
|
+
gap: 12px;
|
|
693
|
+
padding: 9px 12px;
|
|
694
|
+
border-radius: 8px;
|
|
695
|
+
background: #1f2937;
|
|
696
|
+
color: #ffffff;
|
|
697
|
+
font-size: 13px;
|
|
698
|
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.rte-comments-toast[hidden] {
|
|
702
|
+
display: none;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.rte-comments-toast-action {
|
|
706
|
+
flex: none;
|
|
707
|
+
border: 0;
|
|
708
|
+
border-radius: 4px;
|
|
709
|
+
padding: 2px 6px;
|
|
710
|
+
background: transparent;
|
|
711
|
+
color: #93c5fd;
|
|
712
|
+
font: inherit;
|
|
713
|
+
font-weight: 600;
|
|
714
|
+
cursor: pointer;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.rte-comments-toast-action:hover {
|
|
718
|
+
text-decoration: underline;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/* ---- The button that appears over selected text ---- */
|
|
722
|
+
|
|
723
|
+
.rte-comments-bubble {
|
|
724
|
+
position: fixed;
|
|
725
|
+
z-index: 1000;
|
|
726
|
+
display: inline-flex;
|
|
727
|
+
align-items: center;
|
|
728
|
+
gap: 6px;
|
|
729
|
+
height: 32px;
|
|
730
|
+
padding: 0 12px 0 10px;
|
|
731
|
+
border: 0;
|
|
732
|
+
border-radius: 999px;
|
|
733
|
+
background: #1f2937;
|
|
734
|
+
color: #ffffff;
|
|
735
|
+
/* It lives on the page, outside the editor, so it must bring its own font: inheriting would show the host page's. */
|
|
736
|
+
font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
|
|
737
|
+
font-size: 13px;
|
|
738
|
+
font-weight: 500;
|
|
739
|
+
line-height: 1;
|
|
740
|
+
cursor: pointer;
|
|
741
|
+
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.rte-comments-bubble[hidden] {
|
|
745
|
+
display: none;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
.rte-comments-bubble:hover {
|
|
749
|
+
background: #111827;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
.rte-comments-bubble:focus-visible {
|
|
753
|
+
outline: 2px solid #93c5fd;
|
|
754
|
+
outline-offset: 2px;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.rte-comments-bubble svg {
|
|
758
|
+
width: 16px;
|
|
759
|
+
height: 16px;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/* ---- The highlighted text in the document ---- */
|
|
763
|
+
|
|
764
|
+
.rte-comment-anchor {
|
|
765
|
+
background: rgba(250, 204, 21, 0.34);
|
|
766
|
+
border-bottom: 2px solid rgba(217, 119, 6, 0.75);
|
|
767
|
+
border-radius: 2px;
|
|
768
|
+
cursor: pointer;
|
|
769
|
+
transition: outline-color 120ms ease, box-shadow 120ms ease;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.rte-comment-anchor.rte-comment-anchor-resolved {
|
|
773
|
+
background: rgba(148, 163, 184, 0.2);
|
|
774
|
+
border-bottom-color: rgba(100, 116, 139, 0.6);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-comments-panel {
|
|
778
|
+
box-shadow: -10px 0 28px rgba(0, 0, 0, 0.4);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
@media (max-width: 900px) {
|
|
782
|
+
[data-rte-comments-open="true"],
|
|
783
|
+
.rte-comments-panel {
|
|
784
|
+
--rte-comments-panel-width: min(420px, 100%);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
.rte-comments-panel {
|
|
788
|
+
box-shadow: -12px 0 28px rgba(15, 23, 42, 0.2);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
[data-rte-comments-open="true"] :is(.rte-toolbar-wrapper, .rte-toolbar:not(.rte-toolbar-wrapper .rte-toolbar), .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
792
|
+
margin-right: 0;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/* A phone: the panel is a sheet that rises from the bottom, over the page, with the text still above it. */
|
|
797
|
+
@media (max-width: 640px) {
|
|
798
|
+
.rte-comments-panel {
|
|
799
|
+
--rte-comments-panel-width: 100%;
|
|
800
|
+
position: fixed;
|
|
801
|
+
top: auto;
|
|
802
|
+
left: 0;
|
|
803
|
+
right: 0;
|
|
804
|
+
bottom: 0;
|
|
805
|
+
width: 100%;
|
|
806
|
+
height: min(72vh, 560px);
|
|
807
|
+
border-left: 0;
|
|
808
|
+
border-top: 1px solid var(--rte-color-border, #d1d5db);
|
|
809
|
+
border-radius: 16px 16px 0 0;
|
|
810
|
+
box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.22);
|
|
811
|
+
padding-bottom: env(safe-area-inset-bottom, 0px);
|
|
812
|
+
transform: translateY(100%);
|
|
813
|
+
z-index: 1000;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.rte-comments-panel.is-open {
|
|
817
|
+
transform: translateY(0);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/* The grip that says "this is a sheet". */
|
|
821
|
+
.rte-comments-header::before {
|
|
822
|
+
content: "";
|
|
823
|
+
position: absolute;
|
|
824
|
+
top: 6px;
|
|
825
|
+
left: 50%;
|
|
826
|
+
width: 36px;
|
|
827
|
+
height: 4px;
|
|
828
|
+
margin-left: -18px;
|
|
829
|
+
border-radius: 2px;
|
|
830
|
+
background: var(--rte-color-border, #d1d5db);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.rte-comments-header {
|
|
834
|
+
position: relative;
|
|
835
|
+
padding-top: 18px;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
.rte-comment-icon-btn,
|
|
839
|
+
.rte-comments-close {
|
|
840
|
+
width: 36px;
|
|
841
|
+
height: 36px;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.rte-comments-new {
|
|
845
|
+
height: 36px;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
.rte-comments-tab {
|
|
849
|
+
padding: 8px;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
.rte-comment-menu-item {
|
|
853
|
+
padding: 10px;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
.new-comment-textarea,
|
|
857
|
+
.rte-comment-reply-textarea,
|
|
858
|
+
.rte-comment-edit-textarea {
|
|
859
|
+
font-size: 16px; /* below 16px iOS zooms the page when a field is focused */
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
@media (prefers-reduced-motion: reduce) {
|
|
864
|
+
.rte-comments-panel,
|
|
865
|
+
.rte-comment-item,
|
|
866
|
+
.rte-comment-composer,
|
|
867
|
+
.rte-comment-anchor,
|
|
868
|
+
[data-rte-comments-open="true"] :is(.rte-toolbar-wrapper, .rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
869
|
+
transition: none;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
`, ne = { name: "User" }, ct = /^[A-Za-z0-9_:.-]{1,200}$/;
|
|
873
|
+
function G(e) {
|
|
874
|
+
return typeof e == "string" && ct.test(e);
|
|
875
|
+
}
|
|
876
|
+
function dt(e) {
|
|
877
|
+
if (typeof e != "string") return !1;
|
|
878
|
+
const t = e.trim();
|
|
879
|
+
return t ? /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t) ? t.length <= 3e5 : t.length > 2e3 ? !1 : /^(https?:)?\/\//i.test(t) ? !0 : !/^[a-z][a-z0-9+.-]*:/i.test(t) : !1;
|
|
880
|
+
}
|
|
881
|
+
function T(e) {
|
|
882
|
+
if (typeof e == "string") {
|
|
883
|
+
const o = e.trim();
|
|
884
|
+
return o ? { name: o } : null;
|
|
885
|
+
}
|
|
886
|
+
if (!e || typeof e != "object") return null;
|
|
887
|
+
const t = e, n = typeof t.name == "string" ? t.name.trim() : "";
|
|
888
|
+
if (!n) return null;
|
|
889
|
+
const r = { name: n };
|
|
890
|
+
return t.id !== void 0 && t.id !== null && String(t.id) !== "" && (r.id = String(t.id)), dt(t.avatar) && (r.avatar = t.avatar.trim()), r;
|
|
891
|
+
}
|
|
892
|
+
function ve(e, t) {
|
|
893
|
+
return typeof e != "string" || Number.isNaN(new Date(e).getTime()) ? t : e;
|
|
894
|
+
}
|
|
895
|
+
function ee(e) {
|
|
896
|
+
return typeof e == "string" && !Number.isNaN(new Date(e).getTime()) ? e : void 0;
|
|
897
|
+
}
|
|
898
|
+
function le(e, t = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
899
|
+
var o;
|
|
900
|
+
if (!Array.isArray(e)) return [];
|
|
901
|
+
const n = /* @__PURE__ */ new Set(), r = [];
|
|
902
|
+
for (const i of e) {
|
|
903
|
+
if (!i || typeof i != "object") continue;
|
|
904
|
+
const a = i;
|
|
905
|
+
if (!G(a.id) || n.has(a.id)) continue;
|
|
906
|
+
const s = typeof a.text == "string" ? a.text.trim() : "";
|
|
907
|
+
if (!s) continue;
|
|
908
|
+
n.add(a.id);
|
|
909
|
+
const l = {
|
|
910
|
+
id: a.id,
|
|
911
|
+
author: (o = T(a.author)) != null ? o : ne,
|
|
912
|
+
text: s,
|
|
913
|
+
createdAt: ve(a.createdAt, t),
|
|
914
|
+
resolved: a.resolved === !0,
|
|
915
|
+
replies: []
|
|
916
|
+
};
|
|
917
|
+
G(a.anchorId) && (l.anchorId = a.anchorId), typeof a.quote == "string" && a.quote.trim() && (l.quote = a.quote.trim());
|
|
918
|
+
const d = ee(a.editedAt);
|
|
919
|
+
if (d && (l.editedAt = d), l.resolved) {
|
|
920
|
+
const u = ee(a.resolvedAt);
|
|
921
|
+
u && (l.resolvedAt = u);
|
|
922
|
+
const c = T(a.resolvedBy);
|
|
923
|
+
c && (l.resolvedBy = c);
|
|
924
|
+
}
|
|
925
|
+
if (Array.isArray(a.replies)) {
|
|
926
|
+
const u = /* @__PURE__ */ new Set();
|
|
927
|
+
a.replies.forEach((c, m) => {
|
|
928
|
+
var ge;
|
|
929
|
+
if (!c || typeof c != "object") return;
|
|
930
|
+
const f = c, h = typeof f.text == "string" ? f.text.trim() : "";
|
|
931
|
+
if (!h) return;
|
|
932
|
+
let w = G(f.id) ? f.id : `${a.id}-reply-${m + 1}`;
|
|
933
|
+
for (; u.has(w); ) w = `${w}-x`;
|
|
934
|
+
u.add(w);
|
|
935
|
+
const D = {
|
|
936
|
+
id: w,
|
|
937
|
+
author: (ge = T(f.author)) != null ? ge : ne,
|
|
938
|
+
text: h,
|
|
939
|
+
createdAt: ve(f.createdAt, t)
|
|
940
|
+
}, he = ee(f.editedAt);
|
|
941
|
+
he && (D.editedAt = he), l.replies.push(D);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
r.push(l);
|
|
945
|
+
}
|
|
946
|
+
return r;
|
|
947
|
+
}
|
|
948
|
+
const v = /* @__PURE__ */ new WeakMap();
|
|
949
|
+
let A = null, ye = !1, we = 0;
|
|
950
|
+
const st = 2;
|
|
951
|
+
function H(e) {
|
|
952
|
+
return we += 1, `${e}-${Date.now()}-${we}`;
|
|
953
|
+
}
|
|
954
|
+
function x(e) {
|
|
955
|
+
if (!e) return null;
|
|
956
|
+
const t = e instanceof Element ? e : e.parentElement;
|
|
957
|
+
return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
|
|
958
|
+
}
|
|
959
|
+
function mt(e) {
|
|
960
|
+
const t = (e == null ? void 0 : e.editorElement) || (e == null ? void 0 : e.contentElement) || null;
|
|
961
|
+
if (!(t instanceof HTMLElement)) return;
|
|
962
|
+
const n = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
|
|
963
|
+
n && (A = n);
|
|
964
|
+
}
|
|
965
|
+
function $e() {
|
|
966
|
+
if (typeof window != "undefined") {
|
|
967
|
+
const r = window.__editoraCommandEditorRoot;
|
|
968
|
+
if (r instanceof HTMLElement) {
|
|
969
|
+
const o = r.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (r.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? r : null);
|
|
970
|
+
if (o)
|
|
971
|
+
return A = o, window.__editoraCommandEditorRoot = null, o;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
const e = document.activeElement, t = e ? x(e) : null;
|
|
975
|
+
if (t) return t;
|
|
976
|
+
const n = window.getSelection();
|
|
977
|
+
if (n && n.rangeCount > 0) {
|
|
978
|
+
const r = x(
|
|
979
|
+
n.getRangeAt(0).commonAncestorContainer
|
|
980
|
+
);
|
|
981
|
+
if (r) return r;
|
|
982
|
+
}
|
|
983
|
+
return A;
|
|
984
|
+
}
|
|
985
|
+
const y = [], ut = 20;
|
|
986
|
+
let ce = null, re = null;
|
|
987
|
+
function Oe(e) {
|
|
988
|
+
const t = T(e.options.currentUser);
|
|
989
|
+
t && (ce = t, re = e);
|
|
990
|
+
}
|
|
991
|
+
function pt(e) {
|
|
992
|
+
y.push(e), y.length > ut && y.shift(), Oe(e);
|
|
993
|
+
}
|
|
994
|
+
function R(e) {
|
|
995
|
+
var t, n, r;
|
|
996
|
+
return (r = (n = T((t = e.instance) == null ? void 0 : t.options.currentUser)) != null ? n : ce) != null ? r : ne;
|
|
997
|
+
}
|
|
998
|
+
function Ee(e, t) {
|
|
999
|
+
var o;
|
|
1000
|
+
const n = R(e), r = (o = e.instance) == null ? void 0 : o.options.canModify;
|
|
1001
|
+
if (r)
|
|
1002
|
+
try {
|
|
1003
|
+
return !!r(t, n);
|
|
1004
|
+
} catch (i) {
|
|
1005
|
+
return !1;
|
|
1006
|
+
}
|
|
1007
|
+
return n.id && t.id ? n.id === t.id : !0;
|
|
1008
|
+
}
|
|
1009
|
+
function ze(e) {
|
|
1010
|
+
var t, n;
|
|
1011
|
+
return {
|
|
1012
|
+
id: e.id,
|
|
1013
|
+
anchorId: (t = e.anchorId) != null ? t : "",
|
|
1014
|
+
selectedText: (n = e.quote) != null ? n : "",
|
|
1015
|
+
author: e.author,
|
|
1016
|
+
text: e.text,
|
|
1017
|
+
createdAt: e.createdAt,
|
|
1018
|
+
editedAt: e.editedAt,
|
|
1019
|
+
resolved: e.resolved,
|
|
1020
|
+
resolvedAt: e.resolvedAt,
|
|
1021
|
+
resolvedBy: e.resolvedBy,
|
|
1022
|
+
replies: e.replies.map((r) => ({ ...r })),
|
|
1023
|
+
aligned: !1
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
function ft(e) {
|
|
1027
|
+
const t = {
|
|
1028
|
+
id: e.id,
|
|
1029
|
+
author: { ...e.author },
|
|
1030
|
+
text: e.text,
|
|
1031
|
+
createdAt: e.createdAt,
|
|
1032
|
+
resolved: e.resolved,
|
|
1033
|
+
replies: e.replies.map((n) => {
|
|
1034
|
+
const r = { id: n.id, author: { ...n.author }, text: n.text, createdAt: n.createdAt };
|
|
1035
|
+
return n.editedAt && (r.editedAt = n.editedAt), r;
|
|
1036
|
+
})
|
|
1037
|
+
};
|
|
1038
|
+
return e.anchorId && (t.anchorId = e.anchorId), e.selectedText && (t.quote = e.selectedText), e.editedAt && (t.editedAt = e.editedAt), e.resolved && e.resolvedAt && (t.resolvedAt = e.resolvedAt), e.resolved && e.resolvedBy && (t.resolvedBy = { ...e.resolvedBy }), t;
|
|
1039
|
+
}
|
|
1040
|
+
function qe(e) {
|
|
1041
|
+
return B(e), Array.from(e.comments.values()).filter((t) => !t.deleted).map(ft);
|
|
1042
|
+
}
|
|
1043
|
+
function ht(e) {
|
|
1044
|
+
if (!e.storageKey) return null;
|
|
1045
|
+
try {
|
|
1046
|
+
const t = window.localStorage.getItem(e.storageKey);
|
|
1047
|
+
return t === null ? null : le(JSON.parse(t));
|
|
1048
|
+
} catch (t) {
|
|
1049
|
+
return null;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
let Ce = !1;
|
|
1053
|
+
function gt(e, t) {
|
|
1054
|
+
if (e.storageKey)
|
|
1055
|
+
try {
|
|
1056
|
+
window.localStorage.setItem(e.storageKey, JSON.stringify(t));
|
|
1057
|
+
} catch (n) {
|
|
1058
|
+
Ce || (Ce = !0, console.warn("[comments] the comments could not be saved to localStorage", n));
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function g(e, t, n) {
|
|
1062
|
+
var i, a, s;
|
|
1063
|
+
const r = qe(e), o = n ? { reason: t, threadId: n } : { reason: t };
|
|
1064
|
+
try {
|
|
1065
|
+
e.root.dispatchEvent(new CustomEvent("editora:comments-change", { bubbles: !0, detail: { threads: r, ...o } }));
|
|
1066
|
+
} catch (l) {
|
|
1067
|
+
console.error("[comments] a change listener threw", l);
|
|
1068
|
+
}
|
|
1069
|
+
e.instance && gt(e.instance.options, r);
|
|
1070
|
+
try {
|
|
1071
|
+
(s = (i = e.instance) == null ? void 0 : (a = i.options).onChange) == null || s.call(a, r, o);
|
|
1072
|
+
} catch (l) {
|
|
1073
|
+
console.error("[comments] onChange threw", l);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
function He(e, t) {
|
|
1077
|
+
e.comments.clear(), le(t).forEach((n) => e.comments.set(n.id, ze(n))), e.expandedReplies.clear(), e.replyTexts = {}, e.editing = null, e.editDraft = "", e.hoverId = null, e.activeId = null, $(e), _(e), X(e), p(e);
|
|
1078
|
+
}
|
|
1079
|
+
function bt(e, t) {
|
|
1080
|
+
const [n] = le([t]);
|
|
1081
|
+
if (!n) return !1;
|
|
1082
|
+
if (e.editing && e.editing.commentId === n.id && e.editing.replyId) {
|
|
1083
|
+
const r = e.editing.replyId;
|
|
1084
|
+
n.replies.some((o) => o.id === r) || (e.editing = null, e.editDraft = "");
|
|
1085
|
+
}
|
|
1086
|
+
return e.comments.set(n.id, ze(n)), X(e), p(e), !0;
|
|
1087
|
+
}
|
|
1088
|
+
function xt(e, t) {
|
|
1089
|
+
var n, r;
|
|
1090
|
+
return e.comments.has(t) ? (e.comments.delete(t), e.expandedReplies.delete(t), delete e.replyTexts[t], ((n = e.editing) == null ? void 0 : n.commentId) === t && (e.editing = null, e.editDraft = ""), e.hoverId === t && (e.hoverId = null), e.activeId === t && N(e, null), (r = e.closeMenu) == null || r.call(e, !1), _(e), X(e), p(e), !0) : !1;
|
|
1091
|
+
}
|
|
1092
|
+
function Z(e, t, n) {
|
|
1093
|
+
var i, a, s;
|
|
1094
|
+
if (e.instance === t) {
|
|
1095
|
+
n || (e.instanceAssumed = !1);
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
e.instanceAssumed && e.instance && ((i = e.instance) != null && i.options.initialThreads || (a = e.instance) != null && a.options.storageKey) && e.comments.clear(), e.instance = t, e.instanceAssumed = n;
|
|
1099
|
+
const o = y.indexOf(t);
|
|
1100
|
+
if (o !== -1 && y.splice(o, 1), !t.initialApplied) {
|
|
1101
|
+
t.initialApplied = !0;
|
|
1102
|
+
const l = (s = ht(t.options)) != null ? s : t.options.initialThreads;
|
|
1103
|
+
l && He(e, l);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
function k(e, t) {
|
|
1107
|
+
var i;
|
|
1108
|
+
const n = v.get(e);
|
|
1109
|
+
if (n)
|
|
1110
|
+
return t && n.instance !== t && (n.instanceAssumed || !n.instance) && Z(n, t, !1), n;
|
|
1111
|
+
const r = {
|
|
1112
|
+
root: e,
|
|
1113
|
+
instance: null,
|
|
1114
|
+
instanceAssumed: !1,
|
|
1115
|
+
orphanIds: [],
|
|
1116
|
+
renderedKey: "",
|
|
1117
|
+
watchedContent: null,
|
|
1118
|
+
contentObserver: null,
|
|
1119
|
+
syncTimer: null,
|
|
1120
|
+
uid: H("rte-comments"),
|
|
1121
|
+
comments: /* @__PURE__ */ new Map(),
|
|
1122
|
+
panelVisible: !1,
|
|
1123
|
+
panelElement: null,
|
|
1124
|
+
filter: "open",
|
|
1125
|
+
composer: null,
|
|
1126
|
+
activeId: null,
|
|
1127
|
+
hoverId: null,
|
|
1128
|
+
editing: null,
|
|
1129
|
+
editDraft: "",
|
|
1130
|
+
undoEntry: null,
|
|
1131
|
+
undoTimer: null,
|
|
1132
|
+
expandedReplies: /* @__PURE__ */ new Set(),
|
|
1133
|
+
replyTexts: {},
|
|
1134
|
+
savedSelection: null,
|
|
1135
|
+
newCommentText: "",
|
|
1136
|
+
closeMenu: null,
|
|
1137
|
+
timeTimer: null
|
|
1138
|
+
};
|
|
1139
|
+
v.set(e, r);
|
|
1140
|
+
const o = (i = t != null ? t : y[0]) != null ? i : null;
|
|
1141
|
+
return o && Z(r, o, !t), se(r), de(r), r;
|
|
1142
|
+
}
|
|
1143
|
+
function de(e) {
|
|
1144
|
+
e.syncTimer === null && (e.syncTimer = window.setTimeout(() => X(e), 150));
|
|
1145
|
+
}
|
|
1146
|
+
function se(e) {
|
|
1147
|
+
var n;
|
|
1148
|
+
const t = V(e.root);
|
|
1149
|
+
t !== e.watchedContent && ((n = e.contentObserver) == null || n.disconnect(), e.watchedContent = t, e.contentObserver = null, !(!t || typeof MutationObserver == "undefined") && (e.contentObserver = new MutationObserver(() => de(e)), e.contentObserver.observe(t, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["class", "id"] })));
|
|
1150
|
+
}
|
|
1151
|
+
const Ae = "rte-comments-orphans", K = /* @__PURE__ */ new Set();
|
|
1152
|
+
function vt(e) {
|
|
1153
|
+
const t = V(e.root), n = /* @__PURE__ */ new Set();
|
|
1154
|
+
e.comments.forEach((i) => i.anchorId && n.add(i.anchorId)), e.orphanIds = t ? Array.from(t.querySelectorAll(".rte-comment-anchor")).filter((i) => !n.has(i.id) && G(i.id)).map((i) => i.id) : [], e.orphanIds.length ? K.add(e) : K.delete(e);
|
|
1155
|
+
const r = [];
|
|
1156
|
+
K.forEach((i) => {
|
|
1157
|
+
if (!i.root.isConnected) {
|
|
1158
|
+
K.delete(i);
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
i.orphanIds.forEach((a) => r.push(`.rte-comment-anchor[id="${a}"]`));
|
|
1162
|
+
});
|
|
1163
|
+
let o = document.getElementById(Ae);
|
|
1164
|
+
if (r.length === 0) {
|
|
1165
|
+
o == null || o.remove();
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
o || (o = document.createElement("style"), o.id = Ae, document.head.appendChild(o)), o.textContent = `${r.join(`,
|
|
1169
|
+
`)} { background: none; border-bottom: 0; cursor: inherit; }`;
|
|
1170
|
+
}
|
|
1171
|
+
function X(e) {
|
|
1172
|
+
if (e.syncTimer !== null && (window.clearTimeout(e.syncTimer), e.syncTimer = null), !e.root.isConnected) return;
|
|
1173
|
+
se(e);
|
|
1174
|
+
const t = /* @__PURE__ */ new Map();
|
|
1175
|
+
e.comments.forEach((r) => t.set(r.id, `${r.resolved}|${!!r.deleted}`)), B(e);
|
|
1176
|
+
let n;
|
|
1177
|
+
e.comments.forEach((r) => {
|
|
1178
|
+
t.has(r.id) && t.get(r.id) !== `${r.resolved}|${!!r.deleted}` && (n = r.id);
|
|
1179
|
+
}), vt(e), e.panelVisible && Ze(B(e)) !== e.renderedKey && p(e), n && g(e, "document", n);
|
|
1180
|
+
}
|
|
1181
|
+
function S() {
|
|
1182
|
+
const e = $e();
|
|
1183
|
+
return e ? (A = e, k(e)) : null;
|
|
1184
|
+
}
|
|
1185
|
+
function V(e) {
|
|
1186
|
+
return e.querySelector(".rte-content") || e.querySelector("[contenteditable]");
|
|
1187
|
+
}
|
|
1188
|
+
function J(e, t) {
|
|
1189
|
+
const n = V(t);
|
|
1190
|
+
return !!n && n.contains(e.commonAncestorContainer);
|
|
1191
|
+
}
|
|
1192
|
+
function Be(e) {
|
|
1193
|
+
const t = window.getSelection();
|
|
1194
|
+
if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
|
|
1195
|
+
const n = t.getRangeAt(0);
|
|
1196
|
+
return J(n, e) ? n.cloneRange() : null;
|
|
1197
|
+
}
|
|
1198
|
+
function O(e, t) {
|
|
1199
|
+
return t.anchorId ? e.root.querySelector(`[id="${t.anchorId}"]`) : null;
|
|
1200
|
+
}
|
|
1201
|
+
function B(e) {
|
|
1202
|
+
const t = [];
|
|
1203
|
+
return e.comments.forEach((n) => {
|
|
1204
|
+
if (n.anchorId) {
|
|
1205
|
+
const r = O(e, n);
|
|
1206
|
+
if (!r) return;
|
|
1207
|
+
n.deleted = !1, n.aligned === !1 ? (r.classList.toggle("rte-comment-anchor-resolved", n.resolved), n.aligned = !0) : n.resolved = r.classList.contains("rte-comment-anchor-resolved");
|
|
1208
|
+
} else if (n.deleted)
|
|
1209
|
+
return;
|
|
1210
|
+
t.push(n);
|
|
1211
|
+
}), t;
|
|
1212
|
+
}
|
|
1213
|
+
function U(e, t) {
|
|
1214
|
+
const n = V(e.root), r = n ? n.innerHTML : "", o = t();
|
|
1215
|
+
return n && n.innerHTML !== r && (ot(n, r), n.dispatchEvent(new Event("input", { bubbles: !0 }))), o;
|
|
1216
|
+
}
|
|
1217
|
+
function Ue(e, t) {
|
|
1218
|
+
const n = O(e, t);
|
|
1219
|
+
n && n.classList.toggle("rte-comment-anchor-resolved", t.resolved);
|
|
1220
|
+
}
|
|
1221
|
+
const q = /* @__PURE__ */ new Set(), Se = "rte-comments-emphasis";
|
|
1222
|
+
function _(e) {
|
|
1223
|
+
e.activeId || e.hoverId ? q.add(e) : q.delete(e), q.forEach((o) => {
|
|
1224
|
+
o.root.isConnected || q.delete(o);
|
|
1225
|
+
});
|
|
1226
|
+
const t = [], n = (o, i) => {
|
|
1227
|
+
const a = i ? o.comments.get(i) : null;
|
|
1228
|
+
return a != null && a.anchorId ? a.anchorId.replace(/["\\]/g, "") : "";
|
|
1229
|
+
};
|
|
1230
|
+
q.forEach((o) => {
|
|
1231
|
+
const i = n(o, o.hoverId), a = n(o, o.activeId);
|
|
1232
|
+
i && t.push(`.rte-comment-anchor[id="${i}"] { outline: 2px solid color-mix(in srgb, var(--rte-color-primary, #2563eb) 55%, transparent); outline-offset: 2px; }`), a && t.push(`.rte-comment-anchor[id="${a}"] { outline: 2px solid var(--rte-color-primary, #2563eb); outline-offset: 2px; background: rgba(250, 204, 21, 0.55); }`);
|
|
1233
|
+
});
|
|
1234
|
+
let r = document.getElementById(Se);
|
|
1235
|
+
if (t.length === 0) {
|
|
1236
|
+
r == null || r.remove();
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
r || (r = document.createElement("style"), r.id = Se, document.head.appendChild(r)), r.textContent = t.join(`
|
|
1240
|
+
`);
|
|
1241
|
+
}
|
|
1242
|
+
function I(e, t, n) {
|
|
1243
|
+
n ? e.hoverId = t : e.hoverId === t && (e.hoverId = null), _(e);
|
|
1244
|
+
}
|
|
1245
|
+
function N(e, t) {
|
|
1246
|
+
var n;
|
|
1247
|
+
e.activeId = t, (n = e.panelElement) == null || n.querySelectorAll(".rte-comment-item").forEach((r) => {
|
|
1248
|
+
r.classList.toggle("is-active", r.dataset.commentId === t);
|
|
1249
|
+
}), _(e);
|
|
1250
|
+
}
|
|
1251
|
+
function yt(e) {
|
|
1252
|
+
const t = e.parentNode;
|
|
1253
|
+
if (t) {
|
|
1254
|
+
for (; e.firstChild; )
|
|
1255
|
+
t.insertBefore(e.firstChild, e);
|
|
1256
|
+
e.remove();
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
function Pe(e) {
|
|
1260
|
+
var t;
|
|
1261
|
+
(t = e.root.querySelector('[contenteditable="true"]')) == null || t.focus({ preventScroll: !0 });
|
|
1262
|
+
}
|
|
1263
|
+
function Q(e, t) {
|
|
1264
|
+
var n;
|
|
1265
|
+
if (e.panelVisible = t, t) {
|
|
1266
|
+
et(), Et(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), p(e), St(e), nt(e.panelElement);
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
if (e.root.removeAttribute("data-rte-comments-open"), Tt(e), (n = e.closeMenu) == null || n.call(e, !1), e.editing = null, e.editDraft = "", $(e), e.hoverId = null, N(e, null), e.panelElement) {
|
|
1270
|
+
const r = rt(e.panelElement);
|
|
1271
|
+
e.panelElement.remove(), e.panelElement = null, r && Pe(e);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
function Ve(e) {
|
|
1275
|
+
Q(e, !1), (!e.root.contains(document.activeElement) || document.activeElement === document.body) && Pe(e);
|
|
1276
|
+
}
|
|
1277
|
+
const wt = {
|
|
1278
|
+
check: '<path d="M3.5 8.5l3 3 6-7"/>',
|
|
1279
|
+
reopen: '<path d="M3 8a5 5 0 1 0 1.6-3.7M3 2.8v3.2h3.2"/>',
|
|
1280
|
+
more: '<circle cx="8" cy="3.5" r="1.1" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r="1.1" fill="currentColor" stroke="none"/><circle cx="8" cy="12.5" r="1.1" fill="currentColor" stroke="none"/>',
|
|
1281
|
+
plus: '<path d="M8 3v10M3 8h10"/>',
|
|
1282
|
+
close: '<path d="M4 4l8 8M12 4l-8 8"/>',
|
|
1283
|
+
addComment: '<path d="M2.5 3.5h11v7.5H8.5l-3 2.5V11h-3zM8 5.2v3.6M6.2 7h3.6"/>',
|
|
1284
|
+
edit: '<path d="M10.5 3.5l2 2-7 7-2.8.8.8-2.8z"/>',
|
|
1285
|
+
trash: '<path d="M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.5 8.5h6l.5-8.5M7 7v4M9 7v4"/>',
|
|
1286
|
+
bubble: '<path d="M2.5 3.5h11v7.5H8.5l-3 2.5V11h-3z"/>'
|
|
1287
|
+
};
|
|
1288
|
+
function M(e) {
|
|
1289
|
+
return `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${wt[e]}</svg>`;
|
|
1290
|
+
}
|
|
1291
|
+
function b(e, t, n) {
|
|
1292
|
+
const r = document.createElement("button");
|
|
1293
|
+
return r.type = "button", r.className = e, n ? (r.innerHTML = M(n), r.setAttribute("aria-label", t), r.title = t) : r.textContent = t, r;
|
|
1294
|
+
}
|
|
1295
|
+
function Et(e) {
|
|
1296
|
+
var a, s;
|
|
1297
|
+
if (e.panelElement) return;
|
|
1298
|
+
const t = document.createElement("aside");
|
|
1299
|
+
t.className = "rte-comments-panel", t.setAttribute("role", "complementary"), t.setAttribute("aria-label", "Comments"), t.setAttribute("aria-hidden", "true");
|
|
1300
|
+
const n = [
|
|
1301
|
+
["open", "Open"],
|
|
1302
|
+
["resolved", "Resolved"],
|
|
1303
|
+
["all", "All"]
|
|
1304
|
+
];
|
|
1305
|
+
t.innerHTML = `
|
|
1306
|
+
<div class="rte-comments-header">
|
|
1307
|
+
<div class="rte-comments-title">
|
|
1308
|
+
<h3>Comments</h3>
|
|
1309
|
+
<span class="rte-comments-count" aria-hidden="true"></span>
|
|
1310
|
+
</div>
|
|
1311
|
+
<div class="rte-comments-header-actions">
|
|
1312
|
+
<button class="rte-comments-new" type="button" aria-label="New comment">${M("plus")}<span>New</span></button>
|
|
1313
|
+
<button class="rte-comments-close" type="button" aria-label="Close comments panel" title="Close">${M("close")}</button>
|
|
1314
|
+
</div>
|
|
1315
|
+
</div>
|
|
1316
|
+
<div class="rte-comments-tabs" role="tablist" aria-label="Show comments">
|
|
1317
|
+
${n.map(
|
|
1318
|
+
([l, d]) => `<button class="rte-comments-tab" type="button" role="tab" id="${e.uid}-tab-${l}" data-filter="${l}" aria-controls="${e.uid}-body"><span>${d}</span><span class="rte-comments-tab-count"></span></button>`
|
|
1319
|
+
).join("")}
|
|
1320
|
+
</div>
|
|
1321
|
+
<div class="rte-comments-body" id="${e.uid}-body" role="tabpanel"></div>
|
|
1322
|
+
<div class="rte-comments-toast" role="status" aria-live="polite" hidden></div>
|
|
1323
|
+
`, (a = t.querySelector(".rte-comments-close")) == null || a.addEventListener("click", () => Ve(e)), (s = t.querySelector(".rte-comments-new")) == null || s.addEventListener("click", () => {
|
|
1324
|
+
Ye(e, e.savedSelection ? e.savedSelection.cloneRange() : null);
|
|
1325
|
+
});
|
|
1326
|
+
const r = t.querySelector(".rte-comments-tabs"), o = Array.from(r.querySelectorAll(".rte-comments-tab"));
|
|
1327
|
+
o.forEach((l) => {
|
|
1328
|
+
l.addEventListener("click", () => {
|
|
1329
|
+
e.filter = l.dataset.filter, p(e);
|
|
1330
|
+
});
|
|
1331
|
+
}), r.addEventListener("keydown", (l) => {
|
|
1332
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(l.key)) return;
|
|
1333
|
+
const u = o.findIndex((m) => m === document.activeElement);
|
|
1334
|
+
if (u === -1) return;
|
|
1335
|
+
l.preventDefault();
|
|
1336
|
+
let c = u;
|
|
1337
|
+
l.key === "ArrowRight" && (c = (u + 1) % o.length), l.key === "ArrowLeft" && (c = (u - 1 + o.length) % o.length), l.key === "Home" && (c = 0), l.key === "End" && (c = o.length - 1), e.filter = o[c].dataset.filter, p(e), o[c].focus();
|
|
1338
|
+
}), window.getComputedStyle(e.root).position === "static" && (e.root.style.position = "relative"), e.root.appendChild(t), e.panelElement = t;
|
|
1339
|
+
}
|
|
1340
|
+
function _e(e) {
|
|
1341
|
+
const t = B(e), n = t.filter((o) => o.anchorId).map((o) => ({ comment: o, anchor: O(e, o) }));
|
|
1342
|
+
n.sort((o, i) => o.anchor === i.anchor ? 0 : o.anchor.compareDocumentPosition(i.anchor) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
1343
|
+
const r = t.filter((o) => !o.anchorId).sort((o, i) => o.createdAt.localeCompare(i.createdAt));
|
|
1344
|
+
return [...n.map((o) => o.comment), ...r];
|
|
1345
|
+
}
|
|
1346
|
+
function Te(e, t = !1) {
|
|
1347
|
+
const n = document.createElement("span");
|
|
1348
|
+
if (n.className = `rte-comment-avatar${t ? " small" : ""}`, n.setAttribute("aria-hidden", "true"), n.style.background = at(e.id || e.name), n.textContent = it(e.name), e.avatar) {
|
|
1349
|
+
const r = document.createElement("img");
|
|
1350
|
+
r.alt = "", r.loading = "lazy", r.decoding = "async", r.referrerPolicy = "no-referrer", r.addEventListener("error", () => r.remove()), r.src = e.avatar, n.appendChild(r);
|
|
1351
|
+
}
|
|
1352
|
+
return n;
|
|
1353
|
+
}
|
|
1354
|
+
function Ct(e) {
|
|
1355
|
+
const t = document.createElement("time");
|
|
1356
|
+
return t.className = "rte-comment-date", t.dateTime = e, t.dataset.created = e, t.title = De(e), t.textContent = ae(e), t;
|
|
1357
|
+
}
|
|
1358
|
+
function At(e) {
|
|
1359
|
+
var t;
|
|
1360
|
+
(t = e.panelElement) == null || t.querySelectorAll("time[data-created]").forEach((n) => {
|
|
1361
|
+
n.textContent = ae(n.dataset.created || "");
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
function St(e) {
|
|
1365
|
+
e.timeTimer === null && (e.timeTimer = window.setInterval(() => At(e), 6e4));
|
|
1366
|
+
}
|
|
1367
|
+
function Tt(e) {
|
|
1368
|
+
e.timeTimer !== null && (window.clearInterval(e.timeTimer), e.timeTimer = null);
|
|
1369
|
+
}
|
|
1370
|
+
function me(e) {
|
|
1371
|
+
if (e.style.height = "auto", !e.scrollHeight) return;
|
|
1372
|
+
const t = e.offsetHeight - e.clientHeight;
|
|
1373
|
+
e.style.height = `${Math.min(e.scrollHeight + t, 160)}px`;
|
|
1374
|
+
}
|
|
1375
|
+
function Fe() {
|
|
1376
|
+
var e;
|
|
1377
|
+
return !!((e = window.matchMedia) != null && e.call(window, "(prefers-reduced-motion: reduce)").matches);
|
|
1378
|
+
}
|
|
1379
|
+
function ke(e, t, n = !0) {
|
|
1380
|
+
const r = O(e, t);
|
|
1381
|
+
if (!r) return;
|
|
1382
|
+
const o = !!e.panelElement && window.getComputedStyle(e.panelElement).position === "fixed";
|
|
1383
|
+
if (r.scrollIntoView({ behavior: o || Fe() ? "auto" : "smooth", block: "center", inline: "nearest" }), o && e.panelElement) {
|
|
1384
|
+
const i = e.panelElement.getBoundingClientRect().top, a = r.getBoundingClientRect().bottom;
|
|
1385
|
+
a > i - 16 && window.scrollBy(0, a - i + 32);
|
|
1386
|
+
}
|
|
1387
|
+
n && (I(e, t.id, !0), window.setTimeout(() => I(e, t.id, !1), 1200));
|
|
1388
|
+
}
|
|
1389
|
+
function Ke(e, t) {
|
|
1390
|
+
var o, i;
|
|
1391
|
+
const n = e.comments.get(t);
|
|
1392
|
+
if (!n) return;
|
|
1393
|
+
e.filter !== "all" && (e.filter = n.resolved ? "resolved" : "open"), N(e, t), p(e);
|
|
1394
|
+
const r = Array.from((i = (o = e.panelElement) == null ? void 0 : o.querySelectorAll(".rte-comment-item")) != null ? i : []).find(
|
|
1395
|
+
(a) => a.dataset.commentId === t
|
|
1396
|
+
);
|
|
1397
|
+
r == null || r.scrollIntoView({ behavior: Fe() ? "auto" : "smooth", block: "nearest" });
|
|
1398
|
+
}
|
|
1399
|
+
function Ie(e, t, n, r) {
|
|
1400
|
+
const o = document.createElement("div");
|
|
1401
|
+
o.className = "rte-comment-more";
|
|
1402
|
+
const i = b("rte-comment-icon-btn", r, "more");
|
|
1403
|
+
i.setAttribute("aria-haspopup", "menu"), i.setAttribute("aria-expanded", "false"), i.dataset.action = "more", i.dataset.commentId = n.commentId, n.replyId && (i.dataset.id = n.replyId);
|
|
1404
|
+
const a = document.createElement("div");
|
|
1405
|
+
a.className = "rte-comment-menu", a.setAttribute("role", "menu"), a.setAttribute("aria-label", r), a.hidden = !0, t.forEach((c) => {
|
|
1406
|
+
const m = document.createElement("button");
|
|
1407
|
+
m.type = "button", m.className = `rte-comment-menu-item${c.danger ? " danger" : ""}`, m.setAttribute("role", "menuitem"), m.dataset.action = c.label.toLowerCase(), m.innerHTML = M(c.icon);
|
|
1408
|
+
const f = document.createElement("span");
|
|
1409
|
+
f.textContent = c.label, m.appendChild(f), m.addEventListener("click", () => {
|
|
1410
|
+
var h;
|
|
1411
|
+
(h = e.closeMenu) == null || h.call(e, !1), c.run();
|
|
1412
|
+
}), a.appendChild(m);
|
|
1413
|
+
});
|
|
1414
|
+
const s = () => Array.from(a.querySelectorAll('[role="menuitem"]')), l = (c) => {
|
|
1415
|
+
a.hidden || (a.hidden = !0, i.setAttribute("aria-expanded", "false"), document.removeEventListener("pointerdown", d, !0), document.removeEventListener("focusin", d, !0), e.closeMenu === l && (e.closeMenu = null), c && i.isConnected && i.focus({ preventScroll: !0 }));
|
|
1416
|
+
};
|
|
1417
|
+
function d(c) {
|
|
1418
|
+
c.target instanceof Node && o.contains(c.target) || l(!1);
|
|
1419
|
+
}
|
|
1420
|
+
const u = () => {
|
|
1421
|
+
var c, m;
|
|
1422
|
+
(c = e.closeMenu) == null || c.call(e, !1), a.hidden = !1, i.setAttribute("aria-expanded", "true"), e.closeMenu = l, document.addEventListener("pointerdown", d, !0), document.addEventListener("focusin", d, !0), (m = s()[0]) == null || m.focus({ preventScroll: !0 });
|
|
1423
|
+
};
|
|
1424
|
+
return i.addEventListener("click", () => a.hidden ? u() : l(!0)), i.addEventListener("keydown", (c) => {
|
|
1425
|
+
c.key === "ArrowDown" && a.hidden && (c.preventDefault(), u());
|
|
1426
|
+
}), a.addEventListener("keydown", (c) => {
|
|
1427
|
+
const m = s(), f = m.indexOf(document.activeElement);
|
|
1428
|
+
let h = -1;
|
|
1429
|
+
c.key === "ArrowDown" ? h = (f + 1) % m.length : c.key === "ArrowUp" ? h = (f - 1 + m.length) % m.length : c.key === "Home" ? h = 0 : c.key === "End" ? h = m.length - 1 : c.key === "Tab" && l(!1), h !== -1 && (c.preventDefault(), m[h].focus({ preventScroll: !0 }));
|
|
1430
|
+
}), o.append(i, a), o;
|
|
1431
|
+
}
|
|
1432
|
+
function Le(e, t) {
|
|
1433
|
+
const n = document.createElement("div");
|
|
1434
|
+
if (n.className = "rte-comment-when", n.appendChild(Ct(e)), t) {
|
|
1435
|
+
const r = document.createElement("span");
|
|
1436
|
+
r.className = "rte-comment-edited", r.textContent = "· edited", r.title = `Edited ${De(t)}`, n.appendChild(r);
|
|
1437
|
+
}
|
|
1438
|
+
return n;
|
|
1439
|
+
}
|
|
1440
|
+
function Ne(e, t) {
|
|
1441
|
+
const n = document.createElement("form");
|
|
1442
|
+
n.className = "rte-comment-edit", n.noValidate = !0;
|
|
1443
|
+
const r = document.createElement("textarea");
|
|
1444
|
+
r.className = "rte-comment-edit-textarea", r.rows = 2, r.setAttribute("aria-label", t.replyId ? "Edit reply" : "Edit comment"), r.dataset.commentId = t.commentId, t.replyId && (r.dataset.id = t.replyId), r.value = e.editDraft;
|
|
1445
|
+
const o = document.createElement("div");
|
|
1446
|
+
o.className = "rte-comment-form-actions";
|
|
1447
|
+
const i = b("rte-comment-btn ghost", "Cancel"), a = b("rte-comment-btn primary", "Save");
|
|
1448
|
+
a.type = "submit", o.append(i, a);
|
|
1449
|
+
const s = () => {
|
|
1450
|
+
a.disabled = !r.value.trim(), me(r);
|
|
1451
|
+
};
|
|
1452
|
+
return s(), r.addEventListener("input", () => {
|
|
1453
|
+
e.editDraft = r.value, s();
|
|
1454
|
+
}), r.addEventListener("keydown", (l) => {
|
|
1455
|
+
l.key === "Enter" && !l.shiftKey && !l.isComposing && (l.preventDefault(), n.requestSubmit());
|
|
1456
|
+
}), i.addEventListener("click", () => ue(e)), n.addEventListener("submit", (l) => {
|
|
1457
|
+
l.preventDefault(), kt(e, r.value);
|
|
1458
|
+
}), n.append(r, o), n;
|
|
1459
|
+
}
|
|
1460
|
+
function Me(e, t, n) {
|
|
1461
|
+
var a;
|
|
1462
|
+
const r = e.comments.get(t);
|
|
1463
|
+
if (!r) return;
|
|
1464
|
+
const o = n ? r.replies.find((s) => s.id === n) : null;
|
|
1465
|
+
if (n && !o) return;
|
|
1466
|
+
e.editing = { commentId: t, replyId: n }, e.editDraft = o ? o.text : r.text, n && e.expandedReplies.add(t), p(e);
|
|
1467
|
+
const i = (a = e.panelElement) == null ? void 0 : a.querySelector(".rte-comment-edit-textarea");
|
|
1468
|
+
i && (i.focus({ preventScroll: !0 }), i.setSelectionRange(i.value.length, i.value.length));
|
|
1469
|
+
}
|
|
1470
|
+
function ue(e) {
|
|
1471
|
+
var r, o;
|
|
1472
|
+
const t = e.editing;
|
|
1473
|
+
if (e.editing = null, e.editDraft = "", p(e), !t) return;
|
|
1474
|
+
const n = t.replyId ? `[data-action="more"][data-id="${t.replyId}"]` : `.rte-comment-item[data-comment-id="${t.commentId}"] > .rte-comment-header [data-action="more"]`;
|
|
1475
|
+
(o = (r = e.panelElement) == null ? void 0 : r.querySelector(n)) == null || o.focus({ preventScroll: !0 });
|
|
1476
|
+
}
|
|
1477
|
+
function kt(e, t) {
|
|
1478
|
+
const n = e.editing, r = t.trim();
|
|
1479
|
+
if (!n || !r) return;
|
|
1480
|
+
const o = e.comments.get(n.commentId);
|
|
1481
|
+
if (!o) return;
|
|
1482
|
+
const i = n.replyId ? o.replies.find((s) => s.id === n.replyId) : o, a = !!i && i.text !== r;
|
|
1483
|
+
i && a && (i.text = r, i.editedAt = (/* @__PURE__ */ new Date()).toISOString()), ue(e), a && g(e, "edit", o.id);
|
|
1484
|
+
}
|
|
1485
|
+
function $(e) {
|
|
1486
|
+
var n;
|
|
1487
|
+
e.undoTimer !== null && window.clearTimeout(e.undoTimer), e.undoTimer = null, e.undoEntry = null;
|
|
1488
|
+
const t = (n = e.panelElement) == null ? void 0 : n.querySelector(".rte-comments-toast");
|
|
1489
|
+
t && (t.hidden = !0, t.replaceChildren());
|
|
1490
|
+
}
|
|
1491
|
+
function je(e, t) {
|
|
1492
|
+
var i;
|
|
1493
|
+
const n = (i = e.panelElement) == null ? void 0 : i.querySelector(".rte-comments-toast");
|
|
1494
|
+
if (!n) return;
|
|
1495
|
+
$(e), e.undoEntry = t;
|
|
1496
|
+
const r = document.createElement("span");
|
|
1497
|
+
r.textContent = t.message;
|
|
1498
|
+
const o = b("rte-comments-toast-action", "Undo");
|
|
1499
|
+
o.addEventListener("click", () => {
|
|
1500
|
+
const a = t.undo();
|
|
1501
|
+
$(e), a || (r.textContent = "This could not be restored here. Use Undo in the document.", n.replaceChildren(r), n.hidden = !1, e.undoTimer = window.setTimeout(() => $(e), 6e3));
|
|
1502
|
+
}), n.replaceChildren(r, o), n.hidden = !1, e.undoTimer = window.setTimeout(() => $(e), 8e3);
|
|
1503
|
+
}
|
|
1504
|
+
function It(e, t) {
|
|
1505
|
+
const n = document.createElement("div");
|
|
1506
|
+
n.className = "rte-comment-reply-box";
|
|
1507
|
+
const r = document.createElement("textarea");
|
|
1508
|
+
r.className = "rte-comment-reply-textarea", r.rows = 1, r.placeholder = "Reply…", r.setAttribute("aria-label", "Reply"), r.dataset.commentId = t.id, r.value = e.replyTexts[t.id] || "";
|
|
1509
|
+
const o = document.createElement("div");
|
|
1510
|
+
o.className = "rte-comment-form-actions";
|
|
1511
|
+
const i = b("rte-comment-btn ghost", "Cancel"), a = b("rte-comment-btn primary", "Reply");
|
|
1512
|
+
o.append(i, a);
|
|
1513
|
+
const s = () => {
|
|
1514
|
+
const d = !!r.value.trim();
|
|
1515
|
+
a.disabled = !d, n.classList.toggle("has-text", !!r.value), me(r);
|
|
1516
|
+
};
|
|
1517
|
+
s();
|
|
1518
|
+
const l = () => {
|
|
1519
|
+
const d = r.value.trim();
|
|
1520
|
+
d && (Ut(t.id, R(e), d), delete e.replyTexts[t.id], p(e));
|
|
1521
|
+
};
|
|
1522
|
+
return r.addEventListener("input", () => {
|
|
1523
|
+
e.replyTexts[t.id] = r.value, s();
|
|
1524
|
+
}), r.addEventListener("focus", () => N(e, t.id)), r.addEventListener("keydown", (d) => {
|
|
1525
|
+
d.key === "Enter" && !d.shiftKey && !d.isComposing && (d.preventDefault(), l());
|
|
1526
|
+
}), a.addEventListener("click", l), i.addEventListener("click", () => {
|
|
1527
|
+
delete e.replyTexts[t.id], r.value = "", s(), r.blur();
|
|
1528
|
+
}), n.append(r, o), n;
|
|
1529
|
+
}
|
|
1530
|
+
function Lt(e, t) {
|
|
1531
|
+
const n = document.createElement("article");
|
|
1532
|
+
n.className = `rte-comment-item${t.resolved ? " resolved" : ""}${e.activeId === t.id ? " is-active" : ""}`, n.dataset.commentId = t.id;
|
|
1533
|
+
const r = document.createElement("header");
|
|
1534
|
+
r.className = "rte-comment-header";
|
|
1535
|
+
const o = document.createElement("div");
|
|
1536
|
+
o.className = "rte-comment-meta";
|
|
1537
|
+
const i = document.createElement("strong");
|
|
1538
|
+
i.className = "rte-comment-author", i.textContent = t.author.name, o.append(i, Le(t.createdAt, t.editedAt));
|
|
1539
|
+
const a = document.createElement("div");
|
|
1540
|
+
a.className = "rte-comment-header-actions";
|
|
1541
|
+
const s = b(
|
|
1542
|
+
"rte-comment-icon-btn",
|
|
1543
|
+
t.resolved ? "Reopen thread" : "Resolve thread",
|
|
1544
|
+
t.resolved ? "reopen" : "check"
|
|
1545
|
+
);
|
|
1546
|
+
if (s.dataset.action = "resolve", s.dataset.commentId = t.id, s.addEventListener("click", () => {
|
|
1547
|
+
t.resolved ? qt(t.id) : zt(t.id, R(e));
|
|
1548
|
+
}), a.append(s), Ee(e, t.author) && a.append(
|
|
1549
|
+
Ie(
|
|
1550
|
+
e,
|
|
1551
|
+
[
|
|
1552
|
+
{ label: "Edit", icon: "edit", run: () => Me(e, t.id, null) },
|
|
1553
|
+
{ label: "Delete", icon: "trash", danger: !0, run: () => Ht(e, t.id) }
|
|
1554
|
+
],
|
|
1555
|
+
{ commentId: t.id },
|
|
1556
|
+
"More actions"
|
|
1557
|
+
)
|
|
1558
|
+
), r.append(Te(t.author), o, a), n.appendChild(r), t.anchorId && t.selectedText) {
|
|
1559
|
+
const l = document.createElement("button");
|
|
1560
|
+
l.type = "button", l.className = "rte-comment-selection", l.textContent = t.selectedText, l.title = "Go to this text", l.setAttribute("aria-label", `Go to the commented text: ${t.selectedText}`), l.addEventListener("click", () => {
|
|
1561
|
+
N(e, t.id), ke(e, t);
|
|
1562
|
+
}), n.appendChild(l);
|
|
1563
|
+
}
|
|
1564
|
+
if (e.editing && e.editing.commentId === t.id && !e.editing.replyId)
|
|
1565
|
+
n.appendChild(Ne(e, e.editing));
|
|
1566
|
+
else {
|
|
1567
|
+
const l = document.createElement("div");
|
|
1568
|
+
l.className = "rte-comment-text", l.textContent = t.text, n.appendChild(l);
|
|
1569
|
+
}
|
|
1570
|
+
if (t.resolved) {
|
|
1571
|
+
const l = document.createElement("div");
|
|
1572
|
+
l.className = "rte-comment-status", l.innerHTML = M("check");
|
|
1573
|
+
const d = document.createElement("span"), u = t.resolvedBy ? ` by ${t.resolvedBy.name}` : "", c = t.resolvedAt ? ` · ${ae(t.resolvedAt)}` : "";
|
|
1574
|
+
d.textContent = `Resolved${u}${c}`, l.appendChild(d), n.appendChild(l);
|
|
1575
|
+
}
|
|
1576
|
+
if (t.replies.length > 0) {
|
|
1577
|
+
const l = document.createElement("div");
|
|
1578
|
+
l.className = "rte-comment-replies";
|
|
1579
|
+
const u = e.expandedReplies.has(t.id) ? 0 : Math.max(0, t.replies.length - st);
|
|
1580
|
+
if (u > 0) {
|
|
1581
|
+
const c = b(
|
|
1582
|
+
"rte-comment-more-replies",
|
|
1583
|
+
`Show ${u} earlier ${u === 1 ? "reply" : "replies"}`
|
|
1584
|
+
);
|
|
1585
|
+
c.addEventListener("click", () => {
|
|
1586
|
+
e.expandedReplies.add(t.id), p(e);
|
|
1587
|
+
}), l.appendChild(c);
|
|
1588
|
+
}
|
|
1589
|
+
t.replies.slice(u).forEach((c) => {
|
|
1590
|
+
const m = document.createElement("div");
|
|
1591
|
+
m.className = "rte-comment-reply", m.dataset.replyId = c.id;
|
|
1592
|
+
const f = document.createElement("div");
|
|
1593
|
+
f.className = "rte-comment-reply-header";
|
|
1594
|
+
const h = document.createElement("div");
|
|
1595
|
+
h.className = "rte-comment-meta";
|
|
1596
|
+
const w = document.createElement("strong");
|
|
1597
|
+
if (w.className = "rte-comment-author", w.textContent = c.author.name, h.append(w, Le(c.createdAt, c.editedAt)), f.append(Te(c.author, !0), h), Ee(e, c.author) && f.append(
|
|
1598
|
+
Ie(
|
|
1599
|
+
e,
|
|
1600
|
+
[
|
|
1601
|
+
{ label: "Edit", icon: "edit", run: () => Me(e, t.id, c.id) },
|
|
1602
|
+
{ label: "Delete", icon: "trash", danger: !0, run: () => Bt(e, t.id, c.id) }
|
|
1603
|
+
],
|
|
1604
|
+
{ commentId: t.id, replyId: c.id },
|
|
1605
|
+
"More reply actions"
|
|
1606
|
+
)
|
|
1607
|
+
), m.appendChild(f), e.editing && e.editing.commentId === t.id && e.editing.replyId === c.id)
|
|
1608
|
+
m.appendChild(Ne(e, e.editing));
|
|
1609
|
+
else {
|
|
1610
|
+
const D = document.createElement("div");
|
|
1611
|
+
D.className = "rte-comment-reply-text", D.textContent = c.text, m.appendChild(D);
|
|
1612
|
+
}
|
|
1613
|
+
l.appendChild(m);
|
|
1614
|
+
}), n.appendChild(l);
|
|
1615
|
+
}
|
|
1616
|
+
return t.resolved || n.appendChild(It(e, t)), n.addEventListener("click", (l) => {
|
|
1617
|
+
var u;
|
|
1618
|
+
const d = l.target instanceof Element ? l.target : null;
|
|
1619
|
+
!d || d.closest('button, textarea, form, [role="menu"]') || (u = window.getSelection()) != null && u.toString() || (N(e, t.id), ke(e, t, !1));
|
|
1620
|
+
}), n.addEventListener("mouseenter", () => I(e, t.id, !0)), n.addEventListener("mouseleave", () => I(e, t.id, !1)), n.addEventListener("focusin", () => I(e, t.id, !0)), n.addEventListener("focusout", () => I(e, t.id, !1)), n;
|
|
1621
|
+
}
|
|
1622
|
+
function Nt(e, t) {
|
|
1623
|
+
const n = document.createElement("form");
|
|
1624
|
+
if (n.className = "rte-comment-composer", n.noValidate = !0, n.setAttribute("aria-label", t.range ? "New comment on the selected text" : "New note for the whole document"), t.range) {
|
|
1625
|
+
const l = document.createElement("div");
|
|
1626
|
+
l.className = "rte-comment-selection";
|
|
1627
|
+
const d = document.createElement("span");
|
|
1628
|
+
d.textContent = t.quote, d.title = t.quote;
|
|
1629
|
+
const u = b("rte-comment-icon-btn", "Comment on the whole document instead", "close");
|
|
1630
|
+
u.addEventListener("click", () => {
|
|
1631
|
+
t.range = null, t.quote = "", p(e), We(e);
|
|
1632
|
+
}), l.append(d, u), n.appendChild(l);
|
|
1633
|
+
} else {
|
|
1634
|
+
const l = document.createElement("p");
|
|
1635
|
+
l.className = "rte-comment-composer-hint", l.textContent = "A note for the whole document. To comment on a passage, select it first, then click New.", n.appendChild(l);
|
|
1636
|
+
}
|
|
1637
|
+
const r = document.createElement("textarea");
|
|
1638
|
+
if (r.className = "new-comment-textarea", r.rows = 3, r.placeholder = t.range ? "Add a comment…" : "Add a note…", r.setAttribute("aria-label", t.range ? "Comment" : "Note"), r.value = e.newCommentText, n.appendChild(r), t.error) {
|
|
1639
|
+
const l = document.createElement("p");
|
|
1640
|
+
l.className = "rte-comment-error", l.setAttribute("role", "alert"), l.textContent = t.error, n.appendChild(l);
|
|
1641
|
+
}
|
|
1642
|
+
const o = document.createElement("div");
|
|
1643
|
+
o.className = "rte-comment-form-actions";
|
|
1644
|
+
const i = b("rte-comment-btn ghost", "Cancel"), a = b("rte-comment-btn primary", "Comment");
|
|
1645
|
+
a.type = "submit", o.append(i, a), n.appendChild(o);
|
|
1646
|
+
const s = () => {
|
|
1647
|
+
a.disabled = !r.value.trim();
|
|
1648
|
+
};
|
|
1649
|
+
return s(), r.addEventListener("input", () => {
|
|
1650
|
+
var l;
|
|
1651
|
+
e.newCommentText = r.value, t.error && (t.error = "", (l = n.querySelector(".rte-comment-error")) == null || l.remove()), s();
|
|
1652
|
+
}), r.addEventListener("keydown", (l) => {
|
|
1653
|
+
l.key === "Enter" && !l.shiftKey && !l.isComposing && (l.preventDefault(), n.requestSubmit());
|
|
1654
|
+
}), i.addEventListener("click", () => Ge(e)), n.addEventListener("submit", (l) => {
|
|
1655
|
+
l.preventDefault();
|
|
1656
|
+
const d = r.value.trim();
|
|
1657
|
+
if (!d) return;
|
|
1658
|
+
const u = Je(e, R(e), d, t.range);
|
|
1659
|
+
if (!u) {
|
|
1660
|
+
t.error = "That text could not be commented on. Select it again and click New.", t.range = null, t.quote = "", p(e);
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
e.newCommentText = "", e.composer = null, e.filter === "resolved" && (e.filter = "open"), Ke(e, u);
|
|
1664
|
+
}), n;
|
|
1665
|
+
}
|
|
1666
|
+
function We(e) {
|
|
1667
|
+
var t, n;
|
|
1668
|
+
(n = (t = e.panelElement) == null ? void 0 : t.querySelector(".new-comment-textarea")) == null || n.focus({ preventScroll: !0 });
|
|
1669
|
+
}
|
|
1670
|
+
function Ye(e, t) {
|
|
1671
|
+
const n = t ? t.toString().replace(/\s+/g, " ").trim() : "";
|
|
1672
|
+
e.composer = { range: t && n ? t.cloneRange() : null, quote: n, error: "" }, e.filter === "resolved" && (e.filter = "open"), p(e), We(e);
|
|
1673
|
+
}
|
|
1674
|
+
function Ge(e) {
|
|
1675
|
+
e.composer = null, e.newCommentText = "", p(e);
|
|
1676
|
+
}
|
|
1677
|
+
function Mt(e, t) {
|
|
1678
|
+
const n = document.createElement("div");
|
|
1679
|
+
n.className = "rte-comments-empty";
|
|
1680
|
+
let r = "No comments yet", o = "Select text in the document and click New to start a discussion.";
|
|
1681
|
+
t > 0 && e === "open" ? (r = "No open comments", o = "Every thread has been resolved.") : t > 0 && e === "resolved" && (r = "Nothing resolved yet", o = "Threads you resolve show up here."), n.innerHTML = M("bubble");
|
|
1682
|
+
const i = document.createElement("strong");
|
|
1683
|
+
i.textContent = r;
|
|
1684
|
+
const a = document.createElement("p");
|
|
1685
|
+
return a.textContent = o, n.append(i, a), n;
|
|
1686
|
+
}
|
|
1687
|
+
function Ze(e) {
|
|
1688
|
+
return e.map((t) => `${t.id}:${t.resolved ? 1 : 0}`).join("|");
|
|
1689
|
+
}
|
|
1690
|
+
function p(e) {
|
|
1691
|
+
const t = e || S(), n = t == null ? void 0 : t.panelElement;
|
|
1692
|
+
if (!t || !n) return;
|
|
1693
|
+
const r = _e(t);
|
|
1694
|
+
t.renderedKey = Ze(B(t));
|
|
1695
|
+
const o = {
|
|
1696
|
+
open: r.filter((d) => !d.resolved).length,
|
|
1697
|
+
resolved: r.filter((d) => d.resolved).length,
|
|
1698
|
+
all: r.length
|
|
1699
|
+
}, i = n.querySelector(".rte-comments-count");
|
|
1700
|
+
i && (i.textContent = String(o.open), i.hidden = o.open === 0), n.querySelectorAll(".rte-comments-tab").forEach((d) => {
|
|
1701
|
+
const u = d.dataset.filter, c = u === t.filter;
|
|
1702
|
+
d.setAttribute("aria-selected", String(c)), d.tabIndex = c ? 0 : -1;
|
|
1703
|
+
const m = d.querySelector(".rte-comments-tab-count");
|
|
1704
|
+
m && (m.textContent = String(o[u]));
|
|
1705
|
+
});
|
|
1706
|
+
const a = n.querySelector(".rte-comments-body");
|
|
1707
|
+
if (!a) return;
|
|
1708
|
+
a.setAttribute("aria-labelledby", `${t.uid}-tab-${t.filter}`);
|
|
1709
|
+
const s = r.filter((d) => t.filter === "open" ? !d.resolved : t.filter === "resolved" ? d.resolved : !0);
|
|
1710
|
+
t.hoverId && (t.hoverId = null, _(t));
|
|
1711
|
+
const l = a.scrollTop;
|
|
1712
|
+
tt(n, () => {
|
|
1713
|
+
const d = [];
|
|
1714
|
+
t.composer && d.push(Nt(t, t.composer)), s.forEach((u) => d.push(Lt(t, u))), s.length === 0 && !t.composer && d.push(Mt(t.filter, o.all)), a.replaceChildren(...d);
|
|
1715
|
+
}), a.scrollTop = l, a.querySelectorAll("textarea").forEach((d) => me(d));
|
|
1716
|
+
}
|
|
1717
|
+
function Xe(e) {
|
|
1718
|
+
return v.has(e) || !!e.querySelector('[data-command="addComment"]');
|
|
1719
|
+
}
|
|
1720
|
+
function pe(e) {
|
|
1721
|
+
var r;
|
|
1722
|
+
A = e;
|
|
1723
|
+
const t = k(e), n = Be(e) || (t.savedSelection ? t.savedSelection.cloneRange() : null);
|
|
1724
|
+
n && ((r = window.getSelection()) == null || r.removeAllRanges()), t.savedSelection = null, E(), Q(t, !0), Ye(t, n);
|
|
1725
|
+
}
|
|
1726
|
+
let C = null, P = null, oe = null, ie = !1;
|
|
1727
|
+
function Rt() {
|
|
1728
|
+
return /Mac|iPhone|iPad/.test(navigator.platform || "") ? "⌘⌥M" : "Ctrl+Alt+M";
|
|
1729
|
+
}
|
|
1730
|
+
function E() {
|
|
1731
|
+
C && (C.hidden = !0), P = null;
|
|
1732
|
+
}
|
|
1733
|
+
function Dt() {
|
|
1734
|
+
if (C && C.isConnected) return C;
|
|
1735
|
+
et();
|
|
1736
|
+
const e = document.createElement("button");
|
|
1737
|
+
return e.type = "button", e.className = "rte-comments-bubble", e.hidden = !0, e.title = `Add a comment (${Rt()})`, e.innerHTML = `${M("addComment")}<span>Comment</span>`, e.addEventListener("mousedown", (t) => t.preventDefault()), e.addEventListener("click", () => {
|
|
1738
|
+
const t = P;
|
|
1739
|
+
E(), t && pe(t);
|
|
1740
|
+
}), document.body.appendChild(e), C = e, e;
|
|
1741
|
+
}
|
|
1742
|
+
function $t() {
|
|
1743
|
+
var u, c, m;
|
|
1744
|
+
if (oe = null, ie) return E();
|
|
1745
|
+
const e = window.getSelection();
|
|
1746
|
+
if (!e || e.rangeCount === 0 || e.isCollapsed) return E();
|
|
1747
|
+
const t = e.getRangeAt(0), n = x(t.commonAncestorContainer);
|
|
1748
|
+
if (!n || !J(t, n) || !Xe(n) || (u = V(n)) != null && u.closest('[contenteditable="false"]') || !t.toString().trim()) return E();
|
|
1749
|
+
const r = (c = t.getClientRects) == null ? void 0 : c.call(t), o = r && r.length ? r[r.length - 1] : (m = t.getBoundingClientRect) == null ? void 0 : m.call(t);
|
|
1750
|
+
if (!o || !o.width && !o.height) return E();
|
|
1751
|
+
const i = Dt();
|
|
1752
|
+
i.hidden = !1, P = n;
|
|
1753
|
+
const a = i.offsetWidth || 96, s = i.offsetHeight || 32;
|
|
1754
|
+
let l = o.bottom + 8;
|
|
1755
|
+
l + s > window.innerHeight - 8 && (l = Math.max(8, (r && r.length ? r[0] : o).top - s - 8));
|
|
1756
|
+
const d = Math.min(Math.max(8, o.right - a), Math.max(8, window.innerWidth - a - 8));
|
|
1757
|
+
i.style.top = `${l}px`, i.style.left = `${d}px`;
|
|
1758
|
+
}
|
|
1759
|
+
function j() {
|
|
1760
|
+
oe === null && (oe = window.setTimeout($t, 40));
|
|
1761
|
+
}
|
|
1762
|
+
function fe() {
|
|
1763
|
+
document.querySelectorAll("[data-editora-editor], .rte-editor, .editora-editor").forEach((e) => {
|
|
1764
|
+
const t = x(e);
|
|
1765
|
+
if (!t) return;
|
|
1766
|
+
const n = v.get(t);
|
|
1767
|
+
if (n) {
|
|
1768
|
+
se(n), !n.instance && y.length && Z(n, y[0], !0);
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
t.querySelector('[data-command="addComment"]') && k(t);
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
let te = null;
|
|
1775
|
+
function Ot() {
|
|
1776
|
+
te === null && (te = window.setTimeout(() => {
|
|
1777
|
+
te = null, fe();
|
|
1778
|
+
}, 50));
|
|
1779
|
+
}
|
|
1780
|
+
function L() {
|
|
1781
|
+
if (ye) return;
|
|
1782
|
+
ye = !0, document.addEventListener("focusin", (t) => {
|
|
1783
|
+
const n = x(t.target);
|
|
1784
|
+
n && (A = n);
|
|
1785
|
+
}), document.addEventListener("click", (t) => {
|
|
1786
|
+
const n = t.target instanceof Element ? t.target : null, r = n == null ? void 0 : n.closest(".rte-comment-anchor");
|
|
1787
|
+
if (!r) return;
|
|
1788
|
+
const o = x(r), i = o ? v.get(o) : null, a = r.getAttribute("data-comment-id");
|
|
1789
|
+
!i || !a || !i.comments.has(a) || (t.preventDefault(), t.stopPropagation(), A = i.root, Q(i, !0), Ke(i, a));
|
|
1790
|
+
}), document.addEventListener("input", (t) => {
|
|
1791
|
+
const n = t.target instanceof Element ? t.target : null;
|
|
1792
|
+
if (!n || n.closest(".rte-comments-panel")) return;
|
|
1793
|
+
const r = x(n), o = r ? v.get(r) : null;
|
|
1794
|
+
o && de(o);
|
|
1795
|
+
}), fe(), typeof MutationObserver != "undefined" && new MutationObserver((t) => {
|
|
1796
|
+
for (const n of t)
|
|
1797
|
+
for (const r of Array.from(n.addedNodes))
|
|
1798
|
+
if (r.nodeType === 1) {
|
|
1799
|
+
Ot();
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
}).observe(document.documentElement, { childList: !0, subtree: !0 }), document.addEventListener("selectionchange", () => {
|
|
1803
|
+
const t = window.getSelection();
|
|
1804
|
+
if (!t || t.rangeCount === 0) return;
|
|
1805
|
+
const n = t.getRangeAt(0), r = x(n.commonAncestorContainer);
|
|
1806
|
+
if (!r) return;
|
|
1807
|
+
A = r;
|
|
1808
|
+
const o = v.get(r);
|
|
1809
|
+
!o || !J(n, r) || (o.savedSelection = t.isCollapsed ? null : n.cloneRange());
|
|
1810
|
+
}), document.addEventListener("selectionchange", j), document.addEventListener(
|
|
1811
|
+
"pointerdown",
|
|
1812
|
+
(t) => {
|
|
1813
|
+
t.target instanceof Node && (C != null && C.contains(t.target)) || (ie = !0, E());
|
|
1814
|
+
},
|
|
1815
|
+
!0
|
|
1816
|
+
);
|
|
1817
|
+
const e = () => {
|
|
1818
|
+
ie = !1, j();
|
|
1819
|
+
};
|
|
1820
|
+
document.addEventListener("pointerup", e, !0), document.addEventListener("pointercancel", e, !0), document.addEventListener("scroll", () => P && j(), !0), window.addEventListener("resize", () => P && j()), document.addEventListener(
|
|
1821
|
+
"keydown",
|
|
1822
|
+
(t) => {
|
|
1823
|
+
if (t.code !== "KeyM" || !t.altKey || t.shiftKey || !(t.metaKey || t.ctrlKey)) return;
|
|
1824
|
+
const n = t.target instanceof Node ? x(t.target) : null;
|
|
1825
|
+
!n || !Xe(n) || (t.preventDefault(), t.stopPropagation(), pe(n));
|
|
1826
|
+
},
|
|
1827
|
+
!0
|
|
1828
|
+
), document.addEventListener(
|
|
1829
|
+
"keydown",
|
|
1830
|
+
(t) => {
|
|
1831
|
+
var i;
|
|
1832
|
+
if (t.key !== "Escape") return;
|
|
1833
|
+
const n = t.target instanceof Node ? x(t.target) : null, r = n ? v.get(n) : null;
|
|
1834
|
+
if (!r || !r.panelVisible) return;
|
|
1835
|
+
if (r.closeMenu) {
|
|
1836
|
+
t.preventDefault(), t.stopPropagation(), r.closeMenu(!0);
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
const o = t.target instanceof HTMLTextAreaElement && ((i = r.panelElement) != null && i.contains(t.target)) ? t.target : null;
|
|
1840
|
+
if (o != null && o.classList.contains("new-comment-textarea")) {
|
|
1841
|
+
t.preventDefault(), t.stopPropagation(), Ge(r);
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1844
|
+
if (o != null && o.classList.contains("rte-comment-edit-textarea")) {
|
|
1845
|
+
t.preventDefault(), t.stopPropagation(), ue(r);
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
if (o != null && o.classList.contains("rte-comment-reply-textarea") && o.value) {
|
|
1849
|
+
t.preventDefault(), t.stopPropagation(), delete r.replyTexts[o.dataset.commentId || ""], o.value = "", o.dispatchEvent(new Event("input"));
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
t.preventDefault(), t.stopPropagation(), Ve(r);
|
|
1853
|
+
},
|
|
1854
|
+
!0
|
|
1855
|
+
);
|
|
1856
|
+
}
|
|
1857
|
+
function Kt() {
|
|
1858
|
+
const e = S();
|
|
1859
|
+
return e ? _e(e) : [];
|
|
1860
|
+
}
|
|
1861
|
+
function Je(e, t, n, r) {
|
|
1862
|
+
var u;
|
|
1863
|
+
const o = n.trim();
|
|
1864
|
+
if (!o) return "";
|
|
1865
|
+
if (!r) {
|
|
1866
|
+
const c = H("comment");
|
|
1867
|
+
return e.comments.set(c, {
|
|
1868
|
+
id: c,
|
|
1869
|
+
anchorId: "",
|
|
1870
|
+
selectedText: "",
|
|
1871
|
+
author: t,
|
|
1872
|
+
text: o,
|
|
1873
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1874
|
+
resolved: !1,
|
|
1875
|
+
replies: [],
|
|
1876
|
+
aligned: !0
|
|
1877
|
+
}), p(e), g(e, "create", c), c;
|
|
1878
|
+
}
|
|
1879
|
+
if (!J(r, e.root)) return "";
|
|
1880
|
+
const i = r.toString().trim();
|
|
1881
|
+
if (!i) return "";
|
|
1882
|
+
const a = H("comment"), s = H("comment-anchor"), l = document.createElement("span");
|
|
1883
|
+
return l.id = s, l.className = "rte-comment-anchor", l.setAttribute("data-comment-id", a), l.setAttribute("title", "Commented text"), U(e, () => {
|
|
1884
|
+
var c;
|
|
1885
|
+
try {
|
|
1886
|
+
const m = r.cloneRange(), f = m.extractContents();
|
|
1887
|
+
return (c = f.textContent) != null && c.trim() ? (l.appendChild(f), m.insertNode(l), !0) : !1;
|
|
1888
|
+
} catch (m) {
|
|
1889
|
+
return !1;
|
|
1890
|
+
}
|
|
1891
|
+
}) ? (e.comments.set(a, {
|
|
1892
|
+
id: a,
|
|
1893
|
+
anchorId: s,
|
|
1894
|
+
selectedText: i,
|
|
1895
|
+
author: t,
|
|
1896
|
+
text: o,
|
|
1897
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1898
|
+
resolved: !1,
|
|
1899
|
+
replies: [],
|
|
1900
|
+
aligned: !0
|
|
1901
|
+
}), e.savedSelection = null, (u = window.getSelection()) == null || u.removeAllRanges(), p(e), g(e, "create", a), a) : "";
|
|
1902
|
+
}
|
|
1903
|
+
function jt(e, t, n = !1) {
|
|
1904
|
+
var i;
|
|
1905
|
+
const r = S();
|
|
1906
|
+
if (!r) return "";
|
|
1907
|
+
const o = n ? null : r.savedSelection || Be(r.root);
|
|
1908
|
+
return !n && !o ? "" : Je(r, (i = T(e)) != null ? i : R(r), t, o);
|
|
1909
|
+
}
|
|
1910
|
+
function zt(e, t) {
|
|
1911
|
+
var o;
|
|
1912
|
+
const n = S();
|
|
1913
|
+
if (!n) return;
|
|
1914
|
+
const r = n.comments.get(e);
|
|
1915
|
+
r && (r.resolved = !0, r.resolvedBy = (o = T(t)) != null ? o : R(n), r.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), U(n, () => Ue(n, r)), p(n), g(n, "resolve", e));
|
|
1916
|
+
}
|
|
1917
|
+
function qt(e) {
|
|
1918
|
+
const t = S();
|
|
1919
|
+
if (!t) return;
|
|
1920
|
+
const n = t.comments.get(e);
|
|
1921
|
+
n && (n.resolved = !1, n.resolvedBy = void 0, n.resolvedAt = void 0, U(t, () => Ue(t, n)), p(t), g(t, "reopen", e));
|
|
1922
|
+
}
|
|
1923
|
+
function Qe(e, t) {
|
|
1924
|
+
var o;
|
|
1925
|
+
const n = e.comments.get(t);
|
|
1926
|
+
if (!n) return null;
|
|
1927
|
+
e.activeId === t && N(e, null), e.hoverId === t && (e.hoverId = null), ((o = e.editing) == null ? void 0 : o.commentId) === t && (e.editing = null, e.editDraft = "");
|
|
1928
|
+
let r = null;
|
|
1929
|
+
if (n.anchorId) {
|
|
1930
|
+
const i = O(e, n);
|
|
1931
|
+
if (i) {
|
|
1932
|
+
const a = Array.from(i.childNodes), s = Array.from(i.attributes).map((l) => [l.name, l.value]);
|
|
1933
|
+
U(e, () => yt(i)), n.deleted = !0, r = {
|
|
1934
|
+
message: "Comment deleted",
|
|
1935
|
+
undo: () => {
|
|
1936
|
+
if (O(e, n)) return !0;
|
|
1937
|
+
const l = a[0], d = l == null ? void 0 : l.parentNode;
|
|
1938
|
+
if (!(!!l && l.isConnected && !!d && a.every((m, f) => m.parentNode === d && (f === 0 || a[f - 1].nextSibling === m))) || !l || !d) return !1;
|
|
1939
|
+
const c = document.createElement("span");
|
|
1940
|
+
return s.forEach(([m, f]) => c.setAttribute(m, f)), U(e, () => {
|
|
1941
|
+
d.insertBefore(c, l), a.forEach((m) => c.appendChild(m));
|
|
1942
|
+
}), n.deleted = !1, p(e), g(e, "create", n.id), !0;
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
} else {
|
|
1947
|
+
e.comments.delete(t), e.expandedReplies.delete(t);
|
|
1948
|
+
const i = e.replyTexts[t];
|
|
1949
|
+
delete e.replyTexts[t], r = {
|
|
1950
|
+
message: "Note deleted",
|
|
1951
|
+
undo: () => (e.comments.set(t, n), i && (e.replyTexts[t] = i), p(e), g(e, "create", t), !0)
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
return p(e), g(e, "delete", t), r;
|
|
1955
|
+
}
|
|
1956
|
+
function Ht(e, t) {
|
|
1957
|
+
const n = Qe(e, t);
|
|
1958
|
+
n && je(e, n);
|
|
1959
|
+
}
|
|
1960
|
+
function Bt(e, t, n) {
|
|
1961
|
+
var a;
|
|
1962
|
+
const r = e.comments.get(t), o = r ? r.replies.findIndex((s) => s.id === n) : -1;
|
|
1963
|
+
if (!r || o === -1) return;
|
|
1964
|
+
const [i] = r.replies.splice(o, 1);
|
|
1965
|
+
((a = e.editing) == null ? void 0 : a.replyId) === n && (e.editing = null, e.editDraft = ""), p(e), g(e, "delete", t), je(e, {
|
|
1966
|
+
message: "Reply deleted",
|
|
1967
|
+
undo: () => (r.replies.splice(Math.min(o, r.replies.length), 0, i), p(e), g(e, "reply", t), !0)
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
function Wt(e) {
|
|
1971
|
+
const t = S();
|
|
1972
|
+
t && Qe(t, e);
|
|
1973
|
+
}
|
|
1974
|
+
function Yt(e, t) {
|
|
1975
|
+
const n = S(), r = n == null ? void 0 : n.comments.get(e), o = t.trim();
|
|
1976
|
+
!n || !r || !o || r.text === o || (r.text = o, r.editedAt = (/* @__PURE__ */ new Date()).toISOString(), p(n), g(n, "edit", e));
|
|
1977
|
+
}
|
|
1978
|
+
function Ut(e, t, n) {
|
|
1979
|
+
var a;
|
|
1980
|
+
const r = S();
|
|
1981
|
+
if (!r) return;
|
|
1982
|
+
const o = r.comments.get(e);
|
|
1983
|
+
if (!o) return;
|
|
1984
|
+
const i = n.trim();
|
|
1985
|
+
i && (o.replies.push({
|
|
1986
|
+
id: H("reply"),
|
|
1987
|
+
author: (a = T(t)) != null ? a : R(r),
|
|
1988
|
+
text: i,
|
|
1989
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1990
|
+
}), p(r), g(r, "reply", e));
|
|
1991
|
+
}
|
|
1992
|
+
function Gt(e, t) {
|
|
1993
|
+
const n = S();
|
|
1994
|
+
n && I(n, e, t);
|
|
1995
|
+
}
|
|
1996
|
+
function et() {
|
|
1997
|
+
if (document.getElementById(xe)) return;
|
|
1998
|
+
const e = document.createElement("style");
|
|
1999
|
+
e.id = xe, e.textContent = lt, document.head.appendChild(e);
|
|
2000
|
+
}
|
|
2001
|
+
const Pt = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor";
|
|
2002
|
+
function z(e) {
|
|
2003
|
+
return e instanceof Element ? e.closest(Pt) : null;
|
|
2004
|
+
}
|
|
2005
|
+
function Zt(e) {
|
|
2006
|
+
const t = z(e), n = t ? v.get(t) : null;
|
|
2007
|
+
return n ? qe(n) : [];
|
|
2008
|
+
}
|
|
2009
|
+
function Xt(e, t) {
|
|
2010
|
+
const n = z(e);
|
|
2011
|
+
n && (L(), He(k(n), t));
|
|
2012
|
+
}
|
|
2013
|
+
function Jt(e, t) {
|
|
2014
|
+
const n = z(e);
|
|
2015
|
+
return n ? (L(), bt(k(n), t)) : !1;
|
|
2016
|
+
}
|
|
2017
|
+
function Qt(e, t) {
|
|
2018
|
+
const n = z(e), r = n ? v.get(n) : null;
|
|
2019
|
+
return r ? xt(r, t) : !1;
|
|
2020
|
+
}
|
|
2021
|
+
function en(e, t) {
|
|
2022
|
+
const n = z(e);
|
|
2023
|
+
if (!n) return;
|
|
2024
|
+
L();
|
|
2025
|
+
const r = { options: t, initialApplied: !1 };
|
|
2026
|
+
Oe(r);
|
|
2027
|
+
const o = k(n, r);
|
|
2028
|
+
o.instance !== r && Z(o, r, !1);
|
|
2029
|
+
}
|
|
2030
|
+
function Re(e, t) {
|
|
2031
|
+
mt(t);
|
|
2032
|
+
const n = $e();
|
|
2033
|
+
return n ? (A = n, k(n, e)) : null;
|
|
2034
|
+
}
|
|
2035
|
+
const tn = (e = {}) => {
|
|
2036
|
+
const t = { options: e || {}, initialApplied: !1 };
|
|
2037
|
+
return typeof document != "undefined" && (pt(t), L(), fe()), Vt(t);
|
|
2038
|
+
}, Vt = (e) => ({
|
|
2039
|
+
name: "comments",
|
|
2040
|
+
toolbar: [
|
|
2041
|
+
{
|
|
2042
|
+
label: "Add Comment",
|
|
2043
|
+
command: "addComment",
|
|
2044
|
+
type: "button",
|
|
2045
|
+
// The upstream SVGRepo export used a class-based <style> block for the
|
|
2046
|
+
// transparent bounding rect (`.cls-1{fill:none}`). That's fine when an
|
|
2047
|
+
// icon is scoped (shadow DOM, or one icon per page) but this markup is
|
|
2048
|
+
// inserted via raw innerHTML into plain light-DOM content alongside
|
|
2049
|
+
// every other plugin's icons, so the <style> tag applies document-wide
|
|
2050
|
+
// - any other icon reusing the same auto-generated class name would
|
|
2051
|
+
// collide with it. Inlined the one declaration it held (fill="none")
|
|
2052
|
+
// directly on the rect instead, so there's nothing to leak.
|
|
2053
|
+
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><title>add-comment</title><path d="M17.74,30,16,29l4-7h6a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2H6A2,2,0,0,0,4,8V20a2,2,0,0,0,2,2h9v2H6a4,4,0,0,1-4-4V8A4,4,0,0,1,6,4H26a4,4,0,0,1,4,4V20a4,4,0,0,1-4,4H21.16Z"></path><polygon points="17 9 15 9 15 13 11 13 11 15 15 15 15 19 17 19 17 15 21 15 21 13 17 13 17 9"></polygon><rect fill="none" width="32" height="32"></rect></svg>'
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
label: "Show / Hide Comments",
|
|
2057
|
+
command: "toggleComments",
|
|
2058
|
+
type: "button",
|
|
2059
|
+
icon: '<svg width="24px" height="24px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 1H4V11H8L10 13L12 11H16V1Z" fill="#000000"></path><path d="M2 5V13H7.17157L8.70711 14.5355L7.29289 15.9497L6.34315 15H0V5H2Z" fill="#000000"></path></svg>'
|
|
2060
|
+
}
|
|
2061
|
+
],
|
|
2062
|
+
commands: {
|
|
2063
|
+
addComment: (t, n) => {
|
|
2064
|
+
L();
|
|
2065
|
+
const r = Re(e, n);
|
|
2066
|
+
return r ? (pe(r.root), !0) : !1;
|
|
2067
|
+
},
|
|
2068
|
+
toggleComments: (t, n) => {
|
|
2069
|
+
L();
|
|
2070
|
+
const r = Re(e, n);
|
|
2071
|
+
return r ? (Q(r, !r.panelVisible), !0) : !1;
|
|
2072
|
+
}
|
|
2073
|
+
},
|
|
2074
|
+
// The web component calls this with the editor that owns the plugin, which is the one sure way to tell.
|
|
2075
|
+
init(t) {
|
|
2076
|
+
const n = z(t == null ? void 0 : t.editorElement);
|
|
2077
|
+
n && (L(), k(n, e));
|
|
2078
|
+
},
|
|
2079
|
+
destroy() {
|
|
2080
|
+
const t = y.indexOf(e);
|
|
2081
|
+
t !== -1 && y.splice(t, 1), re === e && (ce = null, re = null);
|
|
2082
|
+
},
|
|
2083
|
+
keymap: {}
|
|
2084
|
+
});
|
|
2085
|
+
export {
|
|
2086
|
+
tn as CommentsPlugin,
|
|
2087
|
+
jt as addCommentCommand,
|
|
2088
|
+
en as configureComments,
|
|
2089
|
+
Wt as deleteComment,
|
|
2090
|
+
Yt as editComment,
|
|
2091
|
+
Kt as getAllComments,
|
|
2092
|
+
Zt as getCommentThreads,
|
|
2093
|
+
Gt as highlightComment,
|
|
2094
|
+
Qt as removeCommentThread,
|
|
2095
|
+
qt as reopenComment,
|
|
2096
|
+
Ut as replyToComment,
|
|
2097
|
+
zt as resolveComment,
|
|
2098
|
+
Xt as setCommentThreads,
|
|
2099
|
+
Jt as upsertCommentThread
|
|
2100
|
+
};
|
|
2101
|
+
//# sourceMappingURL=CommentsPlugin.native-CxdTwTGE.mjs.map
|