@editora/core 1.0.5 → 1.0.7

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 (43) hide show
  1. package/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
  2. package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
  3. package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
  4. package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
  5. package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
  6. package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
  7. package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
  8. package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
  9. package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
  10. package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
  11. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
  12. package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-CXdX5fAv.mjs} +77 -68
  13. package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
  14. package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
  15. package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
  16. package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
  17. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  18. package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
  19. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  20. package/dist/editora.min.js +10 -10
  21. package/dist/editora.umd.js +10 -10
  22. package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
  23. package/dist/{index-CqWQFb3D.js → index-BpE6GFbz.js} +4 -4
  24. package/dist/index-BslAFzmv.mjs +16544 -0
  25. package/dist/{index-OwnkG39N.mjs → index-yzU4NdPT.mjs} +200 -183
  26. package/dist/index.cjs.js +1 -1
  27. package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
  28. package/dist/index.esm.js +2 -2
  29. package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
  30. package/dist/plugin-loader.js +15 -15
  31. package/dist/webcomponent-core.js +241 -224
  32. package/dist/webcomponent-core.min.css +1 -1
  33. package/dist/webcomponent-core.min.js +86 -106
  34. package/dist/webcomponent.cjs.js +1 -1
  35. package/dist/webcomponent.esm.js +1 -1
  36. package/dist/webcomponent.js +205 -188
  37. package/dist/webcomponent.min.css +1 -1
  38. package/dist/webcomponent.min.js +477 -402
  39. package/package.json +16 -10
  40. package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
  41. package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
  42. package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
  43. package/dist/documentManager-irzj9n3V.mjs +0 -37627
@@ -1,14 +1,20 @@
1
1
  const C = /* @__PURE__ */ new WeakMap();
2
- let g = null, S = !1, k = 0;
2
+ let x = null, S = !1, k = 0;
3
3
  const E = "User";
4
- function h(e) {
4
+ function v(e) {
5
5
  return k += 1, `${e}-${Date.now()}-${k}`;
6
6
  }
7
- function v(e) {
7
+ function y(e) {
8
8
  if (!e) return null;
9
9
  const t = e instanceof Element ? e : e.parentElement;
10
10
  return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
11
11
  }
12
+ function A(e) {
13
+ const t = (e == null ? void 0 : e.editorElement) || (e == null ? void 0 : e.contentElement) || null;
14
+ if (!(t instanceof HTMLElement)) return;
15
+ 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);
16
+ r && (x = r);
17
+ }
12
18
  function w(e, t) {
13
19
  return t.contains(e.commonAncestorContainer);
14
20
  }
@@ -18,19 +24,19 @@ function $() {
18
24
  if (o instanceof HTMLElement) {
19
25
  const a = o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? o : null);
20
26
  if (a)
21
- return g = a, window.__editoraCommandEditorRoot = null, a;
27
+ return x = a, window.__editoraCommandEditorRoot = null, a;
22
28
  }
23
29
  }
24
- const e = document.activeElement, t = e ? v(e) : null;
30
+ const e = document.activeElement, t = e ? y(e) : null;
25
31
  if (t) return t;
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
- return g;
39
+ return x;
34
40
  }
35
41
  function q(e) {
36
42
  const t = C.get(e);
@@ -48,17 +54,17 @@ function q(e) {
48
54
  };
49
55
  return C.set(e, r), r;
50
56
  }
51
- function f() {
57
+ function u() {
52
58
  const e = $();
53
- return e ? (g = e, q(e)) : null;
59
+ return e ? (x = e, q(e)) : null;
54
60
  }
55
- function T(e) {
61
+ function R(e) {
56
62
  const t = window.getSelection();
57
63
  if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
58
64
  const r = t.getRangeAt(0);
59
65
  return w(r, e) ? r.cloneRange() : null;
60
66
  }
61
- function R(e, t) {
67
+ function I(e, t) {
62
68
  if (!t.anchorId) return;
63
69
  const r = e.root.querySelector(`#${t.anchorId}`);
64
70
  r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
@@ -69,12 +75,12 @@ function b(e, t, r) {
69
75
  const a = e.root.querySelector(`#${o.anchorId}`);
70
76
  a && a.classList.toggle("highlighted", r);
71
77
  }
72
- function H(e, t, r) {
78
+ function N(e, t, r) {
73
79
  t.onclick = (o) => {
74
- o.preventDefault(), o.stopPropagation(), g = e.root, e.expandedComments.add(r), y(e, !0), m(e);
80
+ o.preventDefault(), o.stopPropagation(), x = e.root, e.expandedComments.add(r), h(e, !0), m(e);
75
81
  };
76
82
  }
77
- function N(e) {
83
+ function z(e) {
78
84
  const t = e.parentNode;
79
85
  if (t) {
80
86
  for (; e.firstChild; )
@@ -82,40 +88,44 @@ function N(e) {
82
88
  e.remove();
83
89
  }
84
90
  }
85
- function y(e, t) {
86
- F(), z(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 ? V(e) : B(e);
91
+ function h(e, t) {
92
+ if (e.panelVisible = t, t) {
93
+ Z(), V(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), B(e);
94
+ return;
95
+ }
96
+ e.root.removeAttribute("data-rte-comments-open"), M(e), e.panelElement && (e.panelElement.remove(), e.panelElement = null);
87
97
  }
88
- function z(e) {
98
+ function V(e) {
89
99
  if (e.panelElement) return;
90
100
  const t = document.createElement("aside");
91
101
  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;
92
102
  }
93
- function V(e) {
103
+ function B(e) {
94
104
  e.selectionChangeListener || (e.selectionChangeListener = () => {
95
105
  const t = window.getSelection();
96
106
  if (!t || t.rangeCount === 0 || t.isCollapsed) return;
97
107
  const r = t.getRangeAt(0);
98
- w(r, e.root) && (e.savedSelection = r.cloneRange(), g = e.root);
108
+ w(r, e.root) && (e.savedSelection = r.cloneRange(), x = e.root);
99
109
  }, document.addEventListener("selectionchange", e.selectionChangeListener));
100
110
  }
101
- function B(e) {
111
+ function M(e) {
102
112
  e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
103
113
  }
104
- function I(e) {
114
+ function H(e) {
105
115
  return Array.from(e.comments.values()).sort(
106
116
  (t, r) => r.createdAt.localeCompare(t.createdAt)
107
117
  );
108
118
  }
109
- function A(e) {
119
+ function L(e) {
110
120
  return new Date(e).toLocaleString();
111
121
  }
112
- function M(e, t) {
122
+ function D(e, t) {
113
123
  const r = e.expandedComments.has(t.id), o = document.createElement("article");
114
124
  o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
115
125
  <header class="rte-comment-header">
116
126
  <div class="rte-comment-meta">
117
127
  <strong class="rte-comment-author">${t.author}</strong>
118
- <time class="rte-comment-date">${A(t.createdAt)}</time>
128
+ <time class="rte-comment-date">${L(t.createdAt)}</time>
119
129
  </div>
120
130
  <button class="rte-comment-expand" type="button" aria-label="Toggle details">
121
131
  ${r ? "▾" : "▸"}
@@ -127,26 +137,26 @@ function M(e, t) {
127
137
  `;
128
138
  const a = o.querySelector(".rte-comment-text");
129
139
  a && (a.textContent = t.text);
130
- const s = o.querySelector(".rte-comment-expand");
131
- s == null || s.addEventListener("click", () => {
140
+ const i = o.querySelector(".rte-comment-expand");
141
+ i == null || i.addEventListener("click", () => {
132
142
  e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), m(e);
133
143
  });
134
- const u = o.querySelector(".rte-comment-expanded");
135
- if (u && r) {
144
+ const f = o.querySelector(".rte-comment-expanded");
145
+ if (f && r) {
136
146
  if (t.replies.length > 0) {
137
147
  const n = document.createElement("div");
138
- n.className = "rte-comment-replies", t.replies.forEach((l) => {
148
+ n.className = "rte-comment-replies", t.replies.forEach((s) => {
139
149
  const p = document.createElement("div");
140
150
  p.className = "rte-comment-reply", p.innerHTML = `
141
151
  <div class="rte-comment-reply-header">
142
- <strong>${l.author}</strong>
143
- <time>${A(l.createdAt)}</time>
152
+ <strong>${s.author}</strong>
153
+ <time>${L(s.createdAt)}</time>
144
154
  </div>
145
155
  <div class="rte-comment-reply-text"></div>
146
156
  `;
147
157
  const d = p.querySelector(".rte-comment-reply-text");
148
- d && (d.textContent = l.text), n.appendChild(p);
149
- }), u.appendChild(n);
158
+ d && (d.textContent = s.text), n.appendChild(p);
159
+ }), f.appendChild(n);
150
160
  }
151
161
  if (!t.resolved) {
152
162
  const n = document.createElement("div");
@@ -154,50 +164,50 @@ function M(e, t) {
154
164
  <textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
155
165
  <button type="button" class="rte-comment-btn primary">Reply</button>
156
166
  `;
157
- const l = n.querySelector(
167
+ const s = n.querySelector(
158
168
  ".rte-comment-reply-textarea"
159
169
  ), p = n.querySelector(
160
170
  ".rte-comment-btn.primary"
161
171
  );
162
- if (l && p) {
163
- l.value = e.replyTexts[t.id] || "";
172
+ if (s && p) {
173
+ s.value = e.replyTexts[t.id] || "";
164
174
  const d = () => {
165
- const x = !!l.value.trim();
166
- p.disabled = !x;
175
+ const g = !!s.value.trim();
176
+ p.disabled = !g;
167
177
  };
168
- d(), l.addEventListener("input", () => {
169
- e.replyTexts[t.id] = l.value, d();
178
+ d(), s.addEventListener("input", () => {
179
+ e.replyTexts[t.id] = s.value, d();
170
180
  }), p.addEventListener("click", () => {
171
- const x = l.value.trim();
172
- x && (_(t.id, E, x), e.replyTexts[t.id] = "", m(e));
181
+ const g = s.value.trim();
182
+ g && (F(t.id, E, g), e.replyTexts[t.id] = "", m(e));
173
183
  });
174
184
  }
175
- u.appendChild(n);
185
+ f.appendChild(n);
176
186
  }
177
- const i = document.createElement("div");
178
- if (i.className = "rte-comment-actions", t.anchorId) {
187
+ const l = document.createElement("div");
188
+ if (l.className = "rte-comment-actions", t.anchorId) {
179
189
  const n = document.createElement("button");
180
190
  n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
181
- const l = e.root.querySelector(`#${t.anchorId}`);
182
- l && (l.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), b(e, t.id, !0), window.setTimeout(() => b(e, t.id, !1), 1200));
183
- }, i.appendChild(n);
191
+ const s = e.root.querySelector(`#${t.anchorId}`);
192
+ s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), b(e, t.id, !0), window.setTimeout(() => b(e, t.id, !1), 1200));
193
+ }, l.appendChild(n);
184
194
  }
185
195
  if (t.resolved) {
186
196
  const n = document.createElement("button");
187
- n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => j(t.id), i.appendChild(n);
197
+ n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => _(t.id), l.appendChild(n);
188
198
  } else {
189
199
  const n = document.createElement("button");
190
- n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => O(t.id, E), i.appendChild(n);
200
+ n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => P(t.id, E), l.appendChild(n);
191
201
  }
192
202
  const c = document.createElement("button");
193
- c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () => P(t.id), i.appendChild(c), u.appendChild(i);
203
+ c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () => j(t.id), l.appendChild(c), f.appendChild(l);
194
204
  }
195
205
  return o.addEventListener("mouseenter", () => b(e, t.id, !0)), o.addEventListener("mouseleave", () => b(e, t.id, !1)), o;
196
206
  }
197
207
  function m(e) {
198
- const t = e || f();
208
+ const t = e || u();
199
209
  if (!(t != null && t.panelElement)) return;
200
- const r = I(t);
210
+ const r = H(t);
201
211
  t.panelElement.innerHTML = `
202
212
  <div class="rte-comments-header">
203
213
  <div>
@@ -216,61 +226,69 @@ function m(e) {
216
226
  `;
217
227
  const o = t.panelElement.querySelector(".rte-comments-close");
218
228
  o == null || o.addEventListener("click", () => {
219
- y(t, !1);
229
+ h(t, !1);
220
230
  });
221
231
  const a = t.panelElement.querySelector(
222
232
  ".new-comment-textarea"
223
- ), s = t.panelElement.querySelector(
233
+ ), i = t.panelElement.querySelector(
224
234
  ".add-comment-btn"
225
235
  );
226
- if (a && s) {
236
+ if (a && i) {
227
237
  a.value = t.newCommentText;
228
- const i = () => {
238
+ const l = () => {
229
239
  const c = !!a.value.trim();
230
- s.disabled = !c;
240
+ i.disabled = !c;
231
241
  };
232
- i(), a.addEventListener("input", () => {
233
- t.newCommentText = a.value, i();
242
+ l(), a.addEventListener("input", () => {
243
+ t.newCommentText = a.value, l();
234
244
  }), a.addEventListener("keydown", (c) => {
235
- (c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), s.click());
236
- }), s.addEventListener("click", () => {
245
+ (c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), i.click());
246
+ }), i.addEventListener("click", () => {
237
247
  const c = a.value.trim();
238
248
  if (!c) return;
239
249
  const n = !!t.savedSelection;
240
- D(E, c, !n), t.newCommentText = "", m(t);
250
+ O(E, c, !n), t.newCommentText = "", m(t);
241
251
  });
242
252
  }
243
- const u = t.panelElement.querySelector(".rte-comments-list");
244
- u && r.forEach((i) => {
245
- u.appendChild(M(t, i));
253
+ const f = t.panelElement.querySelector(".rte-comments-list");
254
+ f && r.forEach((l) => {
255
+ f.appendChild(D(t, l));
246
256
  });
247
257
  }
248
- function L() {
258
+ function T() {
249
259
  S || (S = !0, document.addEventListener("focusin", (e) => {
250
- const t = v(e.target);
251
- t && (g = t);
260
+ const t = y(e.target);
261
+ t && (x = t);
252
262
  }), document.addEventListener("selectionchange", () => {
253
263
  const e = window.getSelection();
254
264
  if (!e || e.rangeCount === 0) return;
255
- const t = e.getRangeAt(0), r = v(t.commonAncestorContainer);
265
+ const t = e.getRangeAt(0), r = y(t.commonAncestorContainer);
256
266
  if (!r) return;
257
- g = r;
267
+ x = r;
258
268
  const o = C.get(r);
259
269
  !o || e.isCollapsed || w(t, r) && (o.savedSelection = t.cloneRange());
260
- }));
270
+ }), document.addEventListener(
271
+ "keydown",
272
+ (e) => {
273
+ if (e.key !== "Escape") return;
274
+ const t = u();
275
+ !t || !t.panelVisible || (e.preventDefault(), e.stopPropagation(), h(t, !1));
276
+ },
277
+ !0
278
+ ));
261
279
  }
262
- function Z() {
263
- const e = f();
264
- return e ? I(e) : [];
280
+ function K() {
281
+ const e = u();
282
+ return e ? H(e) : [];
265
283
  }
266
- function D(e, t, r = !1) {
284
+ function O(e, t, r = !1) {
267
285
  var p;
268
- const o = f();
286
+ const o = u();
269
287
  if (!o) return "";
270
288
  const a = t.trim();
271
289
  if (!a) return "";
272
290
  if (r) {
273
- const d = h("comment");
291
+ const d = v("comment");
274
292
  return o.comments.set(d, {
275
293
  id: d,
276
294
  anchorId: "",
@@ -282,74 +300,74 @@ function D(e, t, r = !1) {
282
300
  replies: []
283
301
  }), m(o), d;
284
302
  }
285
- const s = o.savedSelection || T(o.root);
286
- if (!s || !w(s, o.root)) return "";
287
- const u = s.toString().trim();
288
- if (!u) return "";
289
- const i = h("comment"), c = h("comment-anchor"), n = document.createElement("span");
290
- n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", i), n.setAttribute("title", "Commented text");
303
+ const i = o.savedSelection || R(o.root);
304
+ if (!i || !w(i, o.root)) return "";
305
+ const f = i.toString().trim();
306
+ if (!f) return "";
307
+ const l = v("comment"), c = v("comment-anchor"), n = document.createElement("span");
308
+ n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", l), n.setAttribute("title", "Commented text");
291
309
  try {
292
- const d = s.cloneRange(), x = d.extractContents();
293
- if (!((p = x.textContent) != null && p.trim())) return "";
294
- n.appendChild(x), d.insertNode(n);
310
+ const d = i.cloneRange(), g = d.extractContents();
311
+ if (!((p = g.textContent) != null && p.trim())) return "";
312
+ n.appendChild(g), d.insertNode(n);
295
313
  } catch (d) {
296
314
  return "";
297
315
  }
298
- H(o, n, i), o.comments.set(i, {
299
- id: i,
316
+ N(o, n, l), o.comments.set(l, {
317
+ id: l,
300
318
  anchorId: c,
301
- selectedText: u,
319
+ selectedText: f,
302
320
  author: e,
303
321
  text: a,
304
322
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
305
323
  resolved: !1,
306
324
  replies: []
307
325
  }), o.savedSelection = null;
308
- const l = window.getSelection();
309
- return l == null || l.removeAllRanges(), m(o), i;
326
+ const s = window.getSelection();
327
+ return s == null || s.removeAllRanges(), m(o), l;
310
328
  }
311
- function O(e, t) {
312
- const r = f();
329
+ function P(e, t) {
330
+ const r = u();
313
331
  if (!r) return;
314
332
  const o = r.comments.get(e);
315
- o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), R(r, o), m(r));
333
+ o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), I(r, o), m(r));
316
334
  }
317
- function j(e) {
318
- const t = f();
335
+ function _(e) {
336
+ const t = u();
319
337
  if (!t) return;
320
338
  const r = t.comments.get(e);
321
- r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, R(t, r), m(t));
339
+ r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, I(t, r), m(t));
322
340
  }
323
- function P(e) {
324
- const t = f();
341
+ function j(e) {
342
+ const t = u();
325
343
  if (!t) return;
326
344
  const r = t.comments.get(e);
327
345
  if (r) {
328
346
  if (r.anchorId) {
329
347
  const o = t.root.querySelector(`#${r.anchorId}`);
330
- o && N(o);
348
+ o && z(o);
331
349
  }
332
350
  t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e], m(t);
333
351
  }
334
352
  }
335
- function _(e, t, r) {
336
- const o = f();
353
+ function F(e, t, r) {
354
+ const o = u();
337
355
  if (!o) return;
338
356
  const a = o.comments.get(e);
339
357
  if (!a) return;
340
- const s = r.trim();
341
- s && (a.replies.push({
342
- id: h("reply"),
358
+ const i = r.trim();
359
+ i && (a.replies.push({
360
+ id: v("reply"),
343
361
  author: t,
344
- text: s,
362
+ text: i,
345
363
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
346
364
  }), m(o));
347
365
  }
348
- function K(e, t) {
349
- const r = f();
366
+ function U(e, t) {
367
+ const r = u();
350
368
  r && b(r, e, t);
351
369
  }
352
- function F() {
370
+ function Z() {
353
371
  if (document.getElementById("rte-comments-panel-styles")) return;
354
372
  const e = document.createElement("style");
355
373
  e.id = "rte-comments-panel-styles", e.textContent = `
@@ -670,7 +688,7 @@ function F() {
670
688
  }
671
689
  `, document.head.appendChild(e);
672
690
  }
673
- const U = () => ({
691
+ const X = () => ({
674
692
  name: "comments",
675
693
  toolbar: [
676
694
  {
@@ -687,37 +705,37 @@ const U = () => ({
687
705
  }
688
706
  ],
689
707
  commands: {
690
- addComment: () => {
691
- var r;
692
- L();
693
- const e = f();
694
- if (!e) return !1;
695
- if (e.savedSelection = T(e.root), e.savedSelection) {
696
- const o = window.getSelection();
697
- o == null || o.removeAllRanges();
708
+ addComment: (e, t) => {
709
+ var a;
710
+ A(t), T();
711
+ const r = u();
712
+ if (!r) return !1;
713
+ if (r.savedSelection = R(r.root), r.savedSelection) {
714
+ const i = window.getSelection();
715
+ i == null || i.removeAllRanges();
698
716
  }
699
- y(e, !0), m(e);
700
- const t = (r = e.panelElement) == null ? void 0 : r.querySelector(
717
+ h(r, !0), m(r);
718
+ const o = (a = r.panelElement) == null ? void 0 : a.querySelector(
701
719
  ".new-comment-textarea"
702
720
  );
703
- return t == null || t.focus({ preventScroll: !0 }), !0;
721
+ return o == null || o.focus({ preventScroll: !0 }), !0;
704
722
  },
705
- toggleComments: () => {
706
- L();
707
- const e = f();
708
- return e ? (y(e, !e.panelVisible), e.panelVisible && m(e), !0) : !1;
723
+ toggleComments: (e, t) => {
724
+ A(t), T();
725
+ const r = u();
726
+ return r ? (h(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
709
727
  }
710
728
  },
711
729
  keymap: {}
712
730
  });
713
731
  export {
714
- U as CommentsPlugin,
715
- D as addCommentCommand,
716
- P as deleteComment,
717
- Z as getAllComments,
718
- K as highlightComment,
719
- j as reopenComment,
720
- _ as replyToComment,
721
- O as resolveComment
732
+ X as CommentsPlugin,
733
+ O as addCommentCommand,
734
+ j as deleteComment,
735
+ K as getAllComments,
736
+ U as highlightComment,
737
+ _ as reopenComment,
738
+ F as replyToComment,
739
+ P as resolveComment
722
740
  };
723
- //# sourceMappingURL=CommentsPlugin.native-tMnWn8a2.mjs.map
741
+ //# sourceMappingURL=CommentsPlugin.native-DPSqTkiv.mjs.map
@@ -1,4 +1,4 @@
1
- const i = () => ({
1
+ const c = () => ({
2
2
  name: "document-manager",
3
3
  toolbar: [
4
4
  {
@@ -22,15 +22,15 @@ const i = () => ({
22
22
  ],
23
23
  commands: {
24
24
  importWord: () => {
25
- const d = () => {
25
+ const l = () => {
26
26
  const e = window.getSelection();
27
27
  if (e && e.rangeCount > 0) {
28
28
  let r = e.getRangeAt(0).startContainer;
29
29
  for (; r && r !== document.body; ) {
30
30
  if (r.nodeType === Node.ELEMENT_NODE) {
31
- const l = r;
32
- if (l.getAttribute("contenteditable") === "true")
33
- return l;
31
+ const d = r;
32
+ if (d.getAttribute("contenteditable") === "true")
33
+ return d;
34
34
  }
35
35
  r = r.parentNode;
36
36
  }
@@ -38,79 +38,79 @@ const i = () => ({
38
38
  const n = document.activeElement;
39
39
  if ((n == null ? void 0 : n.getAttribute("contenteditable")) === "true")
40
40
  return n;
41
- const t = n == null ? void 0 : n.closest('[contenteditable="true"]');
42
- return t || document.querySelector('[contenteditable="true"]');
43
- }, o = document.createElement("input");
44
- return o.type = "file", o.accept = ".docx", o.onchange = async (e) => {
45
- var t;
46
- const n = (t = e.target.files) == null ? void 0 : t[0];
41
+ const o = n == null ? void 0 : n.closest('[contenteditable="true"]');
42
+ return o || document.querySelector('[contenteditable="true"]');
43
+ }, t = document.createElement("input");
44
+ return t.type = "file", t.accept = ".docx", t.onchange = async (e) => {
45
+ var o;
46
+ const n = (o = e.target.files) == null ? void 0 : o[0];
47
47
  if (n)
48
48
  try {
49
- const r = d();
49
+ const r = l();
50
50
  if (r) {
51
- const { importFromWord: l } = await import("./documentManager-irzj9n3V.mjs").then((c) => c.d), a = await l(n);
51
+ const { importFromWord: d } = await import("./documentManager-vQ1VkbUY.mjs"), a = await d(n);
52
52
  r.innerHTML = a, r.dispatchEvent(new Event("input", { bubbles: !0 }));
53
53
  }
54
54
  } catch (r) {
55
55
  console.error("Import failed:", r), alert("Failed to import Word document. Please check the console for details.");
56
56
  }
57
- }, o.click(), !0;
57
+ }, t.click(), !0;
58
58
  },
59
59
  exportWord: async () => {
60
- const d = () => {
61
- const o = window.getSelection();
62
- if (o && o.rangeCount > 0) {
63
- let t = o.getRangeAt(0).startContainer;
64
- for (; t && t !== document.body; ) {
65
- if (t.nodeType === Node.ELEMENT_NODE && t.getAttribute("contenteditable") === "true")
66
- return t;
67
- t = t.parentNode;
60
+ const l = () => {
61
+ const t = window.getSelection();
62
+ if (t && t.rangeCount > 0) {
63
+ let o = t.getRangeAt(0).startContainer;
64
+ for (; o && o !== document.body; ) {
65
+ if (o.nodeType === Node.ELEMENT_NODE && o.getAttribute("contenteditable") === "true")
66
+ return o;
67
+ o = o.parentNode;
68
68
  }
69
69
  }
70
70
  const e = document.activeElement;
71
71
  return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
72
72
  };
73
73
  try {
74
- const o = d();
75
- if (o) {
76
- const e = o.innerHTML, { exportToWord: n } = await import("./documentManager-irzj9n3V.mjs").then((t) => t.d);
74
+ const t = l();
75
+ if (t) {
76
+ const e = t.innerHTML, { exportToWord: n } = await import("./documentManager-vQ1VkbUY.mjs");
77
77
  await n(e, "document.docx");
78
78
  }
79
79
  return !0;
80
- } catch (o) {
81
- return console.error("Export failed:", o), alert("Failed to export to Word. Please check the console for details."), !1;
80
+ } catch (t) {
81
+ return console.error("Export failed:", t), alert("Failed to export to Word. Please check the console for details."), !1;
82
82
  }
83
83
  },
84
84
  exportPdf: async () => {
85
- const d = () => {
86
- const o = window.getSelection();
87
- if (o && o.rangeCount > 0) {
88
- let t = o.getRangeAt(0).startContainer;
89
- for (; t && t !== document.body; ) {
90
- if (t.nodeType === Node.ELEMENT_NODE && t.getAttribute("contenteditable") === "true")
91
- return t;
92
- t = t.parentNode;
85
+ const l = () => {
86
+ const t = window.getSelection();
87
+ if (t && t.rangeCount > 0) {
88
+ let o = t.getRangeAt(0).startContainer;
89
+ for (; o && o !== document.body; ) {
90
+ if (o.nodeType === Node.ELEMENT_NODE && o.getAttribute("contenteditable") === "true")
91
+ return o;
92
+ o = o.parentNode;
93
93
  }
94
94
  }
95
95
  const e = document.activeElement;
96
96
  return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
97
97
  };
98
98
  try {
99
- const o = d();
100
- if (o) {
101
- const e = o.innerHTML, { exportToPdf: n } = await import("./documentManager-irzj9n3V.mjs").then((t) => t.d);
102
- await n(e, "document.pdf", o);
99
+ const t = l();
100
+ if (t) {
101
+ const e = t.innerHTML, { exportToPdf: n } = await import("./documentManager-vQ1VkbUY.mjs");
102
+ await n(e, "document.pdf", t);
103
103
  } else
104
104
  console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
105
105
  return !0;
106
- } catch (o) {
107
- return console.error("PDF Export: Export failed:", o), alert("Failed to export to PDF. Please check the console for details."), !1;
106
+ } catch (t) {
107
+ return console.error("PDF Export: Export failed:", t), alert("Failed to export to PDF. Please check the console for details."), !1;
108
108
  }
109
109
  }
110
110
  },
111
111
  keymap: {}
112
112
  });
113
113
  export {
114
- i as DocumentManagerPlugin
114
+ c as DocumentManagerPlugin
115
115
  };
116
- //# sourceMappingURL=DocumentManagerPlugin.native-BvZL5CSG.mjs.map
116
+ //# sourceMappingURL=DocumentManagerPlugin.native-C2cs_1w4.mjs.map