@editora/plugins 1.1.0 → 1.2.1
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/comments.cjs.js +813 -340
- package/dist/comments.esm.js +1910 -654
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +48 -43
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +56 -51
- package/dist/plugins.css +1 -1
- package/dist/table.cjs.js +3 -3
- package/dist/table.esm.js +154 -154
- package/index.d.ts +63 -1
- package/package.json +1 -1
package/dist/comments.cjs.js
CHANGED
|
@@ -1,366 +1,839 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ne=require("./dialogHelpers-BxSQ7A6M.js"),Ze=require("./historyHelpers-Cu8Pk7m1.js"),j=60,W=60*j,V=24*W;function le(e,t=Date.now(),n){const r=new Date(e).getTime();if(Number.isNaN(r))return"";const o=Math.round((r-t)/1e3),i=Math.abs(o);let a=null;try{a=new Intl.RelativeTimeFormat(n,{numeric:"auto",style:"short"})}catch{a=null}if(i<j)return a?a.format(0,"second"):"now";if(i<W)return a?a.format(Math.round(o/j),"minute"):`${Math.round(i/j)}m ago`;if(i<V)return a?a.format(Math.round(o/W),"hour"):`${Math.round(i/W)}h ago`;if(i<7*V)return a?a.format(Math.round(o/V),"day"):`${Math.round(i/V)}d ago`;const d=new Date(r),l=d.getFullYear()===new Date(t).getFullYear();return d.toLocaleDateString(n,{month:"short",day:"numeric",year:l?void 0:"numeric"})}function Re(e,t){const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleString(t,{dateStyle:"medium",timeStyle:"short"})}function Xe(e){const t=e.trim().split(/\s+/).filter(Boolean);if(t.length===0)return"?";const n=Array.from(t[0])[0]??"",r=t.length>1?Array.from(t[t.length-1])[0]??"":"";return(n+r).toUpperCase()||"?"}const ge=["hsl(215 55% 36%)","hsl(262 45% 45%)","hsl(330 52% 40%)","hsl(8 58% 40%)","hsl(28 70% 32%)","hsl(150 55% 28%)","hsl(180 60% 27%)","hsl(240 40% 48%)"];function Je(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return ge[t%ge.length]}const be="rte-comments-panel-styles",Qe=`
|
|
2
|
+
.rte-comments-panel,
|
|
3
|
+
.rte-comments-panel * {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.rte-comments-panel {
|
|
8
|
+
--rte-comments-panel-width: min(340px, 42vw);
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
width: var(--rte-comments-panel-width);
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
17
|
+
color: var(--rte-color-text-primary, #111827);
|
|
18
|
+
border-left: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
19
|
+
box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
line-height: 1.45;
|
|
22
|
+
transform: translateX(100%);
|
|
23
|
+
opacity: 0;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
transition: transform 180ms ease, opacity 180ms ease;
|
|
26
|
+
/* Above the editor's sticky toolbar (z-index 100): on a narrow screen the panel lies over the editor, and
|
|
27
|
+
under the toolbar its header, and the button that closes it, could not be clicked. */
|
|
28
|
+
z-index: 110;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.rte-comments-panel.is-open {
|
|
32
|
+
transform: translateX(0);
|
|
33
|
+
opacity: 1;
|
|
34
|
+
pointer-events: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* The panel's width is set on the editor itself, not only on the panel: the toolbar and the text make room for the
|
|
38
|
+
panel with a margin of that width, and a variable set on the panel is not visible to them (the margin was
|
|
39
|
+
silently 0, so the panel lay over the toolbar and the text and its header could not be reached). */
|
|
40
|
+
[data-rte-comments-open="true"] {
|
|
41
|
+
--rte-comments-panel-width: min(340px, 42vw);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* The toolbar's wrapper is the element that is as wide as the editor, and it sits above the panel (it is sticky,
|
|
45
|
+
z-index 100): it has to give up the panel's width too, or its empty right-hand end covers the panel's header. */
|
|
46
|
+
[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) {
|
|
47
|
+
margin-right: var(--rte-comments-panel-width);
|
|
48
|
+
transition: margin-right 180ms ease;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rte-comments-panel :is(button, textarea, [role="tab"]):focus-visible {
|
|
52
|
+
outline: 2px solid var(--rte-color-border-focus, #2563eb);
|
|
53
|
+
outline-offset: 1px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ---- Header and tabs ---- */
|
|
57
|
+
|
|
58
|
+
.rte-comments-header {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
gap: 8px;
|
|
63
|
+
padding: 12px 12px 8px 16px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rte-comments-title {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.rte-comments-title h3 {
|
|
74
|
+
margin: 0;
|
|
75
|
+
font-size: 15px;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
line-height: 1.3;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.rte-comments-count {
|
|
81
|
+
min-width: 20px;
|
|
82
|
+
padding: 0 6px;
|
|
83
|
+
border-radius: 999px;
|
|
84
|
+
background: var(--rte-color-bg-tertiary, #e2e8f0);
|
|
85
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
86
|
+
font-size: 11px;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
line-height: 20px;
|
|
89
|
+
text-align: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.rte-comments-header-actions {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 4px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rte-comments-tabs {
|
|
99
|
+
display: flex;
|
|
100
|
+
gap: 2px;
|
|
101
|
+
margin: 0 16px;
|
|
102
|
+
padding: 2px;
|
|
103
|
+
border-radius: 8px;
|
|
104
|
+
background: var(--rte-color-bg-tertiary, #eef2f6);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.rte-comments-tab {
|
|
108
|
+
flex: 1;
|
|
109
|
+
border: 0;
|
|
110
|
+
border-radius: 6px;
|
|
111
|
+
padding: 5px 8px;
|
|
112
|
+
background: transparent;
|
|
113
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
114
|
+
font: inherit;
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
font-weight: 500;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.rte-comments-tab:hover {
|
|
121
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.rte-comments-tab[aria-selected="true"] {
|
|
125
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
126
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
127
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.rte-comments-tab-count {
|
|
131
|
+
margin-left: 4px;
|
|
132
|
+
font-weight: 400;
|
|
133
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.rte-comments-body {
|
|
137
|
+
flex: 1;
|
|
138
|
+
min-height: 0;
|
|
139
|
+
overflow-y: auto;
|
|
140
|
+
padding: 12px 12px 16px;
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
gap: 10px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* ---- Buttons ---- */
|
|
147
|
+
|
|
148
|
+
.rte-comment-icon-btn,
|
|
149
|
+
.rte-comments-new,
|
|
150
|
+
.rte-comments-close {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
gap: 6px;
|
|
155
|
+
border: 0;
|
|
156
|
+
border-radius: 6px;
|
|
157
|
+
background: transparent;
|
|
158
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
159
|
+
font: inherit;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.rte-comment-icon-btn,
|
|
164
|
+
.rte-comments-close {
|
|
165
|
+
width: 28px;
|
|
166
|
+
height: 28px;
|
|
167
|
+
padding: 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.rte-comments-new {
|
|
171
|
+
height: 28px;
|
|
172
|
+
padding: 0 10px 0 8px;
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
font-weight: 500;
|
|
175
|
+
color: var(--rte-color-primary, #2563eb);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.rte-comment-icon-btn:hover,
|
|
179
|
+
.rte-comments-new:hover,
|
|
180
|
+
.rte-comments-close:hover {
|
|
181
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
182
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Not the grey hover of the other buttons: the primary colour on that grey is below 4.5:1 in the dark theme. */
|
|
186
|
+
.rte-comments-new:hover {
|
|
187
|
+
background: color-mix(in srgb, var(--rte-color-primary, #2563eb) 12%, transparent);
|
|
188
|
+
color: var(--rte-color-primary, #2563eb);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.rte-comment-icon-btn[data-action="resolve"]:hover {
|
|
192
|
+
background: color-mix(in srgb, var(--rte-color-success, #15803d) 14%, transparent);
|
|
193
|
+
color: var(--rte-color-success, #15803d);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.rte-comment-icon-btn svg,
|
|
197
|
+
.rte-comments-new svg,
|
|
198
|
+
.rte-comments-close svg {
|
|
199
|
+
width: 16px;
|
|
200
|
+
height: 16px;
|
|
201
|
+
flex: none;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.rte-comment-btn {
|
|
205
|
+
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
206
|
+
border-radius: 7px;
|
|
207
|
+
padding: 5px 12px;
|
|
208
|
+
font: inherit;
|
|
209
|
+
font-size: 12px;
|
|
210
|
+
font-weight: 500;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
213
|
+
color: var(--rte-color-text-secondary, #334155);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.rte-comment-btn:hover {
|
|
217
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
218
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.rte-comment-btn.ghost {
|
|
222
|
+
border-color: transparent;
|
|
223
|
+
background: transparent;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.rte-comment-btn.primary {
|
|
227
|
+
border-color: var(--rte-color-primary, #2563eb);
|
|
228
|
+
background: var(--rte-color-primary, #2563eb);
|
|
229
|
+
color: var(--rte-color-text-inverse, #ffffff);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.rte-comment-btn.primary:hover {
|
|
233
|
+
background: var(--rte-color-primary-hover, #1d4ed8);
|
|
234
|
+
border-color: var(--rte-color-primary-hover, #1d4ed8);
|
|
235
|
+
color: var(--rte-color-text-inverse, #ffffff);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.rte-comment-btn:disabled,
|
|
239
|
+
.rte-comment-btn.primary:disabled {
|
|
240
|
+
border-color: var(--rte-color-border-light, #e2e8f0);
|
|
241
|
+
background: var(--rte-color-bg-tertiary, #e2e8f0);
|
|
242
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
243
|
+
cursor: not-allowed;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* ---- Cards (a thread, and the form for a new comment) ---- */
|
|
247
|
+
|
|
248
|
+
.rte-comment-item,
|
|
249
|
+
.rte-comment-composer {
|
|
250
|
+
border: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
251
|
+
border-radius: 10px;
|
|
252
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
253
|
+
padding: 12px;
|
|
254
|
+
transition: border-color 120ms ease, box-shadow 120ms ease;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.rte-comment-item:hover {
|
|
258
|
+
border-color: var(--rte-color-border, #cbd5e1);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.rte-comment-item.is-active,
|
|
262
|
+
.rte-comment-composer {
|
|
263
|
+
border-color: var(--rte-color-primary, #2563eb);
|
|
264
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--rte-color-primary, #2563eb) 14%, transparent);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.rte-comment-item.resolved .rte-comment-text,
|
|
268
|
+
.rte-comment-item.resolved .rte-comment-selection {
|
|
269
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.rte-comment-header,
|
|
273
|
+
.rte-comment-reply-header {
|
|
274
|
+
display: flex;
|
|
275
|
+
align-items: center;
|
|
276
|
+
gap: 8px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.rte-comment-avatar {
|
|
280
|
+
flex: none;
|
|
281
|
+
width: 28px;
|
|
282
|
+
height: 28px;
|
|
283
|
+
border-radius: 50%;
|
|
284
|
+
color: #ffffff;
|
|
285
|
+
font-size: 11px;
|
|
286
|
+
font-weight: 600;
|
|
287
|
+
line-height: 28px;
|
|
288
|
+
text-align: center;
|
|
289
|
+
user-select: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.rte-comment-avatar {
|
|
293
|
+
position: relative;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* The picture covers the initials; if it fails to load it is removed and the initials show. */
|
|
298
|
+
.rte-comment-avatar img {
|
|
299
|
+
position: absolute;
|
|
300
|
+
inset: 0;
|
|
301
|
+
width: 100%;
|
|
302
|
+
height: 100%;
|
|
303
|
+
object-fit: cover;
|
|
304
|
+
border-radius: 50%;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.rte-comment-avatar.small {
|
|
308
|
+
width: 22px;
|
|
309
|
+
height: 22px;
|
|
310
|
+
font-size: 9px;
|
|
311
|
+
line-height: 22px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.rte-comment-meta {
|
|
315
|
+
flex: 1;
|
|
316
|
+
min-width: 0;
|
|
317
|
+
display: flex;
|
|
318
|
+
flex-direction: column;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.rte-comment-author {
|
|
322
|
+
overflow: hidden;
|
|
323
|
+
text-overflow: ellipsis;
|
|
324
|
+
white-space: nowrap;
|
|
325
|
+
font-size: 13px;
|
|
326
|
+
font-weight: 600;
|
|
327
|
+
line-height: 1.3;
|
|
328
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.rte-comment-when {
|
|
332
|
+
display: flex;
|
|
333
|
+
align-items: baseline;
|
|
334
|
+
gap: 4px;
|
|
335
|
+
font-size: 11px;
|
|
336
|
+
line-height: 1.3;
|
|
337
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.rte-comment-date {
|
|
341
|
+
font-size: 11px;
|
|
342
|
+
line-height: 1.3;
|
|
343
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.rte-comment-header-actions {
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
gap: 2px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.rte-comment-more {
|
|
353
|
+
position: relative;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.rte-comment-menu {
|
|
357
|
+
position: absolute;
|
|
358
|
+
top: calc(100% + 4px);
|
|
359
|
+
right: 0;
|
|
360
|
+
z-index: 2;
|
|
361
|
+
min-width: 140px;
|
|
362
|
+
padding: 4px;
|
|
363
|
+
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
364
|
+
border-radius: 8px;
|
|
365
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
366
|
+
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.rte-comment-menu[hidden] {
|
|
370
|
+
display: none;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.rte-comment-menu-item {
|
|
374
|
+
display: flex;
|
|
375
|
+
align-items: center;
|
|
376
|
+
gap: 8px;
|
|
377
|
+
width: 100%;
|
|
378
|
+
border: 0;
|
|
379
|
+
border-radius: 6px;
|
|
380
|
+
padding: 6px 8px;
|
|
381
|
+
background: transparent;
|
|
382
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
383
|
+
font: inherit;
|
|
384
|
+
font-size: 13px;
|
|
385
|
+
text-align: left;
|
|
386
|
+
cursor: pointer;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.rte-comment-menu-item svg {
|
|
390
|
+
width: 15px;
|
|
391
|
+
height: 15px;
|
|
392
|
+
flex: none;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.rte-comment-menu-item:hover,
|
|
396
|
+
.rte-comment-menu-item:focus-visible {
|
|
397
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.rte-comment-menu-item.danger {
|
|
401
|
+
color: var(--rte-color-danger, #b91c1c);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.rte-comment-menu-item.danger:hover,
|
|
405
|
+
.rte-comment-menu-item.danger:focus-visible {
|
|
406
|
+
background: color-mix(in srgb, var(--rte-color-danger, #b91c1c) 10%, transparent);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* What the comment is about: one line of the quoted text. */
|
|
410
|
+
.rte-comment-selection {
|
|
411
|
+
display: block;
|
|
412
|
+
width: 100%;
|
|
413
|
+
margin: 10px 0 0;
|
|
414
|
+
padding: 4px 8px;
|
|
415
|
+
border: 0;
|
|
416
|
+
border-left: 3px solid var(--rte-color-warning, #d97706);
|
|
417
|
+
border-radius: 0 4px 4px 0;
|
|
418
|
+
background: var(--rte-color-bg-secondary, #f8fafc);
|
|
419
|
+
color: var(--rte-color-text-secondary, #475569);
|
|
420
|
+
font: inherit;
|
|
421
|
+
font-size: 12px;
|
|
422
|
+
text-align: left;
|
|
423
|
+
overflow: hidden;
|
|
424
|
+
text-overflow: ellipsis;
|
|
425
|
+
white-space: nowrap;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
button.rte-comment-selection {
|
|
429
|
+
cursor: pointer;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
button.rte-comment-selection:hover {
|
|
433
|
+
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.rte-comment-text {
|
|
437
|
+
margin-top: 10px;
|
|
438
|
+
font-size: 13px;
|
|
439
|
+
line-height: 1.5;
|
|
440
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
441
|
+
white-space: pre-wrap;
|
|
442
|
+
overflow-wrap: anywhere;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.rte-comment-status {
|
|
446
|
+
display: flex;
|
|
447
|
+
align-items: center;
|
|
448
|
+
gap: 4px;
|
|
449
|
+
margin-top: 8px;
|
|
450
|
+
font-size: 11px;
|
|
451
|
+
color: var(--rte-color-success, #15803d);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.rte-comment-status svg {
|
|
455
|
+
width: 12px;
|
|
456
|
+
height: 12px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/* ---- Replies ---- */
|
|
460
|
+
|
|
461
|
+
.rte-comment-replies {
|
|
462
|
+
display: flex;
|
|
463
|
+
flex-direction: column;
|
|
464
|
+
gap: 12px;
|
|
465
|
+
margin-top: 12px;
|
|
466
|
+
padding-top: 12px;
|
|
467
|
+
border-top: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.rte-comment-reply-header .rte-comment-icon-btn {
|
|
471
|
+
width: 24px;
|
|
472
|
+
height: 24px;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.rte-comment-reply-header .rte-comment-icon-btn svg {
|
|
476
|
+
width: 14px;
|
|
477
|
+
height: 14px;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.rte-comment-reply-text {
|
|
481
|
+
margin: 4px 0 0 30px;
|
|
482
|
+
font-size: 13px;
|
|
483
|
+
line-height: 1.5;
|
|
484
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
485
|
+
white-space: pre-wrap;
|
|
486
|
+
overflow-wrap: anywhere;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.rte-comment-more-replies {
|
|
490
|
+
align-self: flex-start;
|
|
491
|
+
border: 0;
|
|
492
|
+
padding: 0;
|
|
493
|
+
background: transparent;
|
|
494
|
+
color: var(--rte-color-primary, #2563eb);
|
|
495
|
+
font: inherit;
|
|
496
|
+
font-size: 12px;
|
|
497
|
+
font-weight: 500;
|
|
498
|
+
cursor: pointer;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.rte-comment-more-replies:hover {
|
|
502
|
+
text-decoration: underline;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/* ---- Reply box: one line until it is used ---- */
|
|
506
|
+
|
|
507
|
+
.rte-comment-reply-box {
|
|
508
|
+
margin-top: 12px;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.rte-comment-reply .rte-comment-edit {
|
|
512
|
+
margin: 6px 0 0 30px;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.rte-comment-edit {
|
|
516
|
+
margin-top: 10px;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.new-comment-textarea,
|
|
520
|
+
.rte-comment-reply-textarea,
|
|
521
|
+
.rte-comment-edit-textarea {
|
|
522
|
+
display: block;
|
|
523
|
+
width: 100%;
|
|
524
|
+
resize: none;
|
|
525
|
+
min-height: 34px;
|
|
526
|
+
max-height: 160px;
|
|
527
|
+
font: inherit;
|
|
528
|
+
font-size: 13px;
|
|
529
|
+
line-height: 1.45;
|
|
530
|
+
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
531
|
+
border-radius: 8px;
|
|
532
|
+
background: var(--rte-color-bg-primary, #ffffff);
|
|
533
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
534
|
+
padding: 7px 10px;
|
|
535
|
+
outline: none;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.new-comment-textarea {
|
|
539
|
+
min-height: 64px;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.new-comment-textarea::placeholder,
|
|
543
|
+
.rte-comment-reply-textarea::placeholder,
|
|
544
|
+
.rte-comment-edit-textarea::placeholder {
|
|
545
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.new-comment-textarea:focus,
|
|
549
|
+
.rte-comment-reply-textarea:focus,
|
|
550
|
+
.rte-comment-edit-textarea:focus {
|
|
551
|
+
border-color: var(--rte-color-border-focus, #2563eb);
|
|
552
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--rte-color-border-focus, #2563eb) 20%, transparent);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.rte-comment-form-actions {
|
|
556
|
+
display: flex;
|
|
557
|
+
justify-content: flex-end;
|
|
558
|
+
gap: 6px;
|
|
559
|
+
margin-top: 8px;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.rte-comment-reply-box:not(:focus-within):not(.has-text) .rte-comment-form-actions {
|
|
563
|
+
display: none;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/* ---- New comment ---- */
|
|
567
|
+
|
|
568
|
+
.rte-comment-composer .rte-comment-selection {
|
|
569
|
+
margin: 0 0 10px;
|
|
570
|
+
display: flex;
|
|
571
|
+
align-items: center;
|
|
572
|
+
gap: 6px;
|
|
573
|
+
padding-right: 4px;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.rte-comment-composer .rte-comment-selection span {
|
|
577
|
+
flex: 1;
|
|
578
|
+
min-width: 0;
|
|
579
|
+
overflow: hidden;
|
|
580
|
+
text-overflow: ellipsis;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.rte-comment-composer .rte-comment-selection .rte-comment-icon-btn {
|
|
584
|
+
width: 22px;
|
|
585
|
+
height: 22px;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.rte-comment-composer-hint {
|
|
589
|
+
margin: 0 0 8px;
|
|
590
|
+
font-size: 12px;
|
|
591
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.rte-comment-error {
|
|
595
|
+
margin: 8px 0 0;
|
|
596
|
+
font-size: 12px;
|
|
597
|
+
color: var(--rte-color-danger, #b91c1c);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/* ---- Empty state ---- */
|
|
601
|
+
|
|
602
|
+
.rte-comments-empty {
|
|
603
|
+
display: flex;
|
|
604
|
+
flex-direction: column;
|
|
605
|
+
align-items: center;
|
|
606
|
+
gap: 6px;
|
|
607
|
+
padding: 36px 16px;
|
|
608
|
+
text-align: center;
|
|
609
|
+
color: var(--rte-color-text-muted, #64748b);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.rte-comments-empty svg {
|
|
613
|
+
width: 32px;
|
|
614
|
+
height: 32px;
|
|
615
|
+
margin-bottom: 4px;
|
|
616
|
+
opacity: 0.6;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.rte-comments-empty strong {
|
|
620
|
+
font-size: 14px;
|
|
621
|
+
font-weight: 600;
|
|
622
|
+
color: var(--rte-color-text-primary, #0f172a);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.rte-comments-empty p {
|
|
626
|
+
margin: 0;
|
|
627
|
+
max-width: 240px;
|
|
628
|
+
font-size: 12px;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/* ---- "Comment deleted - Undo" ---- */
|
|
632
|
+
|
|
633
|
+
.rte-comments-toast {
|
|
634
|
+
position: absolute;
|
|
635
|
+
left: 12px;
|
|
636
|
+
right: 12px;
|
|
637
|
+
bottom: 12px;
|
|
638
|
+
display: flex;
|
|
639
|
+
align-items: center;
|
|
640
|
+
justify-content: space-between;
|
|
641
|
+
gap: 12px;
|
|
642
|
+
padding: 9px 12px;
|
|
643
|
+
border-radius: 8px;
|
|
644
|
+
background: #1f2937;
|
|
645
|
+
color: #ffffff;
|
|
646
|
+
font-size: 13px;
|
|
647
|
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.rte-comments-toast[hidden] {
|
|
651
|
+
display: none;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.rte-comments-toast-action {
|
|
655
|
+
flex: none;
|
|
656
|
+
border: 0;
|
|
657
|
+
border-radius: 4px;
|
|
658
|
+
padding: 2px 6px;
|
|
659
|
+
background: transparent;
|
|
660
|
+
color: #93c5fd;
|
|
661
|
+
font: inherit;
|
|
662
|
+
font-weight: 600;
|
|
663
|
+
cursor: pointer;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.rte-comments-toast-action:hover {
|
|
667
|
+
text-decoration: underline;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/* ---- The button that appears over selected text ---- */
|
|
671
|
+
|
|
672
|
+
.rte-comments-bubble {
|
|
673
|
+
position: fixed;
|
|
674
|
+
z-index: 1000;
|
|
675
|
+
display: inline-flex;
|
|
676
|
+
align-items: center;
|
|
677
|
+
gap: 6px;
|
|
678
|
+
height: 32px;
|
|
679
|
+
padding: 0 12px 0 10px;
|
|
680
|
+
border: 0;
|
|
681
|
+
border-radius: 999px;
|
|
682
|
+
background: #1f2937;
|
|
683
|
+
color: #ffffff;
|
|
684
|
+
/* It lives on the page, outside the editor, so it must bring its own font: inheriting would show the host page's. */
|
|
685
|
+
font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
|
|
686
|
+
font-size: 13px;
|
|
687
|
+
font-weight: 500;
|
|
688
|
+
line-height: 1;
|
|
689
|
+
cursor: pointer;
|
|
690
|
+
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.rte-comments-bubble[hidden] {
|
|
694
|
+
display: none;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.rte-comments-bubble:hover {
|
|
698
|
+
background: #111827;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.rte-comments-bubble:focus-visible {
|
|
702
|
+
outline: 2px solid #93c5fd;
|
|
703
|
+
outline-offset: 2px;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.rte-comments-bubble svg {
|
|
707
|
+
width: 16px;
|
|
708
|
+
height: 16px;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/* ---- The highlighted text in the document ---- */
|
|
712
|
+
|
|
713
|
+
.rte-comment-anchor {
|
|
714
|
+
background: rgba(250, 204, 21, 0.34);
|
|
715
|
+
border-bottom: 2px solid rgba(217, 119, 6, 0.75);
|
|
716
|
+
border-radius: 2px;
|
|
717
|
+
cursor: pointer;
|
|
718
|
+
transition: outline-color 120ms ease, box-shadow 120ms ease;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.rte-comment-anchor.rte-comment-anchor-resolved {
|
|
722
|
+
background: rgba(148, 163, 184, 0.2);
|
|
723
|
+
border-bottom-color: rgba(100, 116, 139, 0.6);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-comments-panel {
|
|
727
|
+
box-shadow: -10px 0 28px rgba(0, 0, 0, 0.4);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
@media (max-width: 900px) {
|
|
731
|
+
[data-rte-comments-open="true"],
|
|
39
732
|
.rte-comments-panel {
|
|
40
|
-
--rte-comments-panel-width: min(
|
|
41
|
-
position: absolute;
|
|
42
|
-
top: 0;
|
|
43
|
-
right: 0;
|
|
44
|
-
bottom: 0;
|
|
45
|
-
width: var(--rte-comments-panel-width);
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
background: var(--rte-color-bg-primary, #ffffff);
|
|
49
|
-
color: var(--rte-color-text-primary, #111827);
|
|
50
|
-
border-left: 1px solid var(--rte-color-border, #d1d5db);
|
|
51
|
-
box-shadow: -12px 0 28px rgba(15, 23, 42, 0.2);
|
|
52
|
-
transform: translateX(100%);
|
|
53
|
-
opacity: 0;
|
|
54
|
-
pointer-events: none;
|
|
55
|
-
transition: transform 180ms ease, opacity 180ms ease;
|
|
56
|
-
/* Above the editor's sticky toolbar (z-index 100): on a narrow screen the panel lies over the editor, and
|
|
57
|
-
under the toolbar its header, and the button that closes it, could not be clicked. */
|
|
58
|
-
z-index: 110;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.rte-comments-panel.is-open {
|
|
62
|
-
transform: translateX(0);
|
|
63
|
-
opacity: 1;
|
|
64
|
-
pointer-events: auto;
|
|
733
|
+
--rte-comments-panel-width: min(420px, 100%);
|
|
65
734
|
}
|
|
66
735
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
silently 0, so the panel lay over the toolbar and the text and its header could not be reached). */
|
|
70
|
-
[data-rte-comments-open="true"] {
|
|
71
|
-
--rte-comments-panel-width: min(360px, 42vw);
|
|
736
|
+
.rte-comments-panel {
|
|
737
|
+
box-shadow: -12px 0 28px rgba(15, 23, 42, 0.2);
|
|
72
738
|
}
|
|
73
739
|
|
|
74
|
-
/* The toolbar's wrapper is the element that is as wide as the editor, and it sits above the panel (it is sticky,
|
|
75
|
-
z-index 100): it has to give up the panel's width too, or its empty right-hand end covers the panel's header. */
|
|
76
740
|
[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) {
|
|
77
|
-
margin-right:
|
|
78
|
-
transition: margin-right 180ms ease;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.rte-comments-header {
|
|
82
|
-
display: flex;
|
|
83
|
-
justify-content: space-between;
|
|
84
|
-
align-items: flex-start;
|
|
85
|
-
gap: 12px;
|
|
86
|
-
padding: 14px 14px 12px;
|
|
87
|
-
border-bottom: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
88
|
-
background: var(--rte-color-bg-secondary, #f8fafc);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.rte-comments-header h3 {
|
|
92
|
-
margin: 0;
|
|
93
|
-
font-size: 15px;
|
|
94
|
-
line-height: 1.2;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.rte-comments-header p {
|
|
98
|
-
margin: 6px 0 0;
|
|
99
|
-
font-size: 12px;
|
|
100
|
-
color: var(--rte-color-text-muted, #64748b);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.rte-comments-close {
|
|
104
|
-
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
105
|
-
background: transparent;
|
|
106
|
-
color: var(--rte-color-text-secondary, #475569);
|
|
107
|
-
border-radius: 6px;
|
|
108
|
-
width: 30px;
|
|
109
|
-
height: 30px;
|
|
110
|
-
cursor: pointer;
|
|
111
|
-
font-size: 16px;
|
|
112
|
-
line-height: 1;
|
|
741
|
+
margin-right: 0;
|
|
113
742
|
}
|
|
743
|
+
}
|
|
114
744
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
padding: 12px 14px;
|
|
125
|
-
border-bottom: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
126
|
-
background: var(--rte-color-bg-secondary, #f8fafc);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.new-comment-textarea,
|
|
130
|
-
.rte-comment-reply-textarea {
|
|
745
|
+
/* A phone: the panel is a sheet that rises from the bottom, over the page, with the text still above it. */
|
|
746
|
+
@media (max-width: 640px) {
|
|
747
|
+
.rte-comments-panel {
|
|
748
|
+
--rte-comments-panel-width: 100%;
|
|
749
|
+
position: fixed;
|
|
750
|
+
top: auto;
|
|
751
|
+
left: 0;
|
|
752
|
+
right: 0;
|
|
753
|
+
bottom: 0;
|
|
131
754
|
width: 100%;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
color: var(--rte-color-text-primary, #0f172a);
|
|
141
|
-
padding: 8px 10px;
|
|
142
|
-
outline: none;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.new-comment-textarea:focus,
|
|
146
|
-
.rte-comment-reply-textarea:focus {
|
|
147
|
-
border-color: var(--rte-color-border-focus, #2563eb);
|
|
148
|
-
box-shadow: 0 0 0 2px color-mix(in srgb, var(--rte-color-border-focus, #2563eb) 20%, transparent);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.rte-comments-composer-actions {
|
|
152
|
-
display: flex;
|
|
153
|
-
justify-content: flex-end;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.rte-comments-list {
|
|
157
|
-
flex: 1;
|
|
158
|
-
overflow: auto;
|
|
159
|
-
padding: 12px;
|
|
160
|
-
display: flex;
|
|
161
|
-
flex-direction: column;
|
|
162
|
-
gap: 10px;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.rte-comments-empty {
|
|
166
|
-
padding: 18px 14px;
|
|
167
|
-
color: var(--rte-color-text-muted, #64748b);
|
|
168
|
-
font-size: 13px;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.rte-comment-item {
|
|
172
|
-
border: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
173
|
-
border-radius: 10px;
|
|
174
|
-
background: var(--rte-color-bg-primary, #ffffff);
|
|
175
|
-
padding: 10px;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.rte-comment-item.resolved {
|
|
179
|
-
opacity: 0.74;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.rte-comment-header {
|
|
183
|
-
display: flex;
|
|
184
|
-
align-items: flex-start;
|
|
185
|
-
justify-content: space-between;
|
|
186
|
-
gap: 8px;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.rte-comment-meta {
|
|
190
|
-
display: flex;
|
|
191
|
-
flex-direction: column;
|
|
192
|
-
gap: 2px;
|
|
755
|
+
height: min(72vh, 560px);
|
|
756
|
+
border-left: 0;
|
|
757
|
+
border-top: 1px solid var(--rte-color-border, #d1d5db);
|
|
758
|
+
border-radius: 16px 16px 0 0;
|
|
759
|
+
box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.22);
|
|
760
|
+
padding-bottom: env(safe-area-inset-bottom, 0px);
|
|
761
|
+
transform: translateY(100%);
|
|
762
|
+
z-index: 1000;
|
|
193
763
|
}
|
|
194
764
|
|
|
195
|
-
.rte-
|
|
196
|
-
|
|
197
|
-
color: var(--rte-color-text-primary, #0f172a);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.rte-comment-date {
|
|
201
|
-
font-size: 11px;
|
|
202
|
-
color: var(--rte-color-text-muted, #64748b);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.rte-comment-expand {
|
|
206
|
-
border: none;
|
|
207
|
-
background: transparent;
|
|
208
|
-
cursor: pointer;
|
|
209
|
-
color: var(--rte-color-text-secondary, #475569);
|
|
210
|
-
font-size: 16px;
|
|
211
|
-
line-height: 1;
|
|
212
|
-
padding: 0;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.rte-comment-text {
|
|
216
|
-
margin-top: 8px;
|
|
217
|
-
font-size: 13px;
|
|
218
|
-
line-height: 1.45;
|
|
219
|
-
color: var(--rte-color-text-primary, #0f172a);
|
|
220
|
-
white-space: pre-wrap;
|
|
221
|
-
word-break: break-word;
|
|
765
|
+
.rte-comments-panel.is-open {
|
|
766
|
+
transform: translateY(0);
|
|
222
767
|
}
|
|
223
768
|
|
|
224
|
-
.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
769
|
+
/* The grip that says "this is a sheet". */
|
|
770
|
+
.rte-comments-header::before {
|
|
771
|
+
content: "";
|
|
772
|
+
position: absolute;
|
|
773
|
+
top: 6px;
|
|
774
|
+
left: 50%;
|
|
775
|
+
width: 36px;
|
|
776
|
+
height: 4px;
|
|
777
|
+
margin-left: -18px;
|
|
778
|
+
border-radius: 2px;
|
|
779
|
+
background: var(--rte-color-border, #d1d5db);
|
|
235
780
|
}
|
|
236
781
|
|
|
237
|
-
.rte-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
padding-top: 10px;
|
|
241
|
-
border-top: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
782
|
+
.rte-comments-header {
|
|
783
|
+
position: relative;
|
|
784
|
+
padding-top: 18px;
|
|
242
785
|
}
|
|
243
786
|
|
|
244
|
-
.rte-comment-
|
|
245
|
-
|
|
787
|
+
.rte-comment-icon-btn,
|
|
788
|
+
.rte-comments-close {
|
|
789
|
+
width: 36px;
|
|
790
|
+
height: 36px;
|
|
246
791
|
}
|
|
247
792
|
|
|
248
|
-
.rte-
|
|
249
|
-
|
|
250
|
-
flex-direction: column;
|
|
251
|
-
gap: 8px;
|
|
252
|
-
margin-bottom: 10px;
|
|
793
|
+
.rte-comments-new {
|
|
794
|
+
height: 36px;
|
|
253
795
|
}
|
|
254
796
|
|
|
255
|
-
.rte-
|
|
256
|
-
border: 1px solid var(--rte-color-border-light, #e5e7eb);
|
|
257
|
-
border-radius: 8px;
|
|
797
|
+
.rte-comments-tab {
|
|
258
798
|
padding: 8px;
|
|
259
|
-
background: var(--rte-color-bg-secondary, #f8fafc);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.rte-comment-reply-header {
|
|
263
|
-
display: flex;
|
|
264
|
-
justify-content: space-between;
|
|
265
|
-
gap: 8px;
|
|
266
|
-
margin-bottom: 4px;
|
|
267
|
-
font-size: 11px;
|
|
268
|
-
color: var(--rte-color-text-muted, #64748b);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
.rte-comment-reply-text {
|
|
272
|
-
font-size: 12px;
|
|
273
|
-
color: var(--rte-color-text-secondary, #334155);
|
|
274
|
-
white-space: pre-wrap;
|
|
275
|
-
word-break: break-word;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.rte-comment-reply-composer {
|
|
279
|
-
display: flex;
|
|
280
|
-
flex-direction: column;
|
|
281
|
-
gap: 8px;
|
|
282
|
-
margin-bottom: 10px;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.rte-comment-actions {
|
|
286
|
-
display: flex;
|
|
287
|
-
justify-content: flex-end;
|
|
288
|
-
flex-wrap: wrap;
|
|
289
|
-
gap: 6px;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.rte-comment-btn {
|
|
293
|
-
border: 1px solid var(--rte-color-border, #d1d5db);
|
|
294
|
-
border-radius: 7px;
|
|
295
|
-
padding: 5px 9px;
|
|
296
|
-
font-size: 12px;
|
|
297
|
-
cursor: pointer;
|
|
298
|
-
background: var(--rte-color-bg-primary, #ffffff);
|
|
299
|
-
color: var(--rte-color-text-secondary, #334155);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.rte-comment-btn:hover {
|
|
303
|
-
background: var(--rte-color-bg-hover, #f1f5f9);
|
|
304
|
-
color: var(--rte-color-text-primary, #0f172a);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.rte-comment-btn:disabled {
|
|
308
|
-
opacity: 0.5;
|
|
309
|
-
cursor: not-allowed;
|
|
310
799
|
}
|
|
311
800
|
|
|
312
|
-
.rte-comment-
|
|
313
|
-
|
|
314
|
-
background: var(--rte-color-primary, #2563eb);
|
|
315
|
-
color: var(--rte-color-text-inverse, #ffffff);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.rte-comment-btn.primary:hover {
|
|
319
|
-
background: var(--rte-color-primary-hover, #1d4ed8);
|
|
320
|
-
border-color: var(--rte-color-primary-hover, #1d4ed8);
|
|
321
|
-
color: var(--rte-color-text-inverse, #ffffff);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.rte-comment-btn.success {
|
|
325
|
-
border-color: color-mix(in srgb, var(--rte-color-success, #15803d) 60%, transparent);
|
|
326
|
-
color: var(--rte-color-success, #15803d);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.rte-comment-btn.danger {
|
|
330
|
-
border-color: color-mix(in srgb, var(--rte-color-danger, #b91c1c) 60%, transparent);
|
|
331
|
-
color: var(--rte-color-danger, #b91c1c);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.rte-comment-anchor {
|
|
335
|
-
background: rgba(250, 204, 21, 0.34);
|
|
336
|
-
border-bottom: 2px solid rgba(217, 119, 6, 0.75);
|
|
337
|
-
border-radius: 2px;
|
|
338
|
-
cursor: pointer;
|
|
339
|
-
transition: outline-color 120ms ease, box-shadow 120ms ease;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.rte-comment-anchor.rte-comment-anchor-resolved {
|
|
343
|
-
background: rgba(148, 163, 184, 0.2);
|
|
344
|
-
border-bottom-color: rgba(100, 116, 139, 0.6);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.rte-comment-anchor.highlighted {
|
|
348
|
-
outline: 2px solid var(--rte-color-primary, #2563eb);
|
|
349
|
-
outline-offset: 2px;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-comments-panel {
|
|
353
|
-
box-shadow: -14px 0 30px rgba(0, 0, 0, 0.45);
|
|
801
|
+
.rte-comment-menu-item {
|
|
802
|
+
padding: 10px;
|
|
354
803
|
}
|
|
355
804
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
805
|
+
.new-comment-textarea,
|
|
806
|
+
.rte-comment-reply-textarea,
|
|
807
|
+
.rte-comment-edit-textarea {
|
|
808
|
+
font-size: 16px; /* below 16px iOS zooms the page when a field is focused */
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
@media (prefers-reduced-motion: reduce) {
|
|
813
|
+
.rte-comments-panel,
|
|
814
|
+
.rte-comment-item,
|
|
815
|
+
.rte-comment-composer,
|
|
816
|
+
.rte-comment-anchor,
|
|
817
|
+
[data-rte-comments-open="true"] :is(.rte-toolbar-wrapper, .rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
818
|
+
transition: none;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
`,re={name:"User"},et=/^[A-Za-z0-9_:.-]{1,200}$/;function Y(e){return typeof e=="string"&&et.test(e)}function tt(e){if(typeof e!="string")return!1;const t=e.trim();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}function T(e){if(typeof e=="string"){const o=e.trim();return o?{name:o}:null}if(!e||typeof e!="object")return null;const t=e,n=typeof t.name=="string"?t.name.trim():"";if(!n)return null;const r={name:n};return t.id!==void 0&&t.id!==null&&String(t.id)!==""&&(r.id=String(t.id)),tt(t.avatar)&&(r.avatar=t.avatar.trim()),r}function xe(e,t){return typeof e!="string"||Number.isNaN(new Date(e).getTime())?t:e}function ee(e){return typeof e=="string"&&!Number.isNaN(new Date(e).getTime())?e:void 0}function ce(e,t=new Date().toISOString()){if(!Array.isArray(e))return[];const n=new Set,r=[];for(const o of e){if(!o||typeof o!="object")continue;const i=o;if(!Y(i.id)||n.has(i.id))continue;const a=typeof i.text=="string"?i.text.trim():"";if(!a)continue;n.add(i.id);const d={id:i.id,author:T(i.author)??re,text:a,createdAt:xe(i.createdAt,t),resolved:i.resolved===!0,replies:[]};Y(i.anchorId)&&(d.anchorId=i.anchorId),typeof i.quote=="string"&&i.quote.trim()&&(d.quote=i.quote.trim());const l=ee(i.editedAt);if(l&&(d.editedAt=l),d.resolved){const c=ee(i.resolvedAt);c&&(d.resolvedAt=c);const m=T(i.resolvedBy);m&&(d.resolvedBy=m)}if(Array.isArray(i.replies)){const c=new Set;i.replies.forEach((m,s)=>{if(!m||typeof m!="object")return;const u=m,h=typeof u.text=="string"?u.text.trim():"";if(!h)return;let f=Y(u.id)?u.id:`${i.id}-reply-${s+1}`;for(;c.has(f);)f=`${f}-x`;c.add(f);const L={id:f,author:T(u.author)??re,text:h,createdAt:xe(u.createdAt,t)},N=ee(u.editedAt);N&&(L.editedAt=N),d.replies.push(L)})}r.push(d)}return r}const v=new WeakMap;let E=null,ve=!1,ye=0;const nt=2;function z(e){return ye+=1,`${e}-${Date.now()}-${ye}`}function x(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return t?t.closest("[data-editora-editor]")||t.closest(".rte-editor")||t.closest(".editora-editor"):null}function rt(e){const t=e?.editorElement||e?.contentElement||null;if(!(t instanceof HTMLElement))return;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);n&&(E=n)}function De(){if(typeof window<"u"){const r=window.__editoraCommandEditorRoot;if(r instanceof HTMLElement){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);if(o)return E=o,window.__editoraCommandEditorRoot=null,o}}const e=document.activeElement,t=e?x(e):null;if(t)return t;const n=window.getSelection();if(n&&n.rangeCount>0){const r=x(n.getRangeAt(0).commonAncestorContainer);if(r)return r}return E}const y=[],ot=20;let de=null,oe=null;function $e(e){const t=T(e.options.currentUser);t&&(de=t,oe=e)}function it(e){y.push(e),y.length>ot&&y.shift(),$e(e)}function $(e){return T(e.instance?.options.currentUser)??de??re}function we(e,t){const n=$(e),r=e.instance?.options.canModify;if(r)try{return!!r(t,n)}catch{return!1}return n.id&&t.id?n.id===t.id:!0}function Oe(e){return{id:e.id,anchorId:e.anchorId??"",selectedText:e.quote??"",author:e.author,text:e.text,createdAt:e.createdAt,editedAt:e.editedAt,resolved:e.resolved,resolvedAt:e.resolvedAt,resolvedBy:e.resolvedBy,replies:e.replies.map(t=>({...t})),aligned:!1}}function at(e){const t={id:e.id,author:{...e.author},text:e.text,createdAt:e.createdAt,resolved:e.resolved,replies:e.replies.map(n=>{const r={id:n.id,author:{...n.author},text:n.text,createdAt:n.createdAt};return n.editedAt&&(r.editedAt=n.editedAt),r})};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}function qe(e){return H(e),Array.from(e.comments.values()).filter(t=>!t.deleted).map(at)}function lt(e){if(!e.storageKey)return null;try{const t=window.localStorage.getItem(e.storageKey);return t===null?null:ce(JSON.parse(t))}catch{return null}}let Ee=!1;function ct(e,t){if(e.storageKey)try{window.localStorage.setItem(e.storageKey,JSON.stringify(t))}catch(n){Ee||(Ee=!0,console.warn("[comments] the comments could not be saved to localStorage",n))}}function g(e,t,n){const r=qe(e),o=n?{reason:t,threadId:n}:{reason:t};try{e.root.dispatchEvent(new CustomEvent("editora:comments-change",{bubbles:!0,detail:{threads:r,...o}}))}catch(i){console.error("[comments] a change listener threw",i)}e.instance&&ct(e.instance.options,r);try{e.instance?.options.onChange?.(r,o)}catch(i){console.error("[comments] onChange threw",i)}}function ze(e,t){e.comments.clear(),ce(t).forEach(n=>e.comments.set(n.id,Oe(n))),e.expandedReplies.clear(),e.replyTexts={},e.editing=null,e.editDraft="",e.hoverId=null,e.activeId=null,R(e),_(e),Z(e),p(e)}function dt(e,t){const[n]=ce([t]);if(!n)return!1;if(e.editing&&e.editing.commentId===n.id&&e.editing.replyId){const r=e.editing.replyId;n.replies.some(o=>o.id===r)||(e.editing=null,e.editDraft="")}return e.comments.set(n.id,Oe(n)),Z(e),p(e),!0}function st(e,t){return e.comments.has(t)?(e.comments.delete(t),e.expandedReplies.delete(t),delete e.replyTexts[t],e.editing?.commentId===t&&(e.editing=null,e.editDraft=""),e.hoverId===t&&(e.hoverId=null),e.activeId===t&&k(e,null),e.closeMenu?.(!1),_(e),Z(e),p(e),!0):!1}function G(e,t,n){if(e.instance===t){n||(e.instanceAssumed=!1);return}e.instanceAssumed&&e.instance&&(e.instance?.options.initialThreads||e.instance?.options.storageKey)&&e.comments.clear(),e.instance=t,e.instanceAssumed=n;const o=y.indexOf(t);if(o!==-1&&y.splice(o,1),!t.initialApplied){t.initialApplied=!0;const i=lt(t.options)??t.options.initialThreads;i&&ze(e,i)}}function C(e,t){const n=v.get(e);if(n)return t&&n.instance!==t&&(n.instanceAssumed||!n.instance)&&G(n,t,!1),n;const r={root:e,instance:null,instanceAssumed:!1,orphanIds:[],renderedKey:"",watchedContent:null,contentObserver:null,syncTimer:null,uid:z("rte-comments"),comments:new Map,panelVisible:!1,panelElement:null,filter:"open",composer:null,activeId:null,hoverId:null,editing:null,editDraft:"",undoEntry:null,undoTimer:null,expandedReplies:new Set,replyTexts:{},savedSelection:null,newCommentText:"",closeMenu:null,timeTimer:null};v.set(e,r);const o=t??y[0]??null;return o&&G(r,o,!t),me(r),se(r),r}function se(e){e.syncTimer===null&&(e.syncTimer=window.setTimeout(()=>Z(e),150))}function me(e){const t=U(e.root);t!==e.watchedContent&&(e.contentObserver?.disconnect(),e.watchedContent=t,e.contentObserver=null,!(!t||typeof MutationObserver>"u")&&(e.contentObserver=new MutationObserver(()=>se(e)),e.contentObserver.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","id"]})))}const Ce="rte-comments-orphans",F=new Set;function mt(e){const t=U(e.root),n=new Set;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)&&Y(i.id)).map(i=>i.id):[],e.orphanIds.length?F.add(e):F.delete(e);const r=[];F.forEach(i=>{if(!i.root.isConnected){F.delete(i);return}i.orphanIds.forEach(a=>r.push(`.rte-comment-anchor[id="${a}"]`))});let o=document.getElementById(Ce);if(r.length===0){o?.remove();return}o||(o=document.createElement("style"),o.id=Ce,document.head.appendChild(o)),o.textContent=`${r.join(`,
|
|
822
|
+
`)} { background: none; border-bottom: 0; cursor: inherit; }`}function Z(e){if(e.syncTimer!==null&&(window.clearTimeout(e.syncTimer),e.syncTimer=null),!e.root.isConnected)return;me(e);const t=new Map;e.comments.forEach(r=>t.set(r.id,`${r.resolved}|${!!r.deleted}`)),H(e);let n;e.comments.forEach(r=>{t.has(r.id)&&t.get(r.id)!==`${r.resolved}|${!!r.deleted}`&&(n=r.id)}),mt(e),e.panelVisible&&We(H(e))!==e.renderedKey&&p(e),n&&g(e,"document",n)}function X(){const e=De();return e?(E=e,C(e)):null}function U(e){return e.querySelector(".rte-content")||e.querySelector("[contenteditable]")}function J(e,t){const n=U(t);return!!n&&n.contains(e.commonAncestorContainer)}function ut(e){const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;const n=t.getRangeAt(0);return J(n,e)?n.cloneRange():null}function D(e,t){return t.anchorId?e.root.querySelector(`[id="${t.anchorId}"]`):null}function H(e){const t=[];return e.comments.forEach(n=>{if(n.anchorId){const r=D(e,n);if(!r)return;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")}else if(n.deleted)return;t.push(n)}),t}function B(e,t){const n=U(e.root),r=n?n.innerHTML:"",o=t();return n&&n.innerHTML!==r&&(Ze.recordDomHistory(n,r),n.dispatchEvent(new Event("input",{bubbles:!0}))),o}function He(e,t){const n=D(e,t);n&&n.classList.toggle("rte-comment-anchor-resolved",t.resolved)}const q=new Set,Ae="rte-comments-emphasis";function _(e){e.activeId||e.hoverId?q.add(e):q.delete(e),q.forEach(o=>{o.root.isConnected||q.delete(o)});const t=[],n=(o,i)=>{const a=i?o.comments.get(i):null;return a?.anchorId?a.anchorId.replace(/["\\]/g,""):""};q.forEach(o=>{const i=n(o,o.hoverId),a=n(o,o.activeId);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); }`)});let r=document.getElementById(Ae);if(t.length===0){r?.remove();return}r||(r=document.createElement("style"),r.id=Ae,document.head.appendChild(r)),r.textContent=t.join(`
|
|
823
|
+
`)}function M(e,t,n){n?e.hoverId=t:e.hoverId===t&&(e.hoverId=null),_(e)}function k(e,t){e.activeId=t,e.panelElement?.querySelectorAll(".rte-comment-item").forEach(n=>{n.classList.toggle("is-active",n.dataset.commentId===t)}),_(e)}function pt(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}function Be(e){e.root.querySelector('[contenteditable="true"]')?.focus({preventScroll:!0})}function Q(e,t){if(e.panelVisible=t,t){Ge(),ht(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),vt(e),ne.focusPanel(e.panelElement);return}if(e.root.removeAttribute("data-rte-comments-open"),yt(e),e.closeMenu?.(!1),e.editing=null,e.editDraft="",R(e),e.hoverId=null,k(e,null),e.panelElement){const n=ne.panelHasFocus(e.panelElement);e.panelElement.remove(),e.panelElement=null,n&&Be(e)}}function Pe(e){Q(e,!1),(!e.root.contains(document.activeElement)||document.activeElement===document.body)&&Be(e)}const ft={check:'<path d="M3.5 8.5l3 3 6-7"/>',reopen:'<path d="M3 8a5 5 0 1 0 1.6-3.7M3 2.8v3.2h3.2"/>',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"/>',plus:'<path d="M8 3v10M3 8h10"/>',close:'<path d="M4 4l8 8M12 4l-8 8"/>',addComment:'<path d="M2.5 3.5h11v7.5H8.5l-3 2.5V11h-3zM8 5.2v3.6M6.2 7h3.6"/>',edit:'<path d="M10.5 3.5l2 2-7 7-2.8.8.8-2.8z"/>',trash:'<path d="M3 4.5h10M6.5 4.5V3h3v1.5M4.5 4.5l.5 8.5h6l.5-8.5M7 7v4M9 7v4"/>',bubble:'<path d="M2.5 3.5h11v7.5H8.5l-3 2.5V11h-3z"/>'};function I(e){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">${ft[e]}</svg>`}function b(e,t,n){const r=document.createElement("button");return r.type="button",r.className=e,n?(r.innerHTML=I(n),r.setAttribute("aria-label",t),r.title=t):r.textContent=t,r}function ht(e){if(e.panelElement)return;const t=document.createElement("aside");t.className="rte-comments-panel",t.setAttribute("role","complementary"),t.setAttribute("aria-label","Comments"),t.setAttribute("aria-hidden","true");const n=[["open","Open"],["resolved","Resolved"],["all","All"]];t.innerHTML=`
|
|
824
|
+
<div class="rte-comments-header">
|
|
825
|
+
<div class="rte-comments-title">
|
|
826
|
+
<h3>Comments</h3>
|
|
827
|
+
<span class="rte-comments-count" aria-hidden="true"></span>
|
|
828
|
+
</div>
|
|
829
|
+
<div class="rte-comments-header-actions">
|
|
830
|
+
<button class="rte-comments-new" type="button" aria-label="New comment">${I("plus")}<span>New</span></button>
|
|
831
|
+
<button class="rte-comments-close" type="button" aria-label="Close comments panel" title="Close">${I("close")}</button>
|
|
832
|
+
</div>
|
|
833
|
+
</div>
|
|
834
|
+
<div class="rte-comments-tabs" role="tablist" aria-label="Show comments">
|
|
835
|
+
${n.map(([a,d])=>`<button class="rte-comments-tab" type="button" role="tab" id="${e.uid}-tab-${a}" data-filter="${a}" aria-controls="${e.uid}-body"><span>${d}</span><span class="rte-comments-tab-count"></span></button>`).join("")}
|
|
836
|
+
</div>
|
|
837
|
+
<div class="rte-comments-body" id="${e.uid}-body" role="tabpanel"></div>
|
|
838
|
+
<div class="rte-comments-toast" role="status" aria-live="polite" hidden></div>
|
|
839
|
+
`,t.querySelector(".rte-comments-close")?.addEventListener("click",()=>Pe(e)),t.querySelector(".rte-comments-new")?.addEventListener("click",()=>{Ke(e,e.savedSelection?e.savedSelection.cloneRange():null)});const r=t.querySelector(".rte-comments-tabs"),o=Array.from(r.querySelectorAll(".rte-comments-tab"));o.forEach(a=>{a.addEventListener("click",()=>{e.filter=a.dataset.filter,p(e)})}),r.addEventListener("keydown",a=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(a.key))return;const l=o.findIndex(m=>m===document.activeElement);if(l===-1)return;a.preventDefault();let c=l;a.key==="ArrowRight"&&(c=(l+1)%o.length),a.key==="ArrowLeft"&&(c=(l-1+o.length)%o.length),a.key==="Home"&&(c=0),a.key==="End"&&(c=o.length-1),e.filter=o[c].dataset.filter,p(e),o[c].focus()}),window.getComputedStyle(e.root).position==="static"&&(e.root.style.position="relative"),e.root.appendChild(t),e.panelElement=t}function gt(e){const t=H(e),n=t.filter(o=>o.anchorId).map(o=>({comment:o,anchor:D(e,o)}));n.sort((o,i)=>o.anchor===i.anchor?0:o.anchor.compareDocumentPosition(i.anchor)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);const r=t.filter(o=>!o.anchorId).sort((o,i)=>o.createdAt.localeCompare(i.createdAt));return[...n.map(o=>o.comment),...r]}function Te(e,t=!1){const n=document.createElement("span");if(n.className=`rte-comment-avatar${t?" small":""}`,n.setAttribute("aria-hidden","true"),n.style.background=Je(e.id||e.name),n.textContent=Xe(e.name),e.avatar){const r=document.createElement("img");r.alt="",r.loading="lazy",r.decoding="async",r.referrerPolicy="no-referrer",r.addEventListener("error",()=>r.remove()),r.src=e.avatar,n.appendChild(r)}return n}function bt(e){const t=document.createElement("time");return t.className="rte-comment-date",t.dateTime=e,t.dataset.created=e,t.title=Re(e),t.textContent=le(e),t}function xt(e){e.panelElement?.querySelectorAll("time[data-created]").forEach(t=>{t.textContent=le(t.dataset.created||"")})}function vt(e){e.timeTimer===null&&(e.timeTimer=window.setInterval(()=>xt(e),6e4))}function yt(e){e.timeTimer!==null&&(window.clearInterval(e.timeTimer),e.timeTimer=null)}function ue(e){if(e.style.height="auto",!e.scrollHeight)return;const t=e.offsetHeight-e.clientHeight;e.style.height=`${Math.min(e.scrollHeight+t,160)}px`}function Ue(){return!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Se(e,t,n=!0){const r=D(e,t);if(!r)return;const o=!!e.panelElement&&window.getComputedStyle(e.panelElement).position==="fixed";if(r.scrollIntoView({behavior:o||Ue()?"auto":"smooth",block:"center",inline:"nearest"}),o&&e.panelElement){const i=e.panelElement.getBoundingClientRect().top,a=r.getBoundingClientRect().bottom;a>i-16&&window.scrollBy(0,a-i+32)}n&&(M(e,t.id,!0),window.setTimeout(()=>M(e,t.id,!1),1200))}function _e(e,t){const n=e.comments.get(t);if(!n)return;e.filter!=="all"&&(e.filter=n.resolved?"resolved":"open"),k(e,t),p(e),Array.from(e.panelElement?.querySelectorAll(".rte-comment-item")??[]).find(o=>o.dataset.commentId===t)?.scrollIntoView({behavior:Ue()?"auto":"smooth",block:"nearest"})}function ke(e,t,n,r){const o=document.createElement("div");o.className="rte-comment-more";const i=b("rte-comment-icon-btn",r,"more");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);const a=document.createElement("div");a.className="rte-comment-menu",a.setAttribute("role","menu"),a.setAttribute("aria-label",r),a.hidden=!0,t.forEach(s=>{const u=document.createElement("button");u.type="button",u.className=`rte-comment-menu-item${s.danger?" danger":""}`,u.setAttribute("role","menuitem"),u.dataset.action=s.label.toLowerCase(),u.innerHTML=I(s.icon);const h=document.createElement("span");h.textContent=s.label,u.appendChild(h),u.addEventListener("click",()=>{e.closeMenu?.(!1),s.run()}),a.appendChild(u)});const d=()=>Array.from(a.querySelectorAll('[role="menuitem"]')),l=s=>{a.hidden||(a.hidden=!0,i.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",c,!0),document.removeEventListener("focusin",c,!0),e.closeMenu===l&&(e.closeMenu=null),s&&i.isConnected&&i.focus({preventScroll:!0}))};function c(s){s.target instanceof Node&&o.contains(s.target)||l(!1)}const m=()=>{e.closeMenu?.(!1),a.hidden=!1,i.setAttribute("aria-expanded","true"),e.closeMenu=l,document.addEventListener("pointerdown",c,!0),document.addEventListener("focusin",c,!0),d()[0]?.focus({preventScroll:!0})};return i.addEventListener("click",()=>a.hidden?m():l(!0)),i.addEventListener("keydown",s=>{s.key==="ArrowDown"&&a.hidden&&(s.preventDefault(),m())}),a.addEventListener("keydown",s=>{const u=d(),h=u.indexOf(document.activeElement);let f=-1;s.key==="ArrowDown"?f=(h+1)%u.length:s.key==="ArrowUp"?f=(h-1+u.length)%u.length:s.key==="Home"?f=0:s.key==="End"?f=u.length-1:s.key==="Tab"&&l(!1),f!==-1&&(s.preventDefault(),u[f].focus({preventScroll:!0}))}),o.append(i,a),o}function Ie(e,t){const n=document.createElement("div");if(n.className="rte-comment-when",n.appendChild(bt(e)),t){const r=document.createElement("span");r.className="rte-comment-edited",r.textContent="· edited",r.title=`Edited ${Re(t)}`,n.appendChild(r)}return n}function Le(e,t){const n=document.createElement("form");n.className="rte-comment-edit",n.noValidate=!0;const r=document.createElement("textarea");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;const o=document.createElement("div");o.className="rte-comment-form-actions";const i=b("rte-comment-btn ghost","Cancel"),a=b("rte-comment-btn primary","Save");a.type="submit",o.append(i,a);const d=()=>{a.disabled=!r.value.trim(),ue(r)};return d(),r.addEventListener("input",()=>{e.editDraft=r.value,d()}),r.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&!l.isComposing&&(l.preventDefault(),n.requestSubmit())}),i.addEventListener("click",()=>pe(e)),n.addEventListener("submit",l=>{l.preventDefault(),wt(e,r.value)}),n.append(r,o),n}function Ne(e,t,n){const r=e.comments.get(t);if(!r)return;const o=n?r.replies.find(a=>a.id===n):null;if(n&&!o)return;e.editing={commentId:t,replyId:n},e.editDraft=o?o.text:r.text,n&&e.expandedReplies.add(t),p(e);const i=e.panelElement?.querySelector(".rte-comment-edit-textarea");i&&(i.focus({preventScroll:!0}),i.setSelectionRange(i.value.length,i.value.length))}function pe(e){const t=e.editing;if(e.editing=null,e.editDraft="",p(e),!t)return;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"]`;e.panelElement?.querySelector(n)?.focus({preventScroll:!0})}function wt(e,t){const n=e.editing,r=t.trim();if(!n||!r)return;const o=e.comments.get(n.commentId);if(!o)return;const i=n.replyId?o.replies.find(d=>d.id===n.replyId):o,a=!!i&&i.text!==r;i&&a&&(i.text=r,i.editedAt=new Date().toISOString()),pe(e),a&&g(e,"edit",o.id)}function R(e){e.undoTimer!==null&&window.clearTimeout(e.undoTimer),e.undoTimer=null,e.undoEntry=null;const t=e.panelElement?.querySelector(".rte-comments-toast");t&&(t.hidden=!0,t.replaceChildren())}function Ve(e,t){const n=e.panelElement?.querySelector(".rte-comments-toast");if(!n)return;R(e),e.undoEntry=t;const r=document.createElement("span");r.textContent=t.message;const o=b("rte-comments-toast-action","Undo");o.addEventListener("click",()=>{const i=t.undo();R(e),i||(r.textContent="This could not be restored here. Use Undo in the document.",n.replaceChildren(r),n.hidden=!1,e.undoTimer=window.setTimeout(()=>R(e),6e3))}),n.replaceChildren(r,o),n.hidden=!1,e.undoTimer=window.setTimeout(()=>R(e),8e3)}function Et(e,t){const n=document.createElement("div");n.className="rte-comment-reply-box";const r=document.createElement("textarea");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]||"";const o=document.createElement("div");o.className="rte-comment-form-actions";const i=b("rte-comment-btn ghost","Cancel"),a=b("rte-comment-btn primary","Reply");o.append(i,a);const d=()=>{const c=!!r.value.trim();a.disabled=!c,n.classList.toggle("has-text",!!r.value),ue(r)};d();const l=()=>{const c=r.value.trim();c&&(qt(t.id,$(e),c),delete e.replyTexts[t.id],p(e))};return r.addEventListener("input",()=>{e.replyTexts[t.id]=r.value,d()}),r.addEventListener("focus",()=>k(e,t.id)),r.addEventListener("keydown",c=>{c.key==="Enter"&&!c.shiftKey&&!c.isComposing&&(c.preventDefault(),l())}),a.addEventListener("click",l),i.addEventListener("click",()=>{delete e.replyTexts[t.id],r.value="",d(),r.blur()}),n.append(r,o),n}function Ct(e,t){const n=document.createElement("article");n.className=`rte-comment-item${t.resolved?" resolved":""}${e.activeId===t.id?" is-active":""}`,n.dataset.commentId=t.id;const r=document.createElement("header");r.className="rte-comment-header";const o=document.createElement("div");o.className="rte-comment-meta";const i=document.createElement("strong");i.className="rte-comment-author",i.textContent=t.author.name,o.append(i,Ie(t.createdAt,t.editedAt));const a=document.createElement("div");a.className="rte-comment-header-actions";const d=b("rte-comment-icon-btn",t.resolved?"Reopen thread":"Resolve thread",t.resolved?"reopen":"check");if(d.dataset.action="resolve",d.dataset.commentId=t.id,d.addEventListener("click",()=>{t.resolved?Rt(t.id):Mt(t.id,$(e))}),a.append(d),we(e,t.author)&&a.append(ke(e,[{label:"Edit",icon:"edit",run:()=>Ne(e,t.id,null)},{label:"Delete",icon:"trash",danger:!0,run:()=>$t(e,t.id)}],{commentId:t.id},"More actions")),r.append(Te(t.author),o,a),n.appendChild(r),t.anchorId&&t.selectedText){const l=document.createElement("button");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",()=>{k(e,t.id),Se(e,t)}),n.appendChild(l)}if(e.editing&&e.editing.commentId===t.id&&!e.editing.replyId)n.appendChild(Le(e,e.editing));else{const l=document.createElement("div");l.className="rte-comment-text",l.textContent=t.text,n.appendChild(l)}if(t.resolved){const l=document.createElement("div");l.className="rte-comment-status",l.innerHTML=I("check");const c=document.createElement("span"),m=t.resolvedBy?` by ${t.resolvedBy.name}`:"",s=t.resolvedAt?` · ${le(t.resolvedAt)}`:"";c.textContent=`Resolved${m}${s}`,l.appendChild(c),n.appendChild(l)}if(t.replies.length>0){const l=document.createElement("div");l.className="rte-comment-replies";const m=e.expandedReplies.has(t.id)?0:Math.max(0,t.replies.length-nt);if(m>0){const s=b("rte-comment-more-replies",`Show ${m} earlier ${m===1?"reply":"replies"}`);s.addEventListener("click",()=>{e.expandedReplies.add(t.id),p(e)}),l.appendChild(s)}t.replies.slice(m).forEach(s=>{const u=document.createElement("div");u.className="rte-comment-reply",u.dataset.replyId=s.id;const h=document.createElement("div");h.className="rte-comment-reply-header";const f=document.createElement("div");f.className="rte-comment-meta";const L=document.createElement("strong");if(L.className="rte-comment-author",L.textContent=s.author.name,f.append(L,Ie(s.createdAt,s.editedAt)),h.append(Te(s.author,!0),f),we(e,s.author)&&h.append(ke(e,[{label:"Edit",icon:"edit",run:()=>Ne(e,t.id,s.id)},{label:"Delete",icon:"trash",danger:!0,run:()=>Ot(e,t.id,s.id)}],{commentId:t.id,replyId:s.id},"More reply actions")),u.appendChild(h),e.editing&&e.editing.commentId===t.id&&e.editing.replyId===s.id)u.appendChild(Le(e,e.editing));else{const N=document.createElement("div");N.className="rte-comment-reply-text",N.textContent=s.text,u.appendChild(N)}l.appendChild(u)}),n.appendChild(l)}return t.resolved||n.appendChild(Et(e,t)),n.addEventListener("click",l=>{const c=l.target instanceof Element?l.target:null;!c||c.closest('button, textarea, form, [role="menu"]')||window.getSelection()?.toString()||(k(e,t.id),Se(e,t,!1))}),n.addEventListener("mouseenter",()=>M(e,t.id,!0)),n.addEventListener("mouseleave",()=>M(e,t.id,!1)),n.addEventListener("focusin",()=>M(e,t.id,!0)),n.addEventListener("focusout",()=>M(e,t.id,!1)),n}function At(e,t){const n=document.createElement("form");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){const l=document.createElement("div");l.className="rte-comment-selection";const c=document.createElement("span");c.textContent=t.quote,c.title=t.quote;const m=b("rte-comment-icon-btn","Comment on the whole document instead","close");m.addEventListener("click",()=>{t.range=null,t.quote="",p(e),Fe(e)}),l.append(c,m),n.appendChild(l)}else{const l=document.createElement("p");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)}const r=document.createElement("textarea");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){const l=document.createElement("p");l.className="rte-comment-error",l.setAttribute("role","alert"),l.textContent=t.error,n.appendChild(l)}const o=document.createElement("div");o.className="rte-comment-form-actions";const i=b("rte-comment-btn ghost","Cancel"),a=b("rte-comment-btn primary","Comment");a.type="submit",o.append(i,a),n.appendChild(o);const d=()=>{a.disabled=!r.value.trim()};return d(),r.addEventListener("input",()=>{e.newCommentText=r.value,t.error&&(t.error="",n.querySelector(".rte-comment-error")?.remove()),d()}),r.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&!l.isComposing&&(l.preventDefault(),n.requestSubmit())}),i.addEventListener("click",()=>je(e)),n.addEventListener("submit",l=>{l.preventDefault();const c=r.value.trim();if(!c)return;const m=Nt(e,$(e),c,t.range);if(!m){t.error="That text could not be commented on. Select it again and click New.",t.range=null,t.quote="",p(e);return}e.newCommentText="",e.composer=null,e.filter==="resolved"&&(e.filter="open"),_e(e,m)}),n}function Fe(e){e.panelElement?.querySelector(".new-comment-textarea")?.focus({preventScroll:!0})}function Ke(e,t){const n=t?t.toString().replace(/\s+/g," ").trim():"";e.composer={range:t&&n?t.cloneRange():null,quote:n,error:""},e.filter==="resolved"&&(e.filter="open"),p(e),Fe(e)}function je(e){e.composer=null,e.newCommentText="",p(e)}function Tt(e,t){const n=document.createElement("div");n.className="rte-comments-empty";let r="No comments yet",o="Select text in the document and click New to start a discussion.";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=I("bubble");const i=document.createElement("strong");i.textContent=r;const a=document.createElement("p");return a.textContent=o,n.append(i,a),n}function We(e){return e.map(t=>`${t.id}:${t.resolved?1:0}`).join("|")}function p(e){const t=e||X(),n=t?.panelElement;if(!t||!n)return;const r=gt(t);t.renderedKey=We(H(t));const o={open:r.filter(c=>!c.resolved).length,resolved:r.filter(c=>c.resolved).length,all:r.length},i=n.querySelector(".rte-comments-count");i&&(i.textContent=String(o.open),i.hidden=o.open===0),n.querySelectorAll(".rte-comments-tab").forEach(c=>{const m=c.dataset.filter,s=m===t.filter;c.setAttribute("aria-selected",String(s)),c.tabIndex=s?0:-1;const u=c.querySelector(".rte-comments-tab-count");u&&(u.textContent=String(o[m]))});const a=n.querySelector(".rte-comments-body");if(!a)return;a.setAttribute("aria-labelledby",`${t.uid}-tab-${t.filter}`);const d=r.filter(c=>t.filter==="open"?!c.resolved:t.filter==="resolved"?c.resolved:!0);t.hoverId&&(t.hoverId=null,_(t));const l=a.scrollTop;ne.keepPanelFocus(n,()=>{const c=[];t.composer&&c.push(At(t,t.composer)),d.forEach(m=>c.push(Ct(t,m))),d.length===0&&!t.composer&&c.push(Tt(t.filter,o.all)),a.replaceChildren(...c)}),a.scrollTop=l,a.querySelectorAll("textarea").forEach(c=>ue(c))}function Ye(e){return v.has(e)||!!e.querySelector('[data-command="addComment"]')}function fe(e){E=e;const t=C(e),n=ut(e)||(t.savedSelection?t.savedSelection.cloneRange():null);n&&window.getSelection()?.removeAllRanges(),t.savedSelection=null,w(),Q(t,!0),Ke(t,n)}let A=null,P=null,ie=null,ae=!1;function St(){return/Mac|iPhone|iPad/.test(navigator.platform||"")?"⌘⌥M":"Ctrl+Alt+M"}function w(){A&&(A.hidden=!0),P=null}function kt(){if(A&&A.isConnected)return A;Ge();const e=document.createElement("button");return e.type="button",e.className="rte-comments-bubble",e.hidden=!0,e.title=`Add a comment (${St()})`,e.innerHTML=`${I("addComment")}<span>Comment</span>`,e.addEventListener("mousedown",t=>t.preventDefault()),e.addEventListener("click",()=>{const t=P;w(),t&&fe(t)}),document.body.appendChild(e),A=e,e}function It(){if(ie=null,ae)return w();const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return w();const t=e.getRangeAt(0),n=x(t.commonAncestorContainer);if(!n||!J(t,n)||!Ye(n)||U(n)?.closest('[contenteditable="false"]')||!t.toString().trim())return w();const r=t.getClientRects?.(),o=r&&r.length?r[r.length-1]:t.getBoundingClientRect?.();if(!o||!o.width&&!o.height)return w();const i=kt();i.hidden=!1,P=n;const a=i.offsetWidth||96,d=i.offsetHeight||32;let l=o.bottom+8;l+d>window.innerHeight-8&&(l=Math.max(8,(r&&r.length?r[0]:o).top-d-8));const c=Math.min(Math.max(8,o.right-a),Math.max(8,window.innerWidth-a-8));i.style.top=`${l}px`,i.style.left=`${c}px`}function K(){ie===null&&(ie=window.setTimeout(It,40))}function he(){document.querySelectorAll("[data-editora-editor], .rte-editor, .editora-editor").forEach(e=>{const t=x(e);if(!t)return;const n=v.get(t);if(n){me(n),!n.instance&&y.length&&G(n,y[0],!0);return}t.querySelector('[data-command="addComment"]')&&C(t)})}let te=null;function Lt(){te===null&&(te=window.setTimeout(()=>{te=null,he()},50))}function S(){if(ve)return;ve=!0,document.addEventListener("focusin",t=>{const n=x(t.target);n&&(E=n)}),document.addEventListener("click",t=>{const r=(t.target instanceof Element?t.target:null)?.closest(".rte-comment-anchor");if(!r)return;const o=x(r),i=o?v.get(o):null,a=r.getAttribute("data-comment-id");!i||!a||!i.comments.has(a)||(t.preventDefault(),t.stopPropagation(),E=i.root,Q(i,!0),_e(i,a))}),document.addEventListener("input",t=>{const n=t.target instanceof Element?t.target:null;if(!n||n.closest(".rte-comments-panel"))return;const r=x(n),o=r?v.get(r):null;o&&se(o)}),he(),typeof MutationObserver<"u"&&new MutationObserver(t=>{for(const n of t)for(const r of Array.from(n.addedNodes))if(r.nodeType===1){Lt();return}}).observe(document.documentElement,{childList:!0,subtree:!0}),document.addEventListener("selectionchange",()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=t.getRangeAt(0),r=x(n.commonAncestorContainer);if(!r)return;E=r;const o=v.get(r);!o||!J(n,r)||(o.savedSelection=t.isCollapsed?null:n.cloneRange())}),document.addEventListener("selectionchange",K),document.addEventListener("pointerdown",t=>{t.target instanceof Node&&A?.contains(t.target)||(ae=!0,w())},!0);const e=()=>{ae=!1,K()};document.addEventListener("pointerup",e,!0),document.addEventListener("pointercancel",e,!0),document.addEventListener("scroll",()=>P&&K(),!0),window.addEventListener("resize",()=>P&&K()),document.addEventListener("keydown",t=>{if(t.code!=="KeyM"||!t.altKey||t.shiftKey||!(t.metaKey||t.ctrlKey))return;const n=t.target instanceof Node?x(t.target):null;!n||!Ye(n)||(t.preventDefault(),t.stopPropagation(),fe(n))},!0),document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;const n=t.target instanceof Node?x(t.target):null,r=n?v.get(n):null;if(!r||!r.panelVisible)return;if(r.closeMenu){t.preventDefault(),t.stopPropagation(),r.closeMenu(!0);return}const o=t.target instanceof HTMLTextAreaElement&&r.panelElement?.contains(t.target)?t.target:null;if(o?.classList.contains("new-comment-textarea")){t.preventDefault(),t.stopPropagation(),je(r);return}if(o?.classList.contains("rte-comment-edit-textarea")){t.preventDefault(),t.stopPropagation(),pe(r);return}if(o?.classList.contains("rte-comment-reply-textarea")&&o.value){t.preventDefault(),t.stopPropagation(),delete r.replyTexts[o.dataset.commentId||""],o.value="",o.dispatchEvent(new Event("input"));return}t.preventDefault(),t.stopPropagation(),Pe(r)},!0)}function Nt(e,t,n,r){const o=n.trim();if(!o)return"";if(!r){const m=z("comment");return e.comments.set(m,{id:m,anchorId:"",selectedText:"",author:t,text:o,createdAt:new Date().toISOString(),resolved:!1,replies:[],aligned:!0}),p(e),g(e,"create",m),m}if(!J(r,e.root))return"";const i=r.toString().trim();if(!i)return"";const a=z("comment"),d=z("comment-anchor"),l=document.createElement("span");return l.id=d,l.className="rte-comment-anchor",l.setAttribute("data-comment-id",a),l.setAttribute("title","Commented text"),B(e,()=>{try{const m=r.cloneRange(),s=m.extractContents();return s.textContent?.trim()?(l.appendChild(s),m.insertNode(l),!0):!1}catch{return!1}})?(e.comments.set(a,{id:a,anchorId:d,selectedText:i,author:t,text:o,createdAt:new Date().toISOString(),resolved:!1,replies:[],aligned:!0}),e.savedSelection=null,window.getSelection()?.removeAllRanges(),p(e),g(e,"create",a),a):""}function Mt(e,t){const n=X();if(!n)return;const r=n.comments.get(e);r&&(r.resolved=!0,r.resolvedBy=T(t)??$(n),r.resolvedAt=new Date().toISOString(),B(n,()=>He(n,r)),p(n),g(n,"resolve",e))}function Rt(e){const t=X();if(!t)return;const n=t.comments.get(e);n&&(n.resolved=!1,n.resolvedBy=void 0,n.resolvedAt=void 0,B(t,()=>He(t,n)),p(t),g(t,"reopen",e))}function Dt(e,t){const n=e.comments.get(t);if(!n)return null;e.activeId===t&&k(e,null),e.hoverId===t&&(e.hoverId=null),e.editing?.commentId===t&&(e.editing=null,e.editDraft="");let r=null;if(n.anchorId){const o=D(e,n);if(o){const i=Array.from(o.childNodes),a=Array.from(o.attributes).map(d=>[d.name,d.value]);B(e,()=>pt(o)),n.deleted=!0,r={message:"Comment deleted",undo:()=>{if(D(e,n))return!0;const d=i[0],l=d?.parentNode;if(!(!!d&&d.isConnected&&!!l&&i.every((s,u)=>s.parentNode===l&&(u===0||i[u-1].nextSibling===s)))||!d||!l)return!1;const m=document.createElement("span");return a.forEach(([s,u])=>m.setAttribute(s,u)),B(e,()=>{l.insertBefore(m,d),i.forEach(s=>m.appendChild(s))}),n.deleted=!1,p(e),g(e,"create",n.id),!0}}}}else{e.comments.delete(t),e.expandedReplies.delete(t);const o=e.replyTexts[t];delete e.replyTexts[t],r={message:"Note deleted",undo:()=>(e.comments.set(t,n),o&&(e.replyTexts[t]=o),p(e),g(e,"create",t),!0)}}return p(e),g(e,"delete",t),r}function $t(e,t){const n=Dt(e,t);n&&Ve(e,n)}function Ot(e,t,n){const r=e.comments.get(t),o=r?r.replies.findIndex(a=>a.id===n):-1;if(!r||o===-1)return;const[i]=r.replies.splice(o,1);e.editing?.replyId===n&&(e.editing=null,e.editDraft=""),p(e),g(e,"delete",t),Ve(e,{message:"Reply deleted",undo:()=>(r.replies.splice(Math.min(o,r.replies.length),0,i),p(e),g(e,"reply",t),!0)})}function qt(e,t,n){const r=X();if(!r)return;const o=r.comments.get(e);if(!o)return;const i=n.trim();i&&(o.replies.push({id:z("reply"),author:T(t)??$(r),text:i,createdAt:new Date().toISOString()}),p(r),g(r,"reply",e))}function Ge(){if(document.getElementById(be))return;const e=document.createElement("style");e.id=be,e.textContent=Qe,document.head.appendChild(e)}const zt="[data-editora-editor], .rte-editor, .editora-editor, editora-editor";function O(e){return e instanceof Element?e.closest(zt):null}function Ht(e){const t=O(e),n=t?v.get(t):null;return n?qe(n):[]}function Bt(e,t){const n=O(e);n&&(S(),ze(C(n),t))}function Pt(e,t){const n=O(e);return n?(S(),dt(C(n),t)):!1}function Ut(e,t){const n=O(e),r=n?v.get(n):null;return r?st(r,t):!1}function _t(e,t){const n=O(e);if(!n)return;S();const r={options:t,initialApplied:!1};$e(r);const o=C(n,r);o.instance!==r&&G(o,r,!1)}function Me(e,t){rt(t);const n=De();return n?(E=n,C(n,e)):null}const Vt=(e={})=>{const t={options:e||{},initialApplied:!1};return typeof document<"u"&&(it(t),S(),he()),Ft(t)},Ft=e=>({name:"comments",toolbar:[{label:"Add Comment",command:"addComment",type:"button",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>'},{label:"Show / Hide Comments",command:"toggleComments",type:"button",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>'}],commands:{addComment:(t,n)=>{S();const r=Me(e,n);return r?(fe(r.root),!0):!1},toggleComments:(t,n)=>{S();const r=Me(e,n);return r?(Q(r,!r.panelVisible),!0):!1}},init(t){const n=O(t?.editorElement);n&&(S(),C(n,e))},destroy(){const t=y.indexOf(e);t!==-1&&y.splice(t,1),oe===e&&(de=null,oe=null)},keymap:{}});exports.CommentsPlugin=Vt;exports.configureComments=_t;exports.getCommentThreads=Ht;exports.removeCommentThread=Ut;exports.setCommentThreads=Bt;exports.upsertCommentThread=Pt;
|