@editora/core 1.0.22 → 1.0.24

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 (65) hide show
  1. package/README.md +247 -243
  2. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  3. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  4. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  5. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  6. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  7. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  8. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
  9. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  10. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  11. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  12. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  13. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  14. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  15. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
  16. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  17. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  18. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  19. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  20. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  21. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  22. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  23. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  24. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
  25. package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
  26. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  27. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  28. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  29. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  30. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  31. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  32. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  33. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  34. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  35. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  36. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  37. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  38. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  39. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  40. package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
  41. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  42. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
  43. package/dist/editora.min.js +21 -21
  44. package/dist/editora.umd.js +10 -10
  45. package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
  46. package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
  47. package/dist/index.cjs.js +1 -1
  48. package/dist/index.esm.js +2 -2
  49. package/dist/katex-DLIObQUm.mjs +11683 -0
  50. package/dist/katex.min--Ws3c9be.mjs +6 -0
  51. package/dist/notify-DCQGpmq-.mjs +60 -0
  52. package/dist/plugin-loader.js +54 -54
  53. package/dist/webcomponent-core.js +305 -234
  54. package/dist/webcomponent-core.min.css +1 -1
  55. package/dist/webcomponent-core.min.js +153 -80
  56. package/dist/webcomponent.cjs.js +1 -1
  57. package/dist/webcomponent.esm.js +1 -1
  58. package/dist/webcomponent.js +631 -560
  59. package/dist/webcomponent.min.css +1 -1
  60. package/dist/webcomponent.min.js +1677 -1328
  61. package/package.json +1 -1
  62. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  63. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  64. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  65. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
@@ -1,5 +1,5 @@
1
1
  import { e as U } from "./escapeHtml-CX8RelZ1.mjs";
2
- import { i as F } from "./dialogHelpers-DBf7WqYH.mjs";
2
+ import { i as F } from "./dialogHelpers-Dzn8DHoF.mjs";
3
3
  import { r as P } from "./historyHelpers-B0-4mq1E.mjs";
4
4
  const G = /* @__PURE__ */ new Set([
5
5
  "DIV",
@@ -98,7 +98,7 @@ function O(t, o, e, n) {
98
98
  cancelBg: "#334155",
99
99
  cancelHover: "#475569",
100
100
  cancelText: "#e2e8f0",
101
- primaryBg: "#3b82f6",
101
+ primaryBg: "#2563eb",
102
102
  primaryHover: "#2563eb"
103
103
  } : {
104
104
  overlay: "rgba(0, 0, 0, 0.5)",
@@ -164,8 +164,8 @@ function O(t, o, e, n) {
164
164
  `;
165
165
  const k = document.createElement("div");
166
166
  k.style.marginBottom = "20px", k.innerHTML = `
167
- <label style="display: block; margin-bottom: 8px; font-weight: 500; color: ${a.text}; font-size: 14px;">Language</label>
168
- <select class="rte-code-language" style="
167
+ <label for="rte-code-language-select" style="display: block; margin-bottom: 8px; font-weight: 500; color: ${a.text}; font-size: 14px;">Language</label>
168
+ <select id="rte-code-language-select" class="rte-code-language" style="
169
169
  width: 100%;
170
170
  padding: 10px 12px;
171
171
  border: 1px solid ${a.fieldBorder};
@@ -498,4 +498,4 @@ const ie = () => ({
498
498
  export {
499
499
  ie as CodeSamplePlugin
500
500
  };
501
- //# sourceMappingURL=CodeSamplePlugin.native-svbAFWh_.mjs.map
501
+ //# sourceMappingURL=CodeSamplePlugin.native-Bai8bgl3.mjs.map
@@ -1,6 +1,7 @@
1
- import { r as D } from "./historyHelpers-B0-4mq1E.mjs";
1
+ import { f as D, p as B, k as $ } from "./dialogHelpers-Dzn8DHoF.mjs";
2
+ import { r as P } from "./historyHelpers-B0-4mq1E.mjs";
2
3
  const w = /* @__PURE__ */ new WeakMap();
3
- let x = null, R = !1, H = 0;
4
+ let g = null, R = !1, H = 0;
4
5
  const T = "User";
5
6
  function S(e) {
6
7
  return H += 1, `${e}-${Date.now()}-${H}`;
@@ -14,18 +15,18 @@ function q(e) {
14
15
  const t = (e == null ? void 0 : e.editorElement) || (e == null ? void 0 : e.contentElement) || null;
15
16
  if (!(t instanceof HTMLElement)) return;
16
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);
17
- r && (x = r);
18
+ r && (g = r);
18
19
  }
19
20
  function k(e, t) {
20
21
  return t.contains(e.commonAncestorContainer);
21
22
  }
22
- function B() {
23
+ function O() {
23
24
  if (typeof window != "undefined") {
24
25
  const o = window.__editoraCommandEditorRoot;
25
26
  if (o instanceof HTMLElement) {
26
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);
27
28
  if (n)
28
- return x = n, window.__editoraCommandEditorRoot = null, n;
29
+ return g = n, window.__editoraCommandEditorRoot = null, n;
29
30
  }
30
31
  }
31
32
  const e = document.activeElement, t = e ? v(e) : null;
@@ -37,9 +38,9 @@ function B() {
37
38
  );
38
39
  if (o) return o;
39
40
  }
40
- return x;
41
+ return g;
41
42
  }
42
- function $(e) {
43
+ function F(e) {
43
44
  const t = w.get(e);
44
45
  if (t) return t;
45
46
  const r = {
@@ -56,22 +57,22 @@ function $(e) {
56
57
  return w.set(e, r), r;
57
58
  }
58
59
  function u() {
59
- const e = B();
60
- return e ? (x = e, $(e)) : null;
60
+ const e = O();
61
+ return e ? (g = e, F(e)) : null;
61
62
  }
62
- function M(e) {
63
+ function I(e) {
63
64
  const t = window.getSelection();
64
65
  if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
65
66
  const r = t.getRangeAt(0);
66
67
  return k(r, e) ? r.cloneRange() : null;
67
68
  }
68
- function O(e) {
69
+ function _(e) {
69
70
  return e.root.querySelector(".rte-content") || e.root.querySelector("[contenteditable]");
70
71
  }
71
72
  function E(e, t) {
72
73
  return t.anchorId ? e.root.querySelector(`[id="${t.anchorId}"]`) : null;
73
74
  }
74
- function P(e) {
75
+ function j(e) {
75
76
  const t = [];
76
77
  return e.comments.forEach((r) => {
77
78
  if (r.anchorId) {
@@ -83,10 +84,10 @@ function P(e) {
83
84
  }), t;
84
85
  }
85
86
  function A(e, t) {
86
- const r = O(e), o = r ? r.innerHTML : "", n = t();
87
- return r && r.innerHTML !== o && (D(r, o), r.dispatchEvent(new Event("input", { bubbles: !0 }))), n;
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;
88
89
  }
89
- function N(e, t) {
90
+ function M(e, t) {
90
91
  const r = E(e, t);
91
92
  r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
92
93
  }
@@ -96,7 +97,7 @@ function y(e, t, r) {
96
97
  const n = E(e, o);
97
98
  n && n.classList.toggle("highlighted", r);
98
99
  }
99
- function _(e) {
100
+ function Z(e) {
100
101
  const t = e.parentNode;
101
102
  if (t) {
102
103
  for (; e.firstChild; )
@@ -105,41 +106,45 @@ function _(e) {
105
106
  }
106
107
  }
107
108
  function C(e, t) {
109
+ var r;
108
110
  if (e.panelVisible = t, t) {
109
- Y(), j(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), F(e);
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);
110
112
  return;
111
113
  }
112
- e.root.removeAttribute("data-rte-comments-open"), Z(e), e.panelElement && (e.panelElement.remove(), e.panelElement = null);
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
+ }
113
118
  }
114
- function j(e) {
119
+ function K(e) {
115
120
  if (e.panelElement) return;
116
121
  const t = document.createElement("aside");
117
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;
118
123
  }
119
- function F(e) {
124
+ function U(e) {
120
125
  e.selectionChangeListener || (e.selectionChangeListener = () => {
121
126
  const t = window.getSelection();
122
127
  if (!t || t.rangeCount === 0 || t.isCollapsed) return;
123
128
  const r = t.getRangeAt(0);
124
- k(r, e.root) && (e.savedSelection = r.cloneRange(), x = e.root);
129
+ k(r, e.root) && (e.savedSelection = r.cloneRange(), g = e.root);
125
130
  }, document.addEventListener("selectionchange", e.selectionChangeListener));
126
131
  }
127
- function Z(e) {
132
+ function W(e) {
128
133
  e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
129
134
  }
130
- function z(e) {
131
- return P(e).sort((t, r) => r.createdAt.localeCompare(t.createdAt));
135
+ function N(e) {
136
+ return j(e).sort((t, r) => r.createdAt.localeCompare(t.createdAt));
132
137
  }
133
- function V(e) {
138
+ function z(e) {
134
139
  return new Date(e).toLocaleString();
135
140
  }
136
- function K(e, t) {
141
+ function X(e, t) {
137
142
  const r = e.expandedComments.has(t.id), o = document.createElement("article");
138
143
  o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
139
144
  <header class="rte-comment-header">
140
145
  <div class="rte-comment-meta">
141
146
  <strong class="rte-comment-author"></strong>
142
- <time class="rte-comment-date">${V(t.createdAt)}</time>
147
+ <time class="rte-comment-date">${z(t.createdAt)}</time>
143
148
  </div>
144
149
  <button class="rte-comment-expand" type="button" aria-label="Toggle details">
145
150
  ${r ? "▾" : "▸"}
@@ -155,28 +160,28 @@ function K(e, t) {
155
160
  i && (i.textContent = t.text);
156
161
  const f = o.querySelector(".rte-comment-selection");
157
162
  f && (f.textContent = t.selectedText);
158
- const d = o.querySelector(".rte-comment-expand");
159
- d == null || d.addEventListener("click", () => {
160
- e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), p(e);
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);
161
166
  });
162
- const l = o.querySelector(".rte-comment-expanded");
163
- if (l && r) {
167
+ const s = o.querySelector(".rte-comment-expanded");
168
+ if (s && r) {
164
169
  if (t.replies.length > 0) {
165
170
  const a = document.createElement("div");
166
- a.className = "rte-comment-replies", t.replies.forEach((c) => {
167
- const m = document.createElement("div");
168
- m.className = "rte-comment-reply", m.innerHTML = `
171
+ a.className = "rte-comment-replies", t.replies.forEach((l) => {
172
+ const d = document.createElement("div");
173
+ d.className = "rte-comment-reply", d.innerHTML = `
169
174
  <div class="rte-comment-reply-header">
170
175
  <strong class="rte-comment-reply-author"></strong>
171
- <time>${V(c.createdAt)}</time>
176
+ <time>${z(l.createdAt)}</time>
172
177
  </div>
173
178
  <div class="rte-comment-reply-text"></div>
174
179
  `;
175
- const g = m.querySelector(".rte-comment-reply-author");
176
- g && (g.textContent = c.author);
177
- const b = m.querySelector(".rte-comment-reply-text");
178
- b && (b.textContent = c.text), a.appendChild(m);
179
- }), l.appendChild(a);
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);
180
185
  }
181
186
  if (!t.resolved) {
182
187
  const a = document.createElement("div");
@@ -184,51 +189,52 @@ function K(e, t) {
184
189
  <textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
185
190
  <button type="button" class="rte-comment-btn primary">Reply</button>
186
191
  `;
187
- const c = a.querySelector(
192
+ const l = a.querySelector(
188
193
  ".rte-comment-reply-textarea"
189
- ), m = a.querySelector(
194
+ ), d = a.querySelector(
190
195
  ".rte-comment-btn.primary"
191
196
  );
192
- if (c && m) {
193
- c.value = e.replyTexts[t.id] || "";
194
- const g = () => {
195
- const b = !!c.value.trim();
196
- m.disabled = !b;
197
+ if (l && d) {
198
+ l.value = e.replyTexts[t.id] || "";
199
+ const b = () => {
200
+ const x = !!l.value.trim();
201
+ d.disabled = !x;
197
202
  };
198
- g(), c.addEventListener("input", () => {
199
- e.replyTexts[t.id] = c.value, g();
200
- }), m.addEventListener("click", () => {
201
- const b = c.value.trim();
202
- b && (Q(t.id, T, b), e.replyTexts[t.id] = "", p(e));
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));
203
208
  });
204
209
  }
205
- l.appendChild(a);
210
+ s.appendChild(a);
206
211
  }
207
- const s = document.createElement("div");
208
- if (s.className = "rte-comment-actions", t.anchorId) {
212
+ const c = document.createElement("div");
213
+ if (c.className = "rte-comment-actions", t.anchorId) {
209
214
  const a = document.createElement("button");
210
215
  a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Jump to text", a.onclick = () => {
211
- const c = E(e, t);
212
- c && (c.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), y(e, t.id, !0), window.setTimeout(() => y(e, t.id, !1), 1200));
213
- }, s.appendChild(a);
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);
214
219
  }
215
220
  if (t.resolved) {
216
221
  const a = document.createElement("button");
217
- a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Reopen", a.onclick = () => G(t.id), s.appendChild(a);
222
+ a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Reopen", a.onclick = () => Y(t.id), c.appendChild(a);
218
223
  } else {
219
224
  const a = document.createElement("button");
220
- a.type = "button", a.className = "rte-comment-btn success", a.textContent = "Resolve", a.onclick = () => X(t.id, T), s.appendChild(a);
225
+ a.type = "button", a.className = "rte-comment-btn success", a.textContent = "Resolve", a.onclick = () => Q(t.id, T), c.appendChild(a);
221
226
  }
222
227
  const h = document.createElement("button");
223
- h.type = "button", h.className = "rte-comment-btn danger", h.textContent = "Delete", h.onclick = () => J(t.id), s.appendChild(h), l.appendChild(s);
228
+ h.type = "button", h.className = "rte-comment-btn danger", h.textContent = "Delete", h.onclick = () => ee(t.id), c.appendChild(h), s.appendChild(c);
224
229
  }
225
230
  return o.addEventListener("mouseenter", () => y(e, t.id, !0)), o.addEventListener("mouseleave", () => y(e, t.id, !1)), o;
226
231
  }
227
- function p(e) {
232
+ function m(e) {
228
233
  const t = e || u();
229
234
  if (!(t != null && t.panelElement)) return;
230
- const r = z(t);
231
- t.panelElement.innerHTML = `
235
+ const r = N(t), o = t.panelElement;
236
+ $(o, () => {
237
+ o.innerHTML = `
232
238
  <div class="rte-comments-header">
233
239
  <div>
234
240
  <h3>Comments (${r.length})</h3>
@@ -244,66 +250,68 @@ function p(e) {
244
250
  </div>
245
251
  ${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
246
252
  `;
247
- const o = t.panelElement.querySelector(".rte-comments-close");
248
- o == null || o.addEventListener("click", () => {
249
- C(t, !1);
250
253
  });
251
- const n = t.panelElement.querySelector(
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(
252
260
  ".new-comment-textarea"
253
- ), i = t.panelElement.querySelector(
261
+ ), f = t.panelElement.querySelector(
254
262
  ".add-comment-btn"
255
263
  );
256
- if (n && i) {
257
- n.value = t.newCommentText;
258
- const d = () => {
259
- const l = !!n.value.trim();
260
- i.disabled = !l;
264
+ if (i && f) {
265
+ i.value = t.newCommentText;
266
+ const s = () => {
267
+ const c = !!i.value.trim();
268
+ f.disabled = !c;
261
269
  };
262
- d(), n.addEventListener("input", () => {
263
- t.newCommentText = n.value, d();
264
- }), n.addEventListener("keydown", (l) => {
265
- (l.ctrlKey || l.metaKey) && l.key === "Enter" && (l.preventDefault(), i.click());
266
- }), i.addEventListener("click", () => {
267
- const l = n.value.trim();
268
- if (!l) return;
269
- const s = !!t.savedSelection;
270
- W(T, l, !s), t.newCommentText = "", p(t);
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);
271
279
  });
272
280
  }
273
- const f = t.panelElement.querySelector(".rte-comments-list");
274
- f && r.forEach((d) => {
275
- f.appendChild(K(t, d));
281
+ const p = t.panelElement.querySelector(".rte-comments-list");
282
+ p && r.forEach((s) => {
283
+ p.appendChild(X(t, s));
276
284
  });
277
285
  }
278
286
  const L = /* @__PURE__ */ new WeakMap();
279
- function U(e) {
287
+ function G(e) {
280
288
  L.has(e) || L.set(
281
289
  e,
282
290
  window.setTimeout(() => {
283
- L.delete(e), e.panelVisible && p(e);
291
+ L.delete(e), e.panelVisible && m(e);
284
292
  }, 120)
285
293
  );
286
294
  }
287
- function I() {
295
+ function V() {
288
296
  R || (R = !0, document.addEventListener("focusin", (e) => {
289
297
  const t = v(e.target);
290
- t && (x = t);
298
+ t && (g = t);
291
299
  }), document.addEventListener("click", (e) => {
292
300
  const t = e.target instanceof Element ? e.target : null, r = t == null ? void 0 : t.closest(".rte-comment-anchor");
293
301
  if (!r) return;
294
302
  const o = v(r), n = o ? w.get(o) : null, i = r.getAttribute("data-comment-id");
295
- !n || !i || !n.comments.has(i) || (e.preventDefault(), e.stopPropagation(), x = n.root, n.expandedComments.add(i), C(n, !0), p(n));
303
+ !n || !i || !n.comments.has(i) || (e.preventDefault(), e.stopPropagation(), g = n.root, n.expandedComments.add(i), C(n, !0), m(n));
296
304
  }), document.addEventListener("input", (e) => {
297
305
  const t = e.target instanceof Element ? e.target : null;
298
306
  if (!t || t.closest(".rte-comments-panel")) return;
299
307
  const r = v(t), o = r ? w.get(r) : null;
300
- o != null && o.panelVisible && U(o);
308
+ o != null && o.panelVisible && G(o);
301
309
  }), document.addEventListener("selectionchange", () => {
302
310
  const e = window.getSelection();
303
311
  if (!e || e.rangeCount === 0) return;
304
312
  const t = e.getRangeAt(0), r = v(t.commonAncestorContainer);
305
313
  if (!r) return;
306
- x = r;
314
+ g = r;
307
315
  const o = w.get(r);
308
316
  !o || e.isCollapsed || k(t, r) && (o.savedSelection = t.cloneRange());
309
317
  }), document.addEventListener(
@@ -316,19 +324,19 @@ function I() {
316
324
  !0
317
325
  ));
318
326
  }
319
- function te() {
327
+ function ae() {
320
328
  const e = u();
321
- return e ? z(e) : [];
329
+ return e ? N(e) : [];
322
330
  }
323
- function W(e, t, r = !1) {
331
+ function J(e, t, r = !1) {
324
332
  const o = u();
325
333
  if (!o) return "";
326
334
  const n = t.trim();
327
335
  if (!n) return "";
328
336
  if (r) {
329
- const c = S("comment");
330
- return o.comments.set(c, {
331
- id: c,
337
+ const l = S("comment");
338
+ return o.comments.set(l, {
339
+ id: l,
332
340
  anchorId: "",
333
341
  selectedText: "",
334
342
  author: e,
@@ -336,25 +344,25 @@ function W(e, t, r = !1) {
336
344
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
337
345
  resolved: !1,
338
346
  replies: []
339
- }), p(o), c;
347
+ }), m(o), l;
340
348
  }
341
- const i = o.savedSelection || M(o.root);
349
+ const i = o.savedSelection || I(o.root);
342
350
  if (!i || !k(i, o.root)) return "";
343
351
  const f = i.toString().trim();
344
352
  if (!f) return "";
345
- const d = S("comment"), l = S("comment-anchor"), s = document.createElement("span");
346
- if (s.id = l, s.className = "rte-comment-anchor", s.setAttribute("data-comment-id", d), s.setAttribute("title", "Commented text"), !A(o, () => {
347
- var c;
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;
348
356
  try {
349
- const m = i.cloneRange(), g = m.extractContents();
350
- return (c = g.textContent) != null && c.trim() ? (s.appendChild(g), m.insertNode(s), !0) : !1;
351
- } catch (m) {
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) {
352
360
  return !1;
353
361
  }
354
362
  })) return "";
355
- o.comments.set(d, {
356
- id: d,
357
- anchorId: l,
363
+ o.comments.set(p, {
364
+ id: p,
365
+ anchorId: s,
358
366
  selectedText: f,
359
367
  author: e,
360
368
  text: n,
@@ -363,34 +371,34 @@ function W(e, t, r = !1) {
363
371
  replies: []
364
372
  }), o.savedSelection = null;
365
373
  const a = window.getSelection();
366
- return a == null || a.removeAllRanges(), p(o), d;
374
+ return a == null || a.removeAllRanges(), m(o), p;
367
375
  }
368
- function X(e, t) {
376
+ function Q(e, t) {
369
377
  const r = u();
370
378
  if (!r) return;
371
379
  const o = r.comments.get(e);
372
- o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), A(r, () => N(r, o)), p(r));
380
+ o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), A(r, () => M(r, o)), m(r));
373
381
  }
374
- function G(e) {
382
+ function Y(e) {
375
383
  const t = u();
376
384
  if (!t) return;
377
385
  const r = t.comments.get(e);
378
- r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, A(t, () => N(t, r)), p(t));
386
+ r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, A(t, () => M(t, r)), m(t));
379
387
  }
380
- function J(e) {
388
+ function ee(e) {
381
389
  const t = u();
382
390
  if (!t) return;
383
391
  const r = t.comments.get(e);
384
392
  if (r) {
385
393
  if (r.anchorId) {
386
394
  const o = E(t, r);
387
- o && A(t, () => _(o));
395
+ o && A(t, () => Z(o));
388
396
  } else
389
397
  t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e];
390
- p(t);
398
+ m(t);
391
399
  }
392
400
  }
393
- function Q(e, t, r) {
401
+ function te(e, t, r) {
394
402
  const o = u();
395
403
  if (!o) return;
396
404
  const n = o.comments.get(e);
@@ -401,13 +409,13 @@ function Q(e, t, r) {
401
409
  author: t,
402
410
  text: i,
403
411
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
404
- }), p(o));
412
+ }), m(o));
405
413
  }
406
- function re(e, t) {
414
+ function ie(e, t) {
407
415
  const r = u();
408
416
  r && y(r, e, t);
409
417
  }
410
- function Y() {
418
+ function re() {
411
419
  if (document.getElementById("rte-comments-panel-styles")) return;
412
420
  const e = document.createElement("style");
413
421
  e.id = "rte-comments-panel-styles", e.textContent = `
@@ -428,7 +436,9 @@ function Y() {
428
436
  opacity: 0;
429
437
  pointer-events: none;
430
438
  transition: transform 180ms ease, opacity 180ms ease;
431
- z-index: 55;
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;
432
442
  }
433
443
 
434
444
  .rte-comments-panel.is-open {
@@ -437,7 +447,16 @@ function Y() {
437
447
  pointer-events: auto;
438
448
  }
439
449
 
440
- [data-rte-comments-open="true"] :is(.rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
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) {
441
460
  margin-right: var(--rte-comments-panel-width);
442
461
  transition: margin-right 180ms ease;
443
462
  }
@@ -718,17 +737,18 @@ function Y() {
718
737
  }
719
738
 
720
739
  @media (max-width: 900px) {
740
+ [data-rte-comments-open="true"],
721
741
  .rte-comments-panel {
722
742
  --rte-comments-panel-width: min(420px, 100%);
723
743
  }
724
744
 
725
- [data-rte-comments-open="true"] :is(.rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
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) {
726
746
  margin-right: 0;
727
747
  }
728
748
  }
729
749
  `, document.head.appendChild(e);
730
750
  }
731
- const oe = () => ({
751
+ const ce = () => ({
732
752
  name: "comments",
733
753
  toolbar: [
734
754
  {
@@ -755,35 +775,35 @@ const oe = () => ({
755
775
  commands: {
756
776
  addComment: (e, t) => {
757
777
  var n;
758
- q(t), I();
778
+ q(t), V();
759
779
  const r = u();
760
780
  if (!r) return !1;
761
- if (r.savedSelection = M(r.root), r.savedSelection) {
781
+ if (r.savedSelection = I(r.root), r.savedSelection) {
762
782
  const i = window.getSelection();
763
783
  i == null || i.removeAllRanges();
764
784
  }
765
- C(r, !0), p(r);
785
+ C(r, !0), m(r);
766
786
  const o = (n = r.panelElement) == null ? void 0 : n.querySelector(
767
787
  ".new-comment-textarea"
768
788
  );
769
789
  return o == null || o.focus({ preventScroll: !0 }), !0;
770
790
  },
771
791
  toggleComments: (e, t) => {
772
- q(t), I();
792
+ q(t), V();
773
793
  const r = u();
774
- return r ? (C(r, !r.panelVisible), r.panelVisible && p(r), !0) : !1;
794
+ return r ? (C(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
775
795
  }
776
796
  },
777
797
  keymap: {}
778
798
  });
779
799
  export {
780
- oe as CommentsPlugin,
781
- W as addCommentCommand,
782
- J as deleteComment,
783
- te as getAllComments,
784
- re as highlightComment,
785
- G as reopenComment,
786
- Q as replyToComment,
787
- X as resolveComment
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
788
808
  };
789
- //# sourceMappingURL=CommentsPlugin.native-DncTHiEe.mjs.map
809
+ //# sourceMappingURL=CommentsPlugin.native-DHCDUm9f.mjs.map
@@ -1,4 +1,4 @@
1
- import { i as Ie } from "./dialogHelpers-DBf7WqYH.mjs";
1
+ import { i as Ie } from "./dialogHelpers-Dzn8DHoF.mjs";
2
2
  const w = ".rte-content, .editora-content", A = '.rte-conditional-block[data-conditional-content="true"]', f = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', b = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', p = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", g = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Te = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", T = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
3
3
  let de = null, me = 0, Y = null, J = null, Q = null, ee = null, te = null, oe = null, O = null, y = null, ne = null;
4
4
  const je = {
@@ -1141,7 +1141,7 @@ function L(e, t, o, i, n) {
1141
1141
  }, M = (s) => {
1142
1142
  s.target === l && v();
1143
1143
  }, xe = (s) => {
1144
- if (s.key !== "Tab") return;
1144
+ if (s.key !== "Tab" || s.defaultPrevented) return;
1145
1145
  const _ = Array.from(
1146
1146
  d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
1147
1147
  );
@@ -1414,4 +1414,4 @@ const gt = (e = {}) => {
1414
1414
  export {
1415
1415
  gt as ConditionalContentPlugin
1416
1416
  };
1417
- //# sourceMappingURL=ConditionalContentPlugin.native-Bf7XgRSW.mjs.map
1417
+ //# sourceMappingURL=ConditionalContentPlugin.native-B3R6xcqn.mjs.map