@editora/core 1.0.8 → 1.0.9

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 (88) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-449ce66c.mjs} +79 -40
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-1cc51e63.mjs} +119 -60
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-169fb1e8.mjs} +137 -69
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-4983143a.mjs} +108 -51
  17. package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-63ed405b.mjs} +100 -50
  18. package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-427e9d75.mjs} +79 -40
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-8e41eda0.mjs} +115 -58
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-3b1e8c05.mjs} +89 -45
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-7ab10b9f.mjs} +107 -54
  40. package/dist/{PageBreakPlugin.native-DijGuHJZ.mjs → PageBreakPlugin.native-1794c5fb.mjs} +31 -16
  41. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-f7b67cc0.mjs} +11 -6
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-8d45e511.mjs} +72 -37
  44. package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-a6c5efec.mjs} +99 -50
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/{TrackChangesPlugin.native-Bghu2q4a.mjs → TrackChangesPlugin.native-e96da509.mjs} +115 -58
  53. package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-4e711b1e.mjs} +160 -91
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-5bbeff85.mjs} +51 -26
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-DqC57IEH.mjs → index-7da30697.mjs} +163 -124
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +67 -67
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +164 -125
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +18 -17
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +226 -187
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +1324 -1117
  81. package/package.json +11 -5
  82. package/LICENSE +0 -21
  83. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  84. package/dist/core.css +0 -1
  85. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index-D1LOqg5C.js +0 -10
  88. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -29,7 +29,8 @@ function Pt(t) {
29
29
  }
30
30
  function ht(t, o) {
31
31
  const e = o(t);
32
- if (!e) return "";
32
+ if (!e)
33
+ return "";
33
34
  const i = e.match(/\d{4}/);
34
35
  return i ? i[0] : e;
35
36
  }
@@ -78,7 +79,8 @@ function X(t) {
78
79
  }
79
80
  function Dt(t) {
80
81
  const o = lt(t);
81
- if (X(o)) return !0;
82
+ if (X(o))
83
+ return !0;
82
84
  const e = o.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
83
85
  return X(e) ? !0 : X(document.documentElement) || X(document.body);
84
86
  }
@@ -86,23 +88,29 @@ function tt(t, o) {
86
88
  t.classList.remove("rte-citations-theme-dark"), Dt(o) && t.classList.add("rte-citations-theme-dark");
87
89
  }
88
90
  function h(t, o = !0) {
89
- if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
91
+ if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
92
+ return t.contentElement;
90
93
  if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
91
94
  const n = t.editorElement;
92
- if (n.matches($)) return n;
95
+ if (n.matches($))
96
+ return n;
93
97
  const r = n.querySelector($);
94
- if (r instanceof HTMLElement) return r;
98
+ if (r instanceof HTMLElement)
99
+ return r;
95
100
  }
96
101
  const e = window.getSelection();
97
102
  if (e && e.rangeCount > 0) {
98
103
  const n = e.getRangeAt(0).startContainer, r = Ct(n), a = r == null ? void 0 : r.closest($);
99
- if (a) return a;
104
+ if (a)
105
+ return a;
100
106
  }
101
107
  const i = document.activeElement;
102
108
  if (i) {
103
- if (i.matches($)) return i;
109
+ if (i.matches($))
110
+ return i;
104
111
  const n = i.closest($);
105
- if (n) return n;
112
+ if (n)
113
+ return n;
106
114
  }
107
115
  return p && p.isConnected ? p : (p && !p.isConnected && (p = null), o ? document.querySelector($) : null);
108
116
  }
@@ -116,7 +124,8 @@ function j(t) {
116
124
  function Ht(t, o) {
117
125
  if (at += 1, o.generateCitationId) {
118
126
  const e = o.generateCitationId({ editor: t, index: at }), i = F(o.normalizeText(e || ""));
119
- if (i) return i;
127
+ if (i)
128
+ return i;
120
129
  }
121
130
  return `cite-${Date.now().toString(36)}-${at.toString(36)}`;
122
131
  }
@@ -156,7 +165,8 @@ function R(t) {
156
165
  }
157
166
  function wt(t, o) {
158
167
  const e = F(o.normalizeText(t.getAttribute("data-citation-id") || ""));
159
- if (!e) return null;
168
+ if (!e)
169
+ return null;
160
170
  const i = o.normalizeText(t.getAttribute("data-citation-author") || ""), n = o.normalizeText(t.getAttribute("data-citation-title") || "");
161
171
  return {
162
172
  id: e,
@@ -189,7 +199,8 @@ function K(t, o) {
189
199
  const e = R(t), i = /* @__PURE__ */ new Map();
190
200
  return e.forEach((n) => {
191
201
  const r = wt(n, o);
192
- if (!r) return;
202
+ if (!r)
203
+ return;
193
204
  if (!i.has(r.id)) {
194
205
  i.set(r.id, r);
195
206
  return;
@@ -208,7 +219,8 @@ function K(t, o) {
208
219
  }
209
220
  function _t(t, o, e) {
210
221
  const i = yt(o, e);
211
- if (!i.id || !i.author || !i.title) return;
222
+ if (!i.id || !i.author || !i.title)
223
+ return;
212
224
  const r = (D.get(t) || []).filter((a) => a.id !== i.id);
213
225
  D.set(t, [i, ...r].slice(0, e.maxRecentCitations));
214
226
  }
@@ -228,7 +240,8 @@ function Et(t, o, e, i) {
228
240
  }
229
241
  function qt(t, o, e) {
230
242
  const i = F(e.normalizeText(o || ""));
231
- if (!i) return !1;
243
+ if (!i)
244
+ return !1;
232
245
  const n = D.get(t) || [], r = n.filter((a) => a.id !== i);
233
246
  return r.length === n.length ? !1 : (D.set(t, r), !0);
234
247
  }
@@ -262,7 +275,8 @@ function Ut(t, o, e, i) {
262
275
  return;
263
276
  }
264
277
  const r = jt(t, e).querySelector(".rte-citation-list");
265
- if (!r) return;
278
+ if (!r)
279
+ return;
266
280
  const a = document.createDocumentFragment();
267
281
  o.forEach((s, d) => {
268
282
  const c = document.createElement("li");
@@ -277,7 +291,8 @@ function Wt(t, o, e, i) {
277
291
  return;
278
292
  }
279
293
  const r = Kt(t, e).querySelector(".rte-citation-list");
280
- if (!r) return;
294
+ if (!r)
295
+ return;
281
296
  const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
282
297
  o.forEach((l, u) => {
283
298
  s.set(l.id, u + 1);
@@ -285,7 +300,8 @@ function Wt(t, o, e, i) {
285
300
  const d = /* @__PURE__ */ new Map();
286
301
  R(t).forEach((l) => {
287
302
  const u = l.getAttribute("data-citation-id") || "";
288
- if (!u || !s.has(u)) return;
303
+ if (!u || !s.has(u))
304
+ return;
289
305
  const b = (d.get(u) || 0) + 1;
290
306
  d.set(u, b);
291
307
  const w = `rte-citation-ref-${u}-${b}`;
@@ -324,9 +340,11 @@ function Vt(t, o, e) {
324
340
  }
325
341
  function H(t) {
326
342
  const o = v.get(t);
327
- if (!o) return;
343
+ if (!o)
344
+ return;
328
345
  const e = f.get(t) || M;
329
- if (!e) return;
346
+ if (!e)
347
+ return;
330
348
  const i = N(t, e), n = K(t, e), r = rt(t, n, e), a = o.querySelector(".rte-citations-status"), s = o.querySelector('[data-action="cycle-style"]'), d = o.querySelector(".rte-citations-recent-list");
331
349
  if (a) {
332
350
  const c = n.length;
@@ -380,7 +398,8 @@ function y(t, o, e = !1) {
380
398
  d.set(c.id, l + 1);
381
399
  }), r.forEach((c) => {
382
400
  const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
383
- if (!u) return;
401
+ if (!u)
402
+ return;
384
403
  vt(c, u, i);
385
404
  const b = d.get(u.id) || 1;
386
405
  Gt(c, u, i, Math.max(1, b));
@@ -401,7 +420,8 @@ function At(t) {
401
420
  }
402
421
  function kt(t) {
403
422
  const o = f.get(t) || M;
404
- if (!o) return;
423
+ if (!o)
424
+ return;
405
425
  At(t);
406
426
  const e = window.setTimeout(() => {
407
427
  q.delete(e), Q.delete(t), y(t, o, !1);
@@ -410,7 +430,8 @@ function kt(t) {
410
430
  }
411
431
  function Yt(t) {
412
432
  const o = window.getSelection();
413
- if (!o) throw new Error("Selection unavailable");
433
+ if (!o)
434
+ throw new Error("Selection unavailable");
414
435
  if (o.rangeCount > 0) {
415
436
  const a = o.getRangeAt(0);
416
437
  if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
@@ -423,7 +444,8 @@ function dt(t) {
423
444
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
424
445
  }
425
446
  function ft(t, o) {
426
- if (o === t.innerHTML) return;
447
+ if (o === t.innerHTML)
448
+ return;
427
449
  const e = window.execEditorCommand || window.executeEditorCommand;
428
450
  if (typeof e == "function")
429
451
  try {
@@ -433,7 +455,8 @@ function ft(t, o) {
433
455
  }
434
456
  function Tt(t, o) {
435
457
  const e = window.getSelection();
436
- if (!e) return;
458
+ if (!e)
459
+ return;
437
460
  const i = document.createRange();
438
461
  if (t.nodeType === Node.TEXT_NODE) {
439
462
  const n = t, r = Math.max(0, Math.min(o, n.length));
@@ -455,7 +478,8 @@ function J(t, o, e) {
455
478
  if (i.nodeType === Node.ELEMENT_NODE) {
456
479
  const a = i;
457
480
  if (e === "previous") {
458
- if (n > 0) return a.childNodes[n - 1] || null;
481
+ if (n > 0)
482
+ return a.childNodes[n - 1] || null;
459
483
  } else if (n < a.childNodes.length)
460
484
  return a.childNodes[n] || null;
461
485
  }
@@ -464,13 +488,15 @@ function J(t, o, e) {
464
488
  let r = i;
465
489
  for (; r && r !== o; ) {
466
490
  const a = e === "previous" ? r.previousSibling : r.nextSibling;
467
- if (a) return a;
491
+ if (a)
492
+ return a;
468
493
  r = r.parentNode;
469
494
  }
470
495
  return null;
471
496
  }
472
497
  function Lt(t, o, e) {
473
- if (!t.collapsed) return null;
498
+ if (!t.collapsed)
499
+ return null;
474
500
  const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: n, startOffset: r } = t;
475
501
  if (n.nodeType === Node.ELEMENT_NODE) {
476
502
  const a = n;
@@ -491,23 +517,29 @@ function Lt(t, o, e) {
491
517
  }
492
518
  function P(t, o, e) {
493
519
  const i = t.closest($);
494
- if (!i || j(t)) return !1;
520
+ if (!i || j(t))
521
+ return !1;
495
522
  const n = t.parentNode;
496
- if (!n) return !1;
523
+ if (!n)
524
+ return !1;
497
525
  const r = i.innerHTML, a = Array.from(n.childNodes).indexOf(t);
498
- if (a < 0) return !1;
526
+ if (a < 0)
527
+ return !1;
499
528
  const s = t.nextSibling;
500
529
  return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(n, a), y(i, e, !0), ft(i, r), dt(i), o === "Delete" && i.focus({ preventScroll: !0 }), !0;
501
530
  }
502
531
  function Xt(t, o, e) {
503
- if (t.key !== "Backspace" && t.key !== "Delete") return !1;
532
+ if (t.key !== "Backspace" && t.key !== "Delete")
533
+ return !1;
504
534
  const i = t.key, n = t.target;
505
535
  if (n != null && n.matches(ot) && o.contains(n) && !j(n))
506
536
  return t.preventDefault(), t.stopPropagation(), P(n, i, e);
507
537
  const r = window.getSelection();
508
- if (!r || r.rangeCount === 0) return !1;
538
+ if (!r || r.rangeCount === 0)
539
+ return !1;
509
540
  const a = r.getRangeAt(0);
510
- if (!o.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
541
+ if (!o.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer))
542
+ return !1;
511
543
  const s = Mt(a);
512
544
  if (s)
513
545
  return t.preventDefault(), t.stopPropagation(), P(s, i, e);
@@ -516,9 +548,11 @@ function Xt(t, o, e) {
516
548
  }
517
549
  function Rt(t, o, e) {
518
550
  const i = F(e.normalizeText(o || ""));
519
- if (!i) return !1;
551
+ if (!i)
552
+ return !1;
520
553
  const n = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
521
- if (n.length === 0) return !1;
554
+ if (n.length === 0)
555
+ return !1;
522
556
  if (n.length === 1)
523
557
  return P(n[0], "Delete", e);
524
558
  const r = t.innerHTML;
@@ -529,9 +563,11 @@ function Rt(t, o, e) {
529
563
  }
530
564
  function Jt(t, o) {
531
565
  const e = window.getSelection();
532
- if (!e || e.rangeCount === 0) return !1;
566
+ if (!e || e.rangeCount === 0)
567
+ return !1;
533
568
  const i = e.getRangeAt(0);
534
- if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
569
+ if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer))
570
+ return !1;
535
571
  const n = Mt(i);
536
572
  if (n)
537
573
  return P(n, "Delete", o);
@@ -541,7 +577,8 @@ function Jt(t, o) {
541
577
  function et(t, o, e) {
542
578
  var l, u;
543
579
  const i = yt(o, e);
544
- if (!i.author || !i.title) return !1;
580
+ if (!i.author || !i.title)
581
+ return !1;
545
582
  i.id || (i.id = Ht(t, e));
546
583
  const n = t.innerHTML;
547
584
  let r;
@@ -551,7 +588,8 @@ function et(t, o, e) {
551
588
  return !1;
552
589
  }
553
590
  const a = window.getSelection();
554
- if (!a) return !1;
591
+ if (!a)
592
+ return !1;
555
593
  r.collapsed || r.deleteContents();
556
594
  const s = document.createElement("span");
557
595
  vt(s, i, N(t, e));
@@ -571,12 +609,15 @@ function et(t, o, e) {
571
609
  return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i, e), y(t, e, !0), ft(t, n), dt(t), !0;
572
610
  }
573
611
  function Zt(t, o) {
574
- if (!o) return !1;
612
+ if (!o)
613
+ return !1;
575
614
  const e = R(t).find((r) => r.getAttribute("data-citation-id") === o) || null;
576
- if (!e) return !1;
615
+ if (!e)
616
+ return !1;
577
617
  e.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 });
578
618
  const i = window.getSelection();
579
- if (!i) return !0;
619
+ if (!i)
620
+ return !0;
580
621
  const n = document.createRange();
581
622
  return n.selectNode(e), i.removeAllRanges(), i.addRange(n), !0;
582
623
  }
@@ -593,7 +634,8 @@ function Qt(t) {
593
634
  });
594
635
  }
595
636
  function ct(t, o) {
596
- if (!o.classList.contains("show")) return;
637
+ if (!o.classList.contains("show"))
638
+ return;
597
639
  const i = lt(t).getBoundingClientRect(), n = Math.min(window.innerWidth - 20, 380), r = Math.max(10, window.innerWidth - n - 10), a = Math.min(Math.max(10, i.right - n), r), s = Math.max(10, Math.min(window.innerHeight - 10 - 260, i.top + 10));
598
640
  o.style.width = `${n}px`, o.style.left = `${a}px`, o.style.top = `${s}px`, o.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
599
641
  }
@@ -630,7 +672,8 @@ function bt(t, o) {
630
672
  }
631
673
  function ne(t) {
632
674
  const o = v.get(t);
633
- if (o) return o;
675
+ if (o)
676
+ return o;
634
677
  const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Ot++}`, n = document.createElement("section");
635
678
  n.className = m, n.id = i, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", e.labels.panelAriaLabel), n.setAttribute("tabindex", "-1"), n.innerHTML = `
636
679
  <header class="rte-citations-header">
@@ -691,16 +734,19 @@ function ne(t) {
691
734
  </div>
692
735
  `, n.addEventListener("click", (a) => {
693
736
  const s = a.target;
694
- if (!s) return;
737
+ if (!s)
738
+ return;
695
739
  const d = s.closest("[data-action]");
696
- if (!d) return;
740
+ if (!d)
741
+ return;
697
742
  const c = d.getAttribute("data-action") || "", l = f.get(t) || M || e;
698
743
  if (f.set(t, l), c === "close") {
699
744
  U(t, !0);
700
745
  return;
701
746
  }
702
747
  if (c === "insert") {
703
- if (S(t)) return;
748
+ if (S(t))
749
+ return;
704
750
  const u = te(n);
705
751
  if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
706
752
  E(n, l.labels.invalidMessage);
@@ -726,14 +772,17 @@ function ne(t) {
726
772
  return;
727
773
  }
728
774
  if (c === "insert-from-recent") {
729
- if (S(t)) return;
775
+ if (S(t))
776
+ return;
730
777
  const u = d.getAttribute("data-citation-id") || "", b = Et(t, u, K(t, l), l);
731
- if (!b) return;
778
+ if (!b)
779
+ return;
732
780
  et(t, b, l), E(n, `Inserted citation: ${b.title}.`);
733
781
  return;
734
782
  }
735
783
  if (c === "delete-by-id") {
736
- if (S(t)) return;
784
+ if (S(t))
785
+ return;
737
786
  const u = d.getAttribute("data-citation-id") || "";
738
787
  if (Rt(t, u, l)) {
739
788
  E(n, "Citation deleted.");
@@ -747,11 +796,14 @@ function ne(t) {
747
796
  return;
748
797
  }
749
798
  const s = a.target;
750
- if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
799
+ if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp")
800
+ return;
751
801
  const d = Array.from(n.querySelectorAll(".rte-citations-recent-btn"));
752
- if (d.length === 0) return;
802
+ if (d.length === 0)
803
+ return;
753
804
  const c = d.indexOf(s);
754
- if (c < 0) return;
805
+ if (c < 0)
806
+ return;
755
807
  a.preventDefault();
756
808
  const l = a.key === "ArrowDown" ? 1 : -1, u = (c + l + d.length) % d.length;
757
809
  d[u].focus();
@@ -787,7 +839,8 @@ function re(t) {
787
839
  function ae(t) {
788
840
  M = t, I || (I = (o) => {
789
841
  const e = o.target, i = e == null ? void 0 : e.closest($);
790
- if (!i) return;
842
+ if (!i)
843
+ return;
791
844
  p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
792
845
  const n = v.get(i);
793
846
  n && (tt(n, i), ct(i, n)), it(i, "toggleCitationsPanel", nt(i));
@@ -795,9 +848,11 @@ function ae(t) {
795
848
  const e = o.target, i = e == null ? void 0 : e.closest($);
796
849
  i && (p = i, kt(i));
797
850
  }, document.addEventListener("input", B, !0)), O || (O = (o) => {
798
- if (o.defaultPrevented) return;
851
+ if (o.defaultPrevented)
852
+ return;
799
853
  const e = o.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), n = h(void 0, !1);
800
- if (!n || S(n)) return;
854
+ if (!n || S(n))
855
+ return;
801
856
  const r = f.get(n) || M || t;
802
857
  if (f.set(n, r), p = n, o.key === "Escape" && nt(n)) {
803
858
  o.preventDefault(), U(n, !0);
@@ -828,7 +883,8 @@ function se() {
828
883
  I && (document.removeEventListener("focusin", I, !0), I = null), B && (document.removeEventListener("input", B, !0), B = null), O && (document.removeEventListener("keydown", O, !0), O = null), k && (window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), k = null), v.forEach((t) => t.remove()), v.clear(), M = null, p = null;
829
884
  }
830
885
  function ce() {
831
- if (typeof document == "undefined" || document.getElementById(gt)) return;
886
+ if (typeof document == "undefined" || document.getElementById(gt))
887
+ return;
832
888
  const t = document.createElement("style");
833
889
  t.id = gt, t.textContent = `
834
890
  .rte-toolbar-group-items.citations,
@@ -1338,13 +1394,15 @@ const le = (t = {}) => {
1338
1394
  commands: {
1339
1395
  citations: (e, i) => {
1340
1396
  const n = h(i);
1341
- if (!n || S(n)) return !1;
1397
+ if (!n || S(n))
1398
+ return !1;
1342
1399
  const r = f.get(n) || o;
1343
1400
  return f.set(n, r), T.set(n, N(n, r)), p = n, z(n), y(n, r, !1), !0;
1344
1401
  },
1345
1402
  toggleCitationsPanel: (e, i) => {
1346
1403
  const n = h(i);
1347
- if (!n || S(n)) return !1;
1404
+ if (!n || S(n))
1405
+ return !1;
1348
1406
  const r = f.get(n) || o;
1349
1407
  f.set(n, r), p = n;
1350
1408
  const a = zt(n, typeof e == "boolean" ? e : void 0);
@@ -1352,7 +1410,8 @@ const le = (t = {}) => {
1352
1410
  },
1353
1411
  insertCitation: (e, i) => {
1354
1412
  const n = h(i);
1355
- if (!n || S(n) || !e || typeof e != "object") return !1;
1413
+ if (!n || S(n) || !e || typeof e != "object")
1414
+ return !1;
1356
1415
  const r = f.get(n) || o;
1357
1416
  f.set(n, r), p = n;
1358
1417
  const a = et(n, e, r);
@@ -1360,25 +1419,29 @@ const le = (t = {}) => {
1360
1419
  },
1361
1420
  refreshCitations: (e, i) => {
1362
1421
  const n = h(i);
1363
- if (!n) return !1;
1422
+ if (!n)
1423
+ return !1;
1364
1424
  const r = f.get(n) || o;
1365
1425
  return f.set(n, r), p = n, y(n, r, !0), z(n), !0;
1366
1426
  },
1367
1427
  setCitationStyle: (e, i) => {
1368
1428
  const n = h(i);
1369
- if (!n || !e) return !1;
1429
+ if (!n || !e)
1430
+ return !1;
1370
1431
  const r = f.get(n) || o;
1371
1432
  return f.set(n, r), p = n, Nt(n, e, r), !0;
1372
1433
  },
1373
1434
  cycleCitationStyle: (e, i) => {
1374
1435
  const n = h(i);
1375
- if (!n) return !1;
1436
+ if (!n)
1437
+ return !1;
1376
1438
  const r = f.get(n) || o;
1377
1439
  return f.set(n, r), p = n, bt(n, r), H(n), !0;
1378
1440
  },
1379
1441
  getCitationRecords: (e, i) => {
1380
1442
  const n = h(i);
1381
- if (!n) return !1;
1443
+ if (!n)
1444
+ return !1;
1382
1445
  const r = f.get(n) || o, a = K(n, r);
1383
1446
  if (typeof e == "function")
1384
1447
  try {
@@ -1397,7 +1460,8 @@ const le = (t = {}) => {
1397
1460
  },
1398
1461
  setCitationsOptions: (e, i) => {
1399
1462
  const n = h(i);
1400
- if (!n || !e || typeof e != "object") return !1;
1463
+ if (!n || !e || typeof e != "object")
1464
+ return !1;
1401
1465
  const r = f.get(n) || o, a = Z({
1402
1466
  ...r,
1403
1467
  ...e,
@@ -1416,19 +1480,23 @@ const le = (t = {}) => {
1416
1480
  },
1417
1481
  deleteCitation: (e, i) => {
1418
1482
  const n = h(i);
1419
- if (!n || S(n)) return !1;
1483
+ if (!n || S(n))
1484
+ return !1;
1420
1485
  const r = f.get(n) || o;
1421
1486
  return f.set(n, r), typeof e == "string" && e.trim() ? Rt(n, e, r) : Jt(n, r);
1422
1487
  },
1423
1488
  insertRecentCitation: (e, i) => {
1424
1489
  const n = h(i);
1425
- if (!n || S(n)) return !1;
1490
+ if (!n || S(n))
1491
+ return !1;
1426
1492
  const r = f.get(n) || o;
1427
1493
  f.set(n, r);
1428
1494
  const a = K(n, r), s = rt(n, a, r);
1429
- if (s.length === 0) return !1;
1495
+ if (s.length === 0)
1496
+ return !1;
1430
1497
  const d = typeof e == "string" && e.trim() ? Et(n, e, a, r) : s[0];
1431
- if (!d) return !1;
1498
+ if (!d)
1499
+ return !1;
1432
1500
  const c = et(n, d, r);
1433
1501
  return c && z(n), c;
1434
1502
  }
@@ -1461,4 +1529,4 @@ const le = (t = {}) => {
1461
1529
  export {
1462
1530
  le as CitationsPlugin
1463
1531
  };
1464
- //# sourceMappingURL=CitationsPlugin.native-BnU0qCwR.mjs.map
1532
+ //# sourceMappingURL=CitationsPlugin.native-169fb1e8.mjs.map
@@ -16,11 +16,14 @@ const p = () => ({
16
16
  */
17
17
  clearFormatting: () => {
18
18
  const t = f();
19
- if (!t) return !1;
19
+ if (!t)
20
+ return !1;
20
21
  const n = window.getSelection();
21
- if (!n || n.rangeCount === 0) return !1;
22
+ if (!n || n.rangeCount === 0)
23
+ return !1;
22
24
  const o = n.getRangeAt(0);
23
- if (!t.contains(o.commonAncestorContainer)) return !1;
25
+ if (!t.contains(o.commonAncestorContainer))
26
+ return !1;
24
27
  const e = o.cloneRange();
25
28
  return t.focus({ preventScroll: !0 }), document.execCommand("unlink", !1), document.execCommand("removeFormat", !1), h(t, e), m(t, e), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
26
29
  }
@@ -73,7 +76,8 @@ function f() {
73
76
  const t = window.getSelection();
74
77
  if (t && t.rangeCount > 0) {
75
78
  const o = t.getRangeAt(0).startContainer, e = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement, r = e == null ? void 0 : e.closest('[contenteditable="true"], .rte-content, .editora-content');
76
- if (r) return r;
79
+ if (r)
80
+ return r;
77
81
  }
78
82
  const n = document.activeElement;
79
83
  return n ? n.getAttribute("contenteditable") === "true" ? n : n.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
@@ -111,7 +115,8 @@ function h(t, n) {
111
115
  t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
112
116
  ).forEach((e) => {
113
117
  var a;
114
- if (!s(n, e) || !u.has(e.tagName)) return;
118
+ if (!s(n, e) || !u.has(e.tagName))
119
+ return;
115
120
  const r = document.createElement("p");
116
121
  for (; e.firstChild; )
117
122
  r.appendChild(e.firstChild);
@@ -137,4 +142,4 @@ function m(t, n) {
137
142
  export {
138
143
  p as ClearFormattingPlugin
139
144
  };
140
- //# sourceMappingURL=ClearFormattingPlugin.native-Bq_XcTh2.mjs.map
145
+ //# sourceMappingURL=ClearFormattingPlugin.native-77baa514.mjs.map