@editora/plugins 1.0.7 → 1.0.8

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 (58) hide show
  1. package/README.md +50 -4
  2. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  3. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  4. package/dist/anchor.cjs.js +11 -11
  5. package/dist/anchor.esm.js +130 -107
  6. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  7. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  8. package/dist/background-color.cjs.js +3 -3
  9. package/dist/background-color.esm.js +116 -119
  10. package/dist/code.cjs.js +82 -102
  11. package/dist/code.esm.js +1172 -662
  12. package/dist/comments.cjs.js +10 -10
  13. package/dist/comments.esm.js +195 -177
  14. package/dist/document-manager.cjs.js +1 -1
  15. package/dist/document-manager.esm.js +1 -1
  16. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  17. package/dist/documentManager-Jf0RbSks.js +17 -0
  18. package/dist/embed-iframe.cjs.js +2 -2
  19. package/dist/embed-iframe.esm.js +8 -5
  20. package/dist/emojis.cjs.js +64 -39
  21. package/dist/emojis.esm.js +133 -104
  22. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  23. package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
  24. package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
  25. package/dist/index-CvJk4DKa.js +221 -0
  26. package/dist/index-D3CycEFU.mjs +16543 -0
  27. package/dist/index-tqLTHcO6.js +1 -0
  28. package/dist/index.cjs.js +1 -1
  29. package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
  30. package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
  31. package/dist/index.esm.js +87 -79
  32. package/dist/jspdf.es.min-BoS80556.js +77 -0
  33. package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
  34. package/dist/link.cjs.js +6 -6
  35. package/dist/link.esm.js +41 -39
  36. package/dist/math.cjs.js +21 -21
  37. package/dist/math.esm.js +151 -112
  38. package/dist/media-manager.cjs.js +15 -15
  39. package/dist/media-manager.esm.js +227 -206
  40. package/dist/merge-tag.cjs.js +44 -12
  41. package/dist/merge-tag.esm.js +368 -241
  42. package/dist/page-break.cjs.js +2 -2
  43. package/dist/page-break.esm.js +77 -69
  44. package/dist/special-characters.cjs.js +83 -45
  45. package/dist/special-characters.esm.js +149 -100
  46. package/dist/spell-check.cjs.js +9 -9
  47. package/dist/spell-check.esm.js +235 -216
  48. package/dist/template.cjs.js +14 -14
  49. package/dist/template.esm.js +157 -131
  50. package/dist/text-color.cjs.js +9 -9
  51. package/dist/text-color.esm.js +131 -115
  52. package/index.d.ts +51 -1
  53. package/package.json +3 -3
  54. package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
  55. package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
  56. package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
  57. package/dist/documentManager-_tQQfQi9.js +0 -317
  58. package/dist/index-D3pJyAsj.js +0 -1
@@ -1,18 +1,24 @@
1
1
  const C = /* @__PURE__ */ new WeakMap();
2
2
  let x = null, S = !1, k = 0;
3
3
  const E = "User";
4
- function h(e) {
5
- return k += 1, `${e}-${Date.now()}-${k}`;
4
+ function v(t) {
5
+ return k += 1, `${t}-${Date.now()}-${k}`;
6
6
  }
7
- function v(e) {
8
- if (!e) return null;
9
- const t = e instanceof Element ? e : e.parentElement;
10
- return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
7
+ function y(t) {
8
+ if (!t) return null;
9
+ const e = t instanceof Element ? t : t.parentElement;
10
+ return e ? e.closest("[data-editora-editor]") || e.closest(".rte-editor") || e.closest(".editora-editor") : null;
11
11
  }
12
- function w(e, t) {
13
- return t.contains(e.commonAncestorContainer);
12
+ function A(t) {
13
+ const e = t?.editorElement || t?.contentElement || null;
14
+ if (!(e instanceof HTMLElement)) return;
15
+ const r = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
16
+ r && (x = r);
14
17
  }
15
- function I() {
18
+ function w(t, e) {
19
+ return e.contains(t.commonAncestorContainer);
20
+ }
21
+ function B() {
16
22
  if (typeof window < "u") {
17
23
  const o = window.__editoraCommandEditorRoot;
18
24
  if (o instanceof HTMLElement) {
@@ -21,22 +27,22 @@ function I() {
21
27
  return x = a, window.__editoraCommandEditorRoot = null, a;
22
28
  }
23
29
  }
24
- const e = document.activeElement, t = e ? v(e) : null;
25
- if (t) return t;
30
+ const t = document.activeElement, e = t ? y(t) : null;
31
+ if (e) return e;
26
32
  const r = window.getSelection();
27
33
  if (r && r.rangeCount > 0) {
28
- const o = v(
34
+ const o = y(
29
35
  r.getRangeAt(0).commonAncestorContainer
30
36
  );
31
37
  if (o) return o;
32
38
  }
33
39
  return x;
34
40
  }
35
- function B(e) {
36
- const t = C.get(e);
37
- if (t) return t;
41
+ function H(t) {
42
+ const e = C.get(t);
43
+ if (e) return e;
38
44
  const r = {
39
- root: e,
45
+ root: t,
40
46
  comments: /* @__PURE__ */ new Map(),
41
47
  panelVisible: !1,
42
48
  panelElement: null,
@@ -46,107 +52,111 @@ function B(e) {
46
52
  newCommentText: "",
47
53
  selectionChangeListener: null
48
54
  };
49
- return C.set(e, r), r;
55
+ return C.set(t, r), r;
50
56
  }
51
- function f() {
52
- const e = I();
53
- return e ? (x = e, B(e)) : null;
57
+ function u() {
58
+ const t = B();
59
+ return t ? (x = t, H(t)) : null;
54
60
  }
55
- function T(e) {
56
- const t = window.getSelection();
57
- if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
58
- const r = t.getRangeAt(0);
59
- return w(r, e) ? r.cloneRange() : null;
61
+ function R(t) {
62
+ const e = window.getSelection();
63
+ if (!e || e.rangeCount === 0 || e.isCollapsed) return null;
64
+ const r = e.getRangeAt(0);
65
+ return w(r, t) ? r.cloneRange() : null;
60
66
  }
61
- function R(e, t) {
62
- if (!t.anchorId) return;
63
- const r = e.root.querySelector(`#${t.anchorId}`);
64
- r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
67
+ function I(t, e) {
68
+ if (!e.anchorId) return;
69
+ const r = t.root.querySelector(`#${e.anchorId}`);
70
+ r && r.classList.toggle("rte-comment-anchor-resolved", e.resolved);
65
71
  }
66
- function b(e, t, r) {
67
- const o = e.comments.get(t);
72
+ function h(t, e, r) {
73
+ const o = t.comments.get(e);
68
74
  if (!o || !o.anchorId) return;
69
- const a = e.root.querySelector(`#${o.anchorId}`);
75
+ const a = t.root.querySelector(`#${o.anchorId}`);
70
76
  a && a.classList.toggle("highlighted", r);
71
77
  }
72
- function $(e, t, r) {
73
- t.onclick = (o) => {
74
- o.preventDefault(), o.stopPropagation(), x = e.root, e.expandedComments.add(r), y(e, !0), m(e);
78
+ function $(t, e, r) {
79
+ e.onclick = (o) => {
80
+ o.preventDefault(), o.stopPropagation(), x = t.root, t.expandedComments.add(r), g(t, !0), m(t);
75
81
  };
76
82
  }
77
- function q(e) {
78
- const t = e.parentNode;
79
- if (t) {
80
- for (; e.firstChild; )
81
- t.insertBefore(e.firstChild, e);
82
- e.remove();
83
+ function q(t) {
84
+ const e = t.parentNode;
85
+ if (e) {
86
+ for (; t.firstChild; )
87
+ e.insertBefore(t.firstChild, t);
88
+ t.remove();
83
89
  }
84
90
  }
85
- function y(e, t) {
86
- F(), H(e), e.panelVisible = t, e.root.setAttribute("data-rte-comments-open", t ? "true" : "false"), e.panelElement && (e.panelElement.classList.toggle("is-open", t), e.panelElement.setAttribute("aria-hidden", t ? "false" : "true")), t ? N(e) : z(e);
91
+ function g(t, e) {
92
+ if (t.panelVisible = e, e) {
93
+ Z(), N(t), t.root.setAttribute("data-rte-comments-open", "true"), t.panelElement && (t.panelElement.classList.add("is-open"), t.panelElement.setAttribute("aria-hidden", "false")), z(t);
94
+ return;
95
+ }
96
+ t.root.removeAttribute("data-rte-comments-open"), V(t), t.panelElement && (t.panelElement.remove(), t.panelElement = null);
87
97
  }
88
- function H(e) {
89
- if (e.panelElement) return;
90
- const t = document.createElement("aside");
91
- 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;
98
+ function N(t) {
99
+ if (t.panelElement) return;
100
+ const e = document.createElement("aside");
101
+ e.className = "rte-comments-panel", e.setAttribute("role", "complementary"), e.setAttribute("aria-label", "Comments"), e.setAttribute("aria-hidden", "true"), window.getComputedStyle(t.root).position === "static" && (t.root.style.position = "relative"), t.root.appendChild(e), t.panelElement = e;
92
102
  }
93
- function N(e) {
94
- e.selectionChangeListener || (e.selectionChangeListener = () => {
95
- const t = window.getSelection();
96
- if (!t || t.rangeCount === 0 || t.isCollapsed) return;
97
- const r = t.getRangeAt(0);
98
- w(r, e.root) && (e.savedSelection = r.cloneRange(), x = e.root);
99
- }, document.addEventListener("selectionchange", e.selectionChangeListener));
103
+ function z(t) {
104
+ t.selectionChangeListener || (t.selectionChangeListener = () => {
105
+ const e = window.getSelection();
106
+ if (!e || e.rangeCount === 0 || e.isCollapsed) return;
107
+ const r = e.getRangeAt(0);
108
+ w(r, t.root) && (t.savedSelection = r.cloneRange(), x = t.root);
109
+ }, document.addEventListener("selectionchange", t.selectionChangeListener));
100
110
  }
101
- function z(e) {
102
- e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
111
+ function V(t) {
112
+ t.selectionChangeListener && (document.removeEventListener("selectionchange", t.selectionChangeListener), t.selectionChangeListener = null);
103
113
  }
104
- function V(e) {
105
- return Array.from(e.comments.values()).sort(
106
- (t, r) => r.createdAt.localeCompare(t.createdAt)
114
+ function M(t) {
115
+ return Array.from(t.comments.values()).sort(
116
+ (e, r) => r.createdAt.localeCompare(e.createdAt)
107
117
  );
108
118
  }
109
- function A(e) {
110
- return new Date(e).toLocaleString();
119
+ function L(t) {
120
+ return new Date(t).toLocaleString();
111
121
  }
112
- function M(e, t) {
113
- const r = e.expandedComments.has(t.id), o = document.createElement("article");
114
- o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
122
+ function D(t, e) {
123
+ const r = t.expandedComments.has(e.id), o = document.createElement("article");
124
+ o.className = `rte-comment-item${e.resolved ? " resolved" : ""}`, o.innerHTML = `
115
125
  <header class="rte-comment-header">
116
126
  <div class="rte-comment-meta">
117
- <strong class="rte-comment-author">${t.author}</strong>
118
- <time class="rte-comment-date">${A(t.createdAt)}</time>
127
+ <strong class="rte-comment-author">${e.author}</strong>
128
+ <time class="rte-comment-date">${L(e.createdAt)}</time>
119
129
  </div>
120
130
  <button class="rte-comment-expand" type="button" aria-label="Toggle details">
121
131
  ${r ? "▾" : "▸"}
122
132
  </button>
123
133
  </header>
124
134
  <div class="rte-comment-text"></div>
125
- ${t.selectedText ? `<blockquote class="rte-comment-selection">${t.selectedText}</blockquote>` : ""}
135
+ ${e.selectedText ? `<blockquote class="rte-comment-selection">${e.selectedText}</blockquote>` : ""}
126
136
  <section class="rte-comment-expanded${r ? " show" : ""}"></section>
127
137
  `;
128
138
  const a = o.querySelector(".rte-comment-text");
129
- a && (a.textContent = t.text), o.querySelector(".rte-comment-expand")?.addEventListener("click", () => {
130
- e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), m(e);
139
+ a && (a.textContent = e.text), o.querySelector(".rte-comment-expand")?.addEventListener("click", () => {
140
+ t.expandedComments.has(e.id) ? t.expandedComments.delete(e.id) : t.expandedComments.add(e.id), m(t);
131
141
  });
132
142
  const p = o.querySelector(".rte-comment-expanded");
133
143
  if (p && r) {
134
- if (t.replies.length > 0) {
144
+ if (e.replies.length > 0) {
135
145
  const n = document.createElement("div");
136
- n.className = "rte-comment-replies", t.replies.forEach((s) => {
146
+ n.className = "rte-comment-replies", e.replies.forEach((s) => {
137
147
  const l = document.createElement("div");
138
148
  l.className = "rte-comment-reply", l.innerHTML = `
139
149
  <div class="rte-comment-reply-header">
140
150
  <strong>${s.author}</strong>
141
- <time>${A(s.createdAt)}</time>
151
+ <time>${L(s.createdAt)}</time>
142
152
  </div>
143
153
  <div class="rte-comment-reply-text"></div>
144
154
  `;
145
- const u = l.querySelector(".rte-comment-reply-text");
146
- u && (u.textContent = s.text), n.appendChild(l);
155
+ const f = l.querySelector(".rte-comment-reply-text");
156
+ f && (f.textContent = s.text), n.appendChild(l);
147
157
  }), p.appendChild(n);
148
158
  }
149
- if (!t.resolved) {
159
+ if (!e.resolved) {
150
160
  const n = document.createElement("div");
151
161
  n.className = "rte-comment-reply-composer", n.innerHTML = `
152
162
  <textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
@@ -158,45 +168,45 @@ function M(e, t) {
158
168
  ".rte-comment-btn.primary"
159
169
  );
160
170
  if (s && l) {
161
- s.value = e.replyTexts[t.id] || "";
162
- const u = () => {
163
- const g = !!s.value.trim();
164
- l.disabled = !g;
171
+ s.value = t.replyTexts[e.id] || "";
172
+ const f = () => {
173
+ const b = !!s.value.trim();
174
+ l.disabled = !b;
165
175
  };
166
- u(), s.addEventListener("input", () => {
167
- e.replyTexts[t.id] = s.value, u();
176
+ f(), s.addEventListener("input", () => {
177
+ t.replyTexts[e.id] = s.value, f();
168
178
  }), l.addEventListener("click", () => {
169
- const g = s.value.trim();
170
- g && (_(t.id, E, g), e.replyTexts[t.id] = "", m(e));
179
+ const b = s.value.trim();
180
+ b && (F(e.id, E, b), t.replyTexts[e.id] = "", m(t));
171
181
  });
172
182
  }
173
183
  p.appendChild(n);
174
184
  }
175
- const i = document.createElement("div");
176
- if (i.className = "rte-comment-actions", t.anchorId) {
185
+ const c = document.createElement("div");
186
+ if (c.className = "rte-comment-actions", e.anchorId) {
177
187
  const n = document.createElement("button");
178
188
  n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
179
- const s = e.root.querySelector(`#${t.anchorId}`);
180
- s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), b(e, t.id, !0), window.setTimeout(() => b(e, t.id, !1), 1200));
181
- }, i.appendChild(n);
189
+ const s = t.root.querySelector(`#${e.anchorId}`);
190
+ s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), h(t, e.id, !0), window.setTimeout(() => h(t, e.id, !1), 1200));
191
+ }, c.appendChild(n);
182
192
  }
183
- if (t.resolved) {
193
+ if (e.resolved) {
184
194
  const n = document.createElement("button");
185
- n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => j(t.id), i.appendChild(n);
195
+ n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => _(e.id), c.appendChild(n);
186
196
  } else {
187
197
  const n = document.createElement("button");
188
- n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => O(t.id, E), i.appendChild(n);
198
+ n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => P(e.id, E), c.appendChild(n);
189
199
  }
190
- const c = document.createElement("button");
191
- c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () => P(t.id), i.appendChild(c), p.appendChild(i);
200
+ const i = document.createElement("button");
201
+ i.type = "button", i.className = "rte-comment-btn danger", i.textContent = "Delete", i.onclick = () => j(e.id), c.appendChild(i), p.appendChild(c);
192
202
  }
193
- return o.addEventListener("mouseenter", () => b(e, t.id, !0)), o.addEventListener("mouseleave", () => b(e, t.id, !1)), o;
203
+ return o.addEventListener("mouseenter", () => h(t, e.id, !0)), o.addEventListener("mouseleave", () => h(t, e.id, !1)), o;
194
204
  }
195
- function m(e) {
196
- const t = e || f();
197
- if (!t?.panelElement) return;
198
- const r = V(t);
199
- t.panelElement.innerHTML = `
205
+ function m(t) {
206
+ const e = t || u();
207
+ if (!e?.panelElement) return;
208
+ const r = M(e);
209
+ e.panelElement.innerHTML = `
200
210
  <div class="rte-comments-header">
201
211
  <div>
202
212
  <h3>Comments (${r.length})</h3>
@@ -211,133 +221,141 @@ function m(e) {
211
221
  </div>
212
222
  </div>
213
223
  ${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
214
- `, t.panelElement.querySelector(".rte-comments-close")?.addEventListener("click", () => {
215
- y(t, !1);
224
+ `, e.panelElement.querySelector(".rte-comments-close")?.addEventListener("click", () => {
225
+ g(e, !1);
216
226
  });
217
- const a = t.panelElement.querySelector(
227
+ const a = e.panelElement.querySelector(
218
228
  ".new-comment-textarea"
219
- ), d = t.panelElement.querySelector(
229
+ ), d = e.panelElement.querySelector(
220
230
  ".add-comment-btn"
221
231
  );
222
232
  if (a && d) {
223
- a.value = t.newCommentText;
224
- const i = () => {
225
- const c = !!a.value.trim();
226
- d.disabled = !c;
233
+ a.value = e.newCommentText;
234
+ const c = () => {
235
+ const i = !!a.value.trim();
236
+ d.disabled = !i;
227
237
  };
228
- i(), a.addEventListener("input", () => {
229
- t.newCommentText = a.value, i();
230
- }), a.addEventListener("keydown", (c) => {
231
- (c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), d.click());
238
+ c(), a.addEventListener("input", () => {
239
+ e.newCommentText = a.value, c();
240
+ }), a.addEventListener("keydown", (i) => {
241
+ (i.ctrlKey || i.metaKey) && i.key === "Enter" && (i.preventDefault(), d.click());
232
242
  }), d.addEventListener("click", () => {
233
- const c = a.value.trim();
234
- if (!c) return;
235
- const n = !!t.savedSelection;
236
- D(E, c, !n), t.newCommentText = "", m(t);
243
+ const i = a.value.trim();
244
+ if (!i) return;
245
+ const n = !!e.savedSelection;
246
+ O(E, i, !n), e.newCommentText = "", m(e);
237
247
  });
238
248
  }
239
- const p = t.panelElement.querySelector(".rte-comments-list");
240
- p && r.forEach((i) => {
241
- p.appendChild(M(t, i));
249
+ const p = e.panelElement.querySelector(".rte-comments-list");
250
+ p && r.forEach((c) => {
251
+ p.appendChild(D(e, c));
242
252
  });
243
253
  }
244
- function L() {
245
- S || (S = !0, document.addEventListener("focusin", (e) => {
246
- const t = v(e.target);
247
- t && (x = t);
254
+ function T() {
255
+ S || (S = !0, document.addEventListener("focusin", (t) => {
256
+ const e = y(t.target);
257
+ e && (x = e);
248
258
  }), document.addEventListener("selectionchange", () => {
249
- const e = window.getSelection();
250
- if (!e || e.rangeCount === 0) return;
251
- const t = e.getRangeAt(0), r = v(t.commonAncestorContainer);
259
+ const t = window.getSelection();
260
+ if (!t || t.rangeCount === 0) return;
261
+ const e = t.getRangeAt(0), r = y(e.commonAncestorContainer);
252
262
  if (!r) return;
253
263
  x = r;
254
264
  const o = C.get(r);
255
- !o || e.isCollapsed || w(t, r) && (o.savedSelection = t.cloneRange());
256
- }));
265
+ !o || t.isCollapsed || w(e, r) && (o.savedSelection = e.cloneRange());
266
+ }), document.addEventListener(
267
+ "keydown",
268
+ (t) => {
269
+ if (t.key !== "Escape") return;
270
+ const e = u();
271
+ !e || !e.panelVisible || (t.preventDefault(), t.stopPropagation(), g(e, !1));
272
+ },
273
+ !0
274
+ ));
257
275
  }
258
- function D(e, t, r = !1) {
259
- const o = f();
276
+ function O(t, e, r = !1) {
277
+ const o = u();
260
278
  if (!o) return "";
261
- const a = t.trim();
279
+ const a = e.trim();
262
280
  if (!a) return "";
263
281
  if (r) {
264
- const l = h("comment");
282
+ const l = v("comment");
265
283
  return o.comments.set(l, {
266
284
  id: l,
267
285
  anchorId: "",
268
286
  selectedText: "",
269
- author: e,
287
+ author: t,
270
288
  text: a,
271
289
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
272
290
  resolved: !1,
273
291
  replies: []
274
292
  }), m(o), l;
275
293
  }
276
- const d = o.savedSelection || T(o.root);
294
+ const d = o.savedSelection || R(o.root);
277
295
  if (!d || !w(d, o.root)) return "";
278
296
  const p = d.toString().trim();
279
297
  if (!p) return "";
280
- const i = h("comment"), c = h("comment-anchor"), n = document.createElement("span");
281
- n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", i), n.setAttribute("title", "Commented text");
298
+ const c = v("comment"), i = v("comment-anchor"), n = document.createElement("span");
299
+ n.id = i, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", c), n.setAttribute("title", "Commented text");
282
300
  try {
283
- const l = d.cloneRange(), u = l.extractContents();
284
- if (!u.textContent?.trim()) return "";
285
- n.appendChild(u), l.insertNode(n);
301
+ const l = d.cloneRange(), f = l.extractContents();
302
+ if (!f.textContent?.trim()) return "";
303
+ n.appendChild(f), l.insertNode(n);
286
304
  } catch {
287
305
  return "";
288
306
  }
289
- return $(o, n, i), o.comments.set(i, {
290
- id: i,
291
- anchorId: c,
307
+ return $(o, n, c), o.comments.set(c, {
308
+ id: c,
309
+ anchorId: i,
292
310
  selectedText: p,
293
- author: e,
311
+ author: t,
294
312
  text: a,
295
313
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
296
314
  resolved: !1,
297
315
  replies: []
298
- }), o.savedSelection = null, window.getSelection()?.removeAllRanges(), m(o), i;
316
+ }), o.savedSelection = null, window.getSelection()?.removeAllRanges(), m(o), c;
299
317
  }
300
- function O(e, t) {
301
- const r = f();
318
+ function P(t, e) {
319
+ const r = u();
302
320
  if (!r) return;
303
- const o = r.comments.get(e);
304
- o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), R(r, o), m(r));
321
+ const o = r.comments.get(t);
322
+ o && (o.resolved = !0, o.resolvedBy = e, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), I(r, o), m(r));
305
323
  }
306
- function j(e) {
307
- const t = f();
308
- if (!t) return;
309
- const r = t.comments.get(e);
310
- r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, R(t, r), m(t));
324
+ function _(t) {
325
+ const e = u();
326
+ if (!e) return;
327
+ const r = e.comments.get(t);
328
+ r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, I(e, r), m(e));
311
329
  }
312
- function P(e) {
313
- const t = f();
314
- if (!t) return;
315
- const r = t.comments.get(e);
330
+ function j(t) {
331
+ const e = u();
332
+ if (!e) return;
333
+ const r = e.comments.get(t);
316
334
  if (r) {
317
335
  if (r.anchorId) {
318
- const o = t.root.querySelector(`#${r.anchorId}`);
336
+ const o = e.root.querySelector(`#${r.anchorId}`);
319
337
  o && q(o);
320
338
  }
321
- t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e], m(t);
339
+ e.comments.delete(t), e.expandedComments.delete(t), delete e.replyTexts[t], m(e);
322
340
  }
323
341
  }
324
- function _(e, t, r) {
325
- const o = f();
342
+ function F(t, e, r) {
343
+ const o = u();
326
344
  if (!o) return;
327
- const a = o.comments.get(e);
345
+ const a = o.comments.get(t);
328
346
  if (!a) return;
329
347
  const d = r.trim();
330
348
  d && (a.replies.push({
331
- id: h("reply"),
332
- author: t,
349
+ id: v("reply"),
350
+ author: e,
333
351
  text: d,
334
352
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
335
353
  }), m(o));
336
354
  }
337
- function F() {
355
+ function Z() {
338
356
  if (document.getElementById("rte-comments-panel-styles")) return;
339
- const e = document.createElement("style");
340
- e.id = "rte-comments-panel-styles", e.textContent = `
357
+ const t = document.createElement("style");
358
+ t.id = "rte-comments-panel-styles", t.textContent = `
341
359
  .rte-comments-panel {
342
360
  --rte-comments-panel-width: min(360px, 42vw);
343
361
  position: absolute;
@@ -653,9 +671,9 @@ function F() {
653
671
  margin-right: 0;
654
672
  }
655
673
  }
656
- `, document.head.appendChild(e);
674
+ `, document.head.appendChild(t);
657
675
  }
658
- const Z = () => ({
676
+ const K = () => ({
659
677
  name: "comments",
660
678
  toolbar: [
661
679
  {
@@ -672,21 +690,21 @@ const Z = () => ({
672
690
  }
673
691
  ],
674
692
  commands: {
675
- addComment: () => {
676
- L();
677
- const e = f();
678
- return e ? (e.savedSelection = T(e.root), e.savedSelection && window.getSelection()?.removeAllRanges(), y(e, !0), m(e), e.panelElement?.querySelector(
693
+ addComment: (t, e) => {
694
+ A(e), T();
695
+ const r = u();
696
+ return r ? (r.savedSelection = R(r.root), r.savedSelection && window.getSelection()?.removeAllRanges(), g(r, !0), m(r), r.panelElement?.querySelector(
679
697
  ".new-comment-textarea"
680
698
  )?.focus({ preventScroll: !0 }), !0) : !1;
681
699
  },
682
- toggleComments: () => {
683
- L();
684
- const e = f();
685
- return e ? (y(e, !e.panelVisible), e.panelVisible && m(e), !0) : !1;
700
+ toggleComments: (t, e) => {
701
+ A(e), T();
702
+ const r = u();
703
+ return r ? (g(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
686
704
  }
687
705
  },
688
706
  keymap: {}
689
707
  });
690
708
  export {
691
- Z as CommentsPlugin
709
+ K as CommentsPlugin
692
710
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-D3pJyAsj.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-tqLTHcO6.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
@@ -1,4 +1,4 @@
1
- import { D as n, g, s as o } from "./index-Bskk414V.mjs";
1
+ import { D as n, g, s as o } from "./index-BFsKNTTj.mjs";
2
2
  export {
3
3
  n as DocumentManagerPlugin,
4
4
  g as getDocumentManagerConfig,