@editora/core 1.0.24 → 1.0.26

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.
Files changed (30) hide show
  1. package/dist/{CodePlugin.native-BRBEIqY7.mjs → CodePlugin.native-DNJmRGdT.mjs} +107 -93
  2. package/dist/{CodePlugin.native-CPfKDrkr.mjs → CodePlugin.native-DhLs8BoM.mjs} +43 -29
  3. package/dist/CommentsPlugin.native-CxdTwTGE.mjs +2101 -0
  4. package/dist/{DocumentManagerPlugin.native-tZqIa9o5.mjs → DocumentManagerPlugin.native-CaBqCH-p.mjs} +4 -4
  5. package/dist/MediaManagerPlugin.native-0YFHZfsb.mjs +4823 -0
  6. package/dist/MediaManagerPlugin.native-mXWWARRX.mjs +4908 -0
  7. package/dist/confirmDialog-CNqPHT5x.mjs +92 -0
  8. package/dist/{documentManager-8gnG-uG_.mjs → documentManager-DHLCoWzw.mjs} +490 -509
  9. package/dist/editora.min.js +2 -2
  10. package/dist/editora.umd.js +2 -2
  11. package/dist/index-DHPPVQwx.js +12 -0
  12. package/dist/{index-BICrB5kg.mjs → index-gI4djib2.mjs} +11 -2
  13. package/dist/index.cjs.js +1 -1
  14. package/dist/index.esm.js +2 -2
  15. package/dist/plugin-loader.js +3 -3
  16. package/dist/shared-config-DuA34Iii.mjs +26 -0
  17. package/dist/webcomponent-core.js +11 -2
  18. package/dist/webcomponent-core.min.css +1 -1
  19. package/dist/webcomponent-core.min.js +19 -20
  20. package/dist/webcomponent.cjs.js +1 -1
  21. package/dist/webcomponent.esm.js +1 -1
  22. package/dist/webcomponent.js +82 -73
  23. package/dist/webcomponent.min.css +1 -1
  24. package/dist/webcomponent.min.js +3345 -1655
  25. package/package.json +12 -30
  26. package/dist/CommentsPlugin.native-DHCDUm9f.mjs +0 -809
  27. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +0 -1161
  28. package/dist/MediaManagerPlugin.native-CRi24Mrb.mjs +0 -1057
  29. package/dist/confirmDialog-BP8hZPpX.mjs +0 -112
  30. package/dist/index--wO0CZVN.js +0 -12
@@ -1,809 +0,0 @@
1
- import { f as D, p as B, k as $ } from "./dialogHelpers-Dzn8DHoF.mjs";
2
- import { r as P } from "./historyHelpers-B0-4mq1E.mjs";
3
- const w = /* @__PURE__ */ new WeakMap();
4
- let g = null, R = !1, H = 0;
5
- const T = "User";
6
- function S(e) {
7
- return H += 1, `${e}-${Date.now()}-${H}`;
8
- }
9
- function v(e) {
10
- if (!e) return null;
11
- const t = e instanceof Element ? e : e.parentElement;
12
- return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
13
- }
14
- function q(e) {
15
- const t = (e == null ? void 0 : e.editorElement) || (e == null ? void 0 : e.contentElement) || null;
16
- if (!(t instanceof HTMLElement)) return;
17
- const r = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
18
- r && (g = r);
19
- }
20
- function k(e, t) {
21
- return t.contains(e.commonAncestorContainer);
22
- }
23
- function O() {
24
- if (typeof window != "undefined") {
25
- const o = window.__editoraCommandEditorRoot;
26
- if (o instanceof HTMLElement) {
27
- const n = o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? o : null);
28
- if (n)
29
- return g = n, window.__editoraCommandEditorRoot = null, n;
30
- }
31
- }
32
- const e = document.activeElement, t = e ? v(e) : null;
33
- if (t) return t;
34
- const r = window.getSelection();
35
- if (r && r.rangeCount > 0) {
36
- const o = v(
37
- r.getRangeAt(0).commonAncestorContainer
38
- );
39
- if (o) return o;
40
- }
41
- return g;
42
- }
43
- function F(e) {
44
- const t = w.get(e);
45
- if (t) return t;
46
- const r = {
47
- root: e,
48
- comments: /* @__PURE__ */ new Map(),
49
- panelVisible: !1,
50
- panelElement: null,
51
- expandedComments: /* @__PURE__ */ new Set(),
52
- replyTexts: {},
53
- savedSelection: null,
54
- newCommentText: "",
55
- selectionChangeListener: null
56
- };
57
- return w.set(e, r), r;
58
- }
59
- function u() {
60
- const e = O();
61
- return e ? (g = e, F(e)) : null;
62
- }
63
- function I(e) {
64
- const t = window.getSelection();
65
- if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
66
- const r = t.getRangeAt(0);
67
- return k(r, e) ? r.cloneRange() : null;
68
- }
69
- function _(e) {
70
- return e.root.querySelector(".rte-content") || e.root.querySelector("[contenteditable]");
71
- }
72
- function E(e, t) {
73
- return t.anchorId ? e.root.querySelector(`[id="${t.anchorId}"]`) : null;
74
- }
75
- function j(e) {
76
- const t = [];
77
- return e.comments.forEach((r) => {
78
- if (r.anchorId) {
79
- const o = E(e, r);
80
- if (!o) return;
81
- r.resolved = o.classList.contains("rte-comment-anchor-resolved");
82
- }
83
- t.push(r);
84
- }), t;
85
- }
86
- function A(e, t) {
87
- const r = _(e), o = r ? r.innerHTML : "", n = t();
88
- return r && r.innerHTML !== o && (P(r, o), r.dispatchEvent(new Event("input", { bubbles: !0 }))), n;
89
- }
90
- function M(e, t) {
91
- const r = E(e, t);
92
- r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
93
- }
94
- function y(e, t, r) {
95
- const o = e.comments.get(t);
96
- if (!o) return;
97
- const n = E(e, o);
98
- n && n.classList.toggle("highlighted", r);
99
- }
100
- function Z(e) {
101
- const t = e.parentNode;
102
- if (t) {
103
- for (; e.firstChild; )
104
- t.insertBefore(e.firstChild, e);
105
- e.remove();
106
- }
107
- }
108
- function C(e, t) {
109
- var r;
110
- if (e.panelVisible = t, t) {
111
- re(), K(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), U(e), D(e.panelElement);
112
- return;
113
- }
114
- if (e.root.removeAttribute("data-rte-comments-open"), W(e), e.panelElement) {
115
- const o = B(e.panelElement);
116
- e.panelElement.remove(), e.panelElement = null, o && ((r = e.root.querySelector('[contenteditable="true"]')) == null || r.focus({ preventScroll: !0 }));
117
- }
118
- }
119
- function K(e) {
120
- if (e.panelElement) return;
121
- const t = document.createElement("aside");
122
- t.className = "rte-comments-panel", t.setAttribute("role", "complementary"), t.setAttribute("aria-label", "Comments"), t.setAttribute("aria-hidden", "true"), window.getComputedStyle(e.root).position === "static" && (e.root.style.position = "relative"), e.root.appendChild(t), e.panelElement = t;
123
- }
124
- function U(e) {
125
- e.selectionChangeListener || (e.selectionChangeListener = () => {
126
- const t = window.getSelection();
127
- if (!t || t.rangeCount === 0 || t.isCollapsed) return;
128
- const r = t.getRangeAt(0);
129
- k(r, e.root) && (e.savedSelection = r.cloneRange(), g = e.root);
130
- }, document.addEventListener("selectionchange", e.selectionChangeListener));
131
- }
132
- function W(e) {
133
- e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
134
- }
135
- function N(e) {
136
- return j(e).sort((t, r) => r.createdAt.localeCompare(t.createdAt));
137
- }
138
- function z(e) {
139
- return new Date(e).toLocaleString();
140
- }
141
- function X(e, t) {
142
- const r = e.expandedComments.has(t.id), o = document.createElement("article");
143
- o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
144
- <header class="rte-comment-header">
145
- <div class="rte-comment-meta">
146
- <strong class="rte-comment-author"></strong>
147
- <time class="rte-comment-date">${z(t.createdAt)}</time>
148
- </div>
149
- <button class="rte-comment-expand" type="button" aria-label="Toggle details">
150
- ${r ? "▾" : "▸"}
151
- </button>
152
- </header>
153
- <div class="rte-comment-text"></div>
154
- ${t.selectedText ? '<blockquote class="rte-comment-selection"></blockquote>' : ""}
155
- <section class="rte-comment-expanded${r ? " show" : ""}"></section>
156
- `;
157
- const n = o.querySelector(".rte-comment-author");
158
- n && (n.textContent = t.author);
159
- const i = o.querySelector(".rte-comment-text");
160
- i && (i.textContent = t.text);
161
- const f = o.querySelector(".rte-comment-selection");
162
- f && (f.textContent = t.selectedText);
163
- const p = o.querySelector(".rte-comment-expand");
164
- p == null || p.addEventListener("click", () => {
165
- e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), m(e);
166
- });
167
- const s = o.querySelector(".rte-comment-expanded");
168
- if (s && r) {
169
- if (t.replies.length > 0) {
170
- const a = document.createElement("div");
171
- a.className = "rte-comment-replies", t.replies.forEach((l) => {
172
- const d = document.createElement("div");
173
- d.className = "rte-comment-reply", d.innerHTML = `
174
- <div class="rte-comment-reply-header">
175
- <strong class="rte-comment-reply-author"></strong>
176
- <time>${z(l.createdAt)}</time>
177
- </div>
178
- <div class="rte-comment-reply-text"></div>
179
- `;
180
- const b = d.querySelector(".rte-comment-reply-author");
181
- b && (b.textContent = l.author);
182
- const x = d.querySelector(".rte-comment-reply-text");
183
- x && (x.textContent = l.text), a.appendChild(d);
184
- }), s.appendChild(a);
185
- }
186
- if (!t.resolved) {
187
- const a = document.createElement("div");
188
- a.className = "rte-comment-reply-composer", a.innerHTML = `
189
- <textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
190
- <button type="button" class="rte-comment-btn primary">Reply</button>
191
- `;
192
- const l = a.querySelector(
193
- ".rte-comment-reply-textarea"
194
- ), d = a.querySelector(
195
- ".rte-comment-btn.primary"
196
- );
197
- if (l && d) {
198
- l.value = e.replyTexts[t.id] || "";
199
- const b = () => {
200
- const x = !!l.value.trim();
201
- d.disabled = !x;
202
- };
203
- b(), l.addEventListener("input", () => {
204
- e.replyTexts[t.id] = l.value, b();
205
- }), d.addEventListener("click", () => {
206
- const x = l.value.trim();
207
- x && (te(t.id, T, x), e.replyTexts[t.id] = "", m(e));
208
- });
209
- }
210
- s.appendChild(a);
211
- }
212
- const c = document.createElement("div");
213
- if (c.className = "rte-comment-actions", t.anchorId) {
214
- const a = document.createElement("button");
215
- a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Jump to text", a.onclick = () => {
216
- const l = E(e, t);
217
- l && (l.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), y(e, t.id, !0), window.setTimeout(() => y(e, t.id, !1), 1200));
218
- }, c.appendChild(a);
219
- }
220
- if (t.resolved) {
221
- const a = document.createElement("button");
222
- a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Reopen", a.onclick = () => Y(t.id), c.appendChild(a);
223
- } else {
224
- const a = document.createElement("button");
225
- a.type = "button", a.className = "rte-comment-btn success", a.textContent = "Resolve", a.onclick = () => Q(t.id, T), c.appendChild(a);
226
- }
227
- const h = document.createElement("button");
228
- h.type = "button", h.className = "rte-comment-btn danger", h.textContent = "Delete", h.onclick = () => ee(t.id), c.appendChild(h), s.appendChild(c);
229
- }
230
- return o.addEventListener("mouseenter", () => y(e, t.id, !0)), o.addEventListener("mouseleave", () => y(e, t.id, !1)), o;
231
- }
232
- function m(e) {
233
- const t = e || u();
234
- if (!(t != null && t.panelElement)) return;
235
- const r = N(t), o = t.panelElement;
236
- $(o, () => {
237
- o.innerHTML = `
238
- <div class="rte-comments-header">
239
- <div>
240
- <h3>Comments (${r.length})</h3>
241
- <p>Select text and add comments, or add a general note.</p>
242
- </div>
243
- <button class="rte-comments-close" type="button" aria-label="Close comments panel">✕</button>
244
- </div>
245
- <div class="rte-comments-composer">
246
- <textarea class="new-comment-textarea" rows="3" placeholder="Add a comment..."></textarea>
247
- <div class="rte-comments-composer-actions">
248
- <button class="rte-comment-btn primary add-comment-btn" type="button">Add Comment</button>
249
- </div>
250
- </div>
251
- ${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
252
- `;
253
- });
254
- const n = t.panelElement.querySelector(".rte-comments-close");
255
- n == null || n.addEventListener("click", () => {
256
- var s;
257
- C(t, !1), (!t.root.contains(document.activeElement) || document.activeElement === document.body) && ((s = t.root.querySelector('[contenteditable="true"]')) == null || s.focus({ preventScroll: !0 }));
258
- });
259
- const i = t.panelElement.querySelector(
260
- ".new-comment-textarea"
261
- ), f = t.panelElement.querySelector(
262
- ".add-comment-btn"
263
- );
264
- if (i && f) {
265
- i.value = t.newCommentText;
266
- const s = () => {
267
- const c = !!i.value.trim();
268
- f.disabled = !c;
269
- };
270
- s(), i.addEventListener("input", () => {
271
- t.newCommentText = i.value, s();
272
- }), i.addEventListener("keydown", (c) => {
273
- (c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), f.click());
274
- }), f.addEventListener("click", () => {
275
- const c = i.value.trim();
276
- if (!c) return;
277
- const h = !!t.savedSelection;
278
- J(T, c, !h), t.newCommentText = "", m(t);
279
- });
280
- }
281
- const p = t.panelElement.querySelector(".rte-comments-list");
282
- p && r.forEach((s) => {
283
- p.appendChild(X(t, s));
284
- });
285
- }
286
- const L = /* @__PURE__ */ new WeakMap();
287
- function G(e) {
288
- L.has(e) || L.set(
289
- e,
290
- window.setTimeout(() => {
291
- L.delete(e), e.panelVisible && m(e);
292
- }, 120)
293
- );
294
- }
295
- function V() {
296
- R || (R = !0, document.addEventListener("focusin", (e) => {
297
- const t = v(e.target);
298
- t && (g = t);
299
- }), document.addEventListener("click", (e) => {
300
- const t = e.target instanceof Element ? e.target : null, r = t == null ? void 0 : t.closest(".rte-comment-anchor");
301
- if (!r) return;
302
- const o = v(r), n = o ? w.get(o) : null, i = r.getAttribute("data-comment-id");
303
- !n || !i || !n.comments.has(i) || (e.preventDefault(), e.stopPropagation(), g = n.root, n.expandedComments.add(i), C(n, !0), m(n));
304
- }), document.addEventListener("input", (e) => {
305
- const t = e.target instanceof Element ? e.target : null;
306
- if (!t || t.closest(".rte-comments-panel")) return;
307
- const r = v(t), o = r ? w.get(r) : null;
308
- o != null && o.panelVisible && G(o);
309
- }), document.addEventListener("selectionchange", () => {
310
- const e = window.getSelection();
311
- if (!e || e.rangeCount === 0) return;
312
- const t = e.getRangeAt(0), r = v(t.commonAncestorContainer);
313
- if (!r) return;
314
- g = r;
315
- const o = w.get(r);
316
- !o || e.isCollapsed || k(t, r) && (o.savedSelection = t.cloneRange());
317
- }), document.addEventListener(
318
- "keydown",
319
- (e) => {
320
- if (e.key !== "Escape") return;
321
- const t = u();
322
- !t || !t.panelVisible || (e.preventDefault(), e.stopPropagation(), C(t, !1));
323
- },
324
- !0
325
- ));
326
- }
327
- function ae() {
328
- const e = u();
329
- return e ? N(e) : [];
330
- }
331
- function J(e, t, r = !1) {
332
- const o = u();
333
- if (!o) return "";
334
- const n = t.trim();
335
- if (!n) return "";
336
- if (r) {
337
- const l = S("comment");
338
- return o.comments.set(l, {
339
- id: l,
340
- anchorId: "",
341
- selectedText: "",
342
- author: e,
343
- text: n,
344
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
345
- resolved: !1,
346
- replies: []
347
- }), m(o), l;
348
- }
349
- const i = o.savedSelection || I(o.root);
350
- if (!i || !k(i, o.root)) return "";
351
- const f = i.toString().trim();
352
- if (!f) return "";
353
- const p = S("comment"), s = S("comment-anchor"), c = document.createElement("span");
354
- if (c.id = s, c.className = "rte-comment-anchor", c.setAttribute("data-comment-id", p), c.setAttribute("title", "Commented text"), !A(o, () => {
355
- var l;
356
- try {
357
- const d = i.cloneRange(), b = d.extractContents();
358
- return (l = b.textContent) != null && l.trim() ? (c.appendChild(b), d.insertNode(c), !0) : !1;
359
- } catch (d) {
360
- return !1;
361
- }
362
- })) return "";
363
- o.comments.set(p, {
364
- id: p,
365
- anchorId: s,
366
- selectedText: f,
367
- author: e,
368
- text: n,
369
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
370
- resolved: !1,
371
- replies: []
372
- }), o.savedSelection = null;
373
- const a = window.getSelection();
374
- return a == null || a.removeAllRanges(), m(o), p;
375
- }
376
- function Q(e, t) {
377
- const r = u();
378
- if (!r) return;
379
- const o = r.comments.get(e);
380
- o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), A(r, () => M(r, o)), m(r));
381
- }
382
- function Y(e) {
383
- const t = u();
384
- if (!t) return;
385
- const r = t.comments.get(e);
386
- r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, A(t, () => M(t, r)), m(t));
387
- }
388
- function ee(e) {
389
- const t = u();
390
- if (!t) return;
391
- const r = t.comments.get(e);
392
- if (r) {
393
- if (r.anchorId) {
394
- const o = E(t, r);
395
- o && A(t, () => Z(o));
396
- } else
397
- t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e];
398
- m(t);
399
- }
400
- }
401
- function te(e, t, r) {
402
- const o = u();
403
- if (!o) return;
404
- const n = o.comments.get(e);
405
- if (!n) return;
406
- const i = r.trim();
407
- i && (n.replies.push({
408
- id: S("reply"),
409
- author: t,
410
- text: i,
411
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
412
- }), m(o));
413
- }
414
- function ie(e, t) {
415
- const r = u();
416
- r && y(r, e, t);
417
- }
418
- function re() {
419
- if (document.getElementById("rte-comments-panel-styles")) return;
420
- const e = document.createElement("style");
421
- e.id = "rte-comments-panel-styles", e.textContent = `
422
- .rte-comments-panel {
423
- --rte-comments-panel-width: min(360px, 42vw);
424
- position: absolute;
425
- top: 0;
426
- right: 0;
427
- bottom: 0;
428
- width: var(--rte-comments-panel-width);
429
- display: flex;
430
- flex-direction: column;
431
- background: var(--rte-color-bg-primary, #ffffff);
432
- color: var(--rte-color-text-primary, #111827);
433
- border-left: 1px solid var(--rte-color-border, #d1d5db);
434
- box-shadow: -12px 0 28px rgba(15, 23, 42, 0.2);
435
- transform: translateX(100%);
436
- opacity: 0;
437
- pointer-events: none;
438
- transition: transform 180ms ease, opacity 180ms ease;
439
- /* Above the editor's sticky toolbar (z-index 100): on a narrow screen the panel lies over the editor, and
440
- under the toolbar its header, and the button that closes it, could not be clicked. */
441
- z-index: 110;
442
- }
443
-
444
- .rte-comments-panel.is-open {
445
- transform: translateX(0);
446
- opacity: 1;
447
- pointer-events: auto;
448
- }
449
-
450
- /* The panel's width is set on the editor itself, not only on the panel: the toolbar and the text make room for the
451
- panel with a margin of that width, and a variable set on the panel is not visible to them (the margin was
452
- silently 0, so the panel lay over the toolbar and the text and its header could not be reached). */
453
- [data-rte-comments-open="true"] {
454
- --rte-comments-panel-width: min(360px, 42vw);
455
- }
456
-
457
- /* The toolbar's wrapper is the element that is as wide as the editor, and it sits above the panel (it is sticky,
458
- z-index 100): it has to give up the panel's width too, or its empty right-hand end covers the panel's header. */
459
- [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) {
460
- margin-right: var(--rte-comments-panel-width);
461
- transition: margin-right 180ms ease;
462
- }
463
-
464
- .rte-comments-header {
465
- display: flex;
466
- justify-content: space-between;
467
- align-items: flex-start;
468
- gap: 12px;
469
- padding: 14px 14px 12px;
470
- border-bottom: 1px solid var(--rte-color-border-light, #e5e7eb);
471
- background: var(--rte-color-bg-secondary, #f8fafc);
472
- }
473
-
474
- .rte-comments-header h3 {
475
- margin: 0;
476
- font-size: 15px;
477
- line-height: 1.2;
478
- }
479
-
480
- .rte-comments-header p {
481
- margin: 6px 0 0;
482
- font-size: 12px;
483
- color: var(--rte-color-text-muted, #64748b);
484
- }
485
-
486
- .rte-comments-close {
487
- border: 1px solid var(--rte-color-border, #d1d5db);
488
- background: transparent;
489
- color: var(--rte-color-text-secondary, #475569);
490
- border-radius: 6px;
491
- width: 30px;
492
- height: 30px;
493
- cursor: pointer;
494
- font-size: 16px;
495
- line-height: 1;
496
- }
497
-
498
- .rte-comments-close:hover {
499
- background: var(--rte-color-bg-hover, #f1f5f9);
500
- color: var(--rte-color-text-primary, #0f172a);
501
- }
502
-
503
- .rte-comments-composer {
504
- display: flex;
505
- flex-direction: column;
506
- gap: 8px;
507
- padding: 12px 14px;
508
- border-bottom: 1px solid var(--rte-color-border-light, #e5e7eb);
509
- background: var(--rte-color-bg-secondary, #f8fafc);
510
- }
511
-
512
- .new-comment-textarea,
513
- .rte-comment-reply-textarea {
514
- width: 100%;
515
- resize: vertical;
516
- min-height: 62px;
517
- font-family: inherit;
518
- font-size: 13px;
519
- line-height: 1.35;
520
- border: 1px solid var(--rte-color-border, #d1d5db);
521
- border-radius: 8px;
522
- background: var(--rte-color-bg-primary, #ffffff);
523
- color: var(--rte-color-text-primary, #0f172a);
524
- padding: 8px 10px;
525
- outline: none;
526
- }
527
-
528
- .new-comment-textarea:focus,
529
- .rte-comment-reply-textarea:focus {
530
- border-color: var(--rte-color-border-focus, #2563eb);
531
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--rte-color-border-focus, #2563eb) 20%, transparent);
532
- }
533
-
534
- .rte-comments-composer-actions {
535
- display: flex;
536
- justify-content: flex-end;
537
- }
538
-
539
- .rte-comments-list {
540
- flex: 1;
541
- overflow: auto;
542
- padding: 12px;
543
- display: flex;
544
- flex-direction: column;
545
- gap: 10px;
546
- }
547
-
548
- .rte-comments-empty {
549
- padding: 18px 14px;
550
- color: var(--rte-color-text-muted, #64748b);
551
- font-size: 13px;
552
- }
553
-
554
- .rte-comment-item {
555
- border: 1px solid var(--rte-color-border-light, #e5e7eb);
556
- border-radius: 10px;
557
- background: var(--rte-color-bg-primary, #ffffff);
558
- padding: 10px;
559
- }
560
-
561
- .rte-comment-item.resolved {
562
- opacity: 0.74;
563
- }
564
-
565
- .rte-comment-header {
566
- display: flex;
567
- align-items: flex-start;
568
- justify-content: space-between;
569
- gap: 8px;
570
- }
571
-
572
- .rte-comment-meta {
573
- display: flex;
574
- flex-direction: column;
575
- gap: 2px;
576
- }
577
-
578
- .rte-comment-author {
579
- font-size: 13px;
580
- color: var(--rte-color-text-primary, #0f172a);
581
- }
582
-
583
- .rte-comment-date {
584
- font-size: 11px;
585
- color: var(--rte-color-text-muted, #64748b);
586
- }
587
-
588
- .rte-comment-expand {
589
- border: none;
590
- background: transparent;
591
- cursor: pointer;
592
- color: var(--rte-color-text-secondary, #475569);
593
- font-size: 16px;
594
- line-height: 1;
595
- padding: 0;
596
- }
597
-
598
- .rte-comment-text {
599
- margin-top: 8px;
600
- font-size: 13px;
601
- line-height: 1.45;
602
- color: var(--rte-color-text-primary, #0f172a);
603
- white-space: pre-wrap;
604
- word-break: break-word;
605
- }
606
-
607
- .rte-comment-selection {
608
- margin: 8px 0 0;
609
- border-left: 3px solid var(--rte-color-primary, #2563eb);
610
- background: var(--rte-color-bg-secondary, #f8fafc);
611
- color: var(--rte-color-text-secondary, #475569);
612
- padding: 6px 8px;
613
- border-radius: 6px;
614
- font-size: 12px;
615
- font-style: italic;
616
- white-space: pre-wrap;
617
- word-break: break-word;
618
- }
619
-
620
- .rte-comment-expanded {
621
- display: none;
622
- margin-top: 10px;
623
- padding-top: 10px;
624
- border-top: 1px solid var(--rte-color-border-light, #e5e7eb);
625
- }
626
-
627
- .rte-comment-expanded.show {
628
- display: block;
629
- }
630
-
631
- .rte-comment-replies {
632
- display: flex;
633
- flex-direction: column;
634
- gap: 8px;
635
- margin-bottom: 10px;
636
- }
637
-
638
- .rte-comment-reply {
639
- border: 1px solid var(--rte-color-border-light, #e5e7eb);
640
- border-radius: 8px;
641
- padding: 8px;
642
- background: var(--rte-color-bg-secondary, #f8fafc);
643
- }
644
-
645
- .rte-comment-reply-header {
646
- display: flex;
647
- justify-content: space-between;
648
- gap: 8px;
649
- margin-bottom: 4px;
650
- font-size: 11px;
651
- color: var(--rte-color-text-muted, #64748b);
652
- }
653
-
654
- .rte-comment-reply-text {
655
- font-size: 12px;
656
- color: var(--rte-color-text-secondary, #334155);
657
- white-space: pre-wrap;
658
- word-break: break-word;
659
- }
660
-
661
- .rte-comment-reply-composer {
662
- display: flex;
663
- flex-direction: column;
664
- gap: 8px;
665
- margin-bottom: 10px;
666
- }
667
-
668
- .rte-comment-actions {
669
- display: flex;
670
- justify-content: flex-end;
671
- flex-wrap: wrap;
672
- gap: 6px;
673
- }
674
-
675
- .rte-comment-btn {
676
- border: 1px solid var(--rte-color-border, #d1d5db);
677
- border-radius: 7px;
678
- padding: 5px 9px;
679
- font-size: 12px;
680
- cursor: pointer;
681
- background: var(--rte-color-bg-primary, #ffffff);
682
- color: var(--rte-color-text-secondary, #334155);
683
- }
684
-
685
- .rte-comment-btn:hover {
686
- background: var(--rte-color-bg-hover, #f1f5f9);
687
- color: var(--rte-color-text-primary, #0f172a);
688
- }
689
-
690
- .rte-comment-btn:disabled {
691
- opacity: 0.5;
692
- cursor: not-allowed;
693
- }
694
-
695
- .rte-comment-btn.primary {
696
- border-color: var(--rte-color-primary, #2563eb);
697
- background: var(--rte-color-primary, #2563eb);
698
- color: var(--rte-color-text-inverse, #ffffff);
699
- }
700
-
701
- .rte-comment-btn.primary:hover {
702
- background: var(--rte-color-primary-hover, #1d4ed8);
703
- border-color: var(--rte-color-primary-hover, #1d4ed8);
704
- color: var(--rte-color-text-inverse, #ffffff);
705
- }
706
-
707
- .rte-comment-btn.success {
708
- border-color: color-mix(in srgb, var(--rte-color-success, #15803d) 60%, transparent);
709
- color: var(--rte-color-success, #15803d);
710
- }
711
-
712
- .rte-comment-btn.danger {
713
- border-color: color-mix(in srgb, var(--rte-color-danger, #b91c1c) 60%, transparent);
714
- color: var(--rte-color-danger, #b91c1c);
715
- }
716
-
717
- .rte-comment-anchor {
718
- background: rgba(250, 204, 21, 0.34);
719
- border-bottom: 2px solid rgba(217, 119, 6, 0.75);
720
- border-radius: 2px;
721
- cursor: pointer;
722
- transition: outline-color 120ms ease, box-shadow 120ms ease;
723
- }
724
-
725
- .rte-comment-anchor.rte-comment-anchor-resolved {
726
- background: rgba(148, 163, 184, 0.2);
727
- border-bottom-color: rgba(100, 116, 139, 0.6);
728
- }
729
-
730
- .rte-comment-anchor.highlighted {
731
- outline: 2px solid var(--rte-color-primary, #2563eb);
732
- outline-offset: 2px;
733
- }
734
-
735
- :is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-comments-panel {
736
- box-shadow: -14px 0 30px rgba(0, 0, 0, 0.45);
737
- }
738
-
739
- @media (max-width: 900px) {
740
- [data-rte-comments-open="true"],
741
- .rte-comments-panel {
742
- --rte-comments-panel-width: min(420px, 100%);
743
- }
744
-
745
- [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) {
746
- margin-right: 0;
747
- }
748
- }
749
- `, document.head.appendChild(e);
750
- }
751
- const ce = () => ({
752
- name: "comments",
753
- toolbar: [
754
- {
755
- label: "Add Comment",
756
- command: "addComment",
757
- type: "button",
758
- // The upstream SVGRepo export used a class-based <style> block for the
759
- // transparent bounding rect (`.cls-1{fill:none}`). That's fine when an
760
- // icon is scoped (shadow DOM, or one icon per page) but this markup is
761
- // inserted via raw innerHTML into plain light-DOM content alongside
762
- // every other plugin's icons, so the <style> tag applies document-wide
763
- // - any other icon reusing the same auto-generated class name would
764
- // collide with it. Inlined the one declaration it held (fill="none")
765
- // directly on the rect instead, so there's nothing to leak.
766
- 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>'
767
- },
768
- {
769
- label: "Show / Hide Comments",
770
- command: "toggleComments",
771
- type: "button",
772
- 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>'
773
- }
774
- ],
775
- commands: {
776
- addComment: (e, t) => {
777
- var n;
778
- q(t), V();
779
- const r = u();
780
- if (!r) return !1;
781
- if (r.savedSelection = I(r.root), r.savedSelection) {
782
- const i = window.getSelection();
783
- i == null || i.removeAllRanges();
784
- }
785
- C(r, !0), m(r);
786
- const o = (n = r.panelElement) == null ? void 0 : n.querySelector(
787
- ".new-comment-textarea"
788
- );
789
- return o == null || o.focus({ preventScroll: !0 }), !0;
790
- },
791
- toggleComments: (e, t) => {
792
- q(t), V();
793
- const r = u();
794
- return r ? (C(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
795
- }
796
- },
797
- keymap: {}
798
- });
799
- export {
800
- ce as CommentsPlugin,
801
- J as addCommentCommand,
802
- ee as deleteComment,
803
- ae as getAllComments,
804
- ie as highlightComment,
805
- Y as reopenComment,
806
- te as replyToComment,
807
- Q as resolveComment
808
- };
809
- //# sourceMappingURL=CommentsPlugin.native-DHCDUm9f.mjs.map