@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,4 +1,5 @@
1
- const K = [
1
+ import { f as D, k as Q, p as ee } from "./dialogHelpers-Dzn8DHoF.mjs";
2
+ const te = [
2
3
  "a",
3
4
  "aa",
4
5
  "aaa",
@@ -9999,50 +10000,90 @@ const K = [
9999
10000
  "zu",
10000
10001
  "zum",
10001
10002
  "zus"
10002
- ], $ = /* @__PURE__ */ new Set([
10003
- ...K,
10003
+ ];
10004
+ function ie(e, t, a = 1 / 0) {
10005
+ if (e === t) return 0;
10006
+ if (Math.abs(e.length - t.length) > a) return a + 1;
10007
+ const s = [];
10008
+ for (let i = 0; i <= e.length; i++)
10009
+ s[i] = [i];
10010
+ for (let i = 1; i <= t.length; i++) s[0][i] = i;
10011
+ for (let i = 1; i <= e.length; i++) {
10012
+ let n = 1 / 0;
10013
+ for (let o = 1; o <= t.length; o++) {
10014
+ const l = e.charCodeAt(i - 1) === t.charCodeAt(o - 1) ? 0 : 1;
10015
+ let p = Math.min(s[i - 1][o] + 1, s[i][o - 1] + 1, s[i - 1][o - 1] + l);
10016
+ i > 1 && o > 1 && e.charCodeAt(i - 1) === t.charCodeAt(o - 2) && e.charCodeAt(i - 2) === t.charCodeAt(o - 1) && (p = Math.min(p, s[i - 2][o - 2] + 1)), s[i][o] = p, p < n && (n = p);
10017
+ }
10018
+ if (n > a) return a + 1;
10019
+ }
10020
+ return s[e.length][t.length];
10021
+ }
10022
+ function ae(e) {
10023
+ return e <= 4 ? 1 : e <= 7 ? 2 : 3;
10024
+ }
10025
+ function re(e, t, a = 5) {
10026
+ const r = e.toLowerCase(), s = ae(r.length), i = [], n = [...r].sort().join("");
10027
+ let o = 0;
10028
+ for (const l of t) {
10029
+ if (o += 1, Math.abs(l.length - r.length) > s) continue;
10030
+ const p = ie(r, l, s);
10031
+ p > s || i.push({
10032
+ word: l,
10033
+ distance: p,
10034
+ notAnagram: [...l].sort().join("") === n ? 0 : 1,
10035
+ sameInitial: l[0] === r[0] ? 0 : 1,
10036
+ rank: o
10037
+ });
10038
+ }
10039
+ return i.sort(
10040
+ (l, p) => l.distance - p.distance || l.notAnagram - p.notAnagram || l.sameInitial - p.sameInitial || l.rank - p.rank
10041
+ ), i.slice(0, a).map((l) => l.word);
10042
+ }
10043
+ const P = /* @__PURE__ */ new Set([
10044
+ ...te,
10004
10045
  "hers",
10005
10046
  "theirs",
10006
10047
  "lorem",
10007
10048
  "ipsum"
10008
- ]), z = /* @__PURE__ */ new Set(), q = /* @__PURE__ */ new Set();
10009
- let m = !1, d = null, b = null, o = null, l = null, v = null, x = !1, u = null, O = !1, f = 0, y = null;
10010
- const B = {
10049
+ ]), q = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set();
10050
+ let h = !1, u = null, y = null, c = null, d = null, w = null, j = !1, g = null, F = !1, v = 0, k = null;
10051
+ const W = {
10011
10052
  characterData: !0,
10012
10053
  childList: !0,
10013
10054
  subtree: !0
10014
- }, D = "rte-spellcheck-styles", F = "__editoraCommandEditorRoot";
10015
- function Q(e) {
10016
- var s;
10055
+ }, I = "rte-spellcheck-styles", H = "__editoraCommandEditorRoot";
10056
+ function se(e) {
10057
+ var i;
10017
10058
  const t = (e == null ? void 0 : e.contentElement) || (e == null ? void 0 : e.editorElement) || null;
10018
10059
  if (!(t instanceof HTMLElement)) return;
10019
- const r = t.getAttribute("contenteditable") === "true" ? t : (s = t.querySelector) == null ? void 0 : s.call(t, '[contenteditable="true"]');
10020
- if (r instanceof HTMLElement) {
10021
- l = r, u = r;
10060
+ const a = t.getAttribute("contenteditable") === "true" ? t : (i = t.querySelector) == null ? void 0 : i.call(t, '[contenteditable="true"]');
10061
+ if (a instanceof HTMLElement) {
10062
+ d = a, g = a;
10022
10063
  return;
10023
10064
  }
10024
- const i = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null), a = S(i);
10025
- a && (l = a, u = a);
10065
+ 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), s = A(r);
10066
+ s && (d = s, g = s);
10026
10067
  }
10027
- function P() {
10068
+ function G() {
10028
10069
  if (typeof window == "undefined") return null;
10029
- const e = window[F];
10070
+ const e = window[H];
10030
10071
  if (!(e instanceof HTMLElement)) return null;
10031
- window[F] = null;
10072
+ window[H] = null;
10032
10073
  const t = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
10033
10074
  if (t) {
10034
- const i = S(t);
10035
- if (i) return i;
10075
+ const r = A(t);
10076
+ if (r) return r;
10036
10077
  if (t.getAttribute("contenteditable") === "true") return t;
10037
10078
  }
10038
10079
  if (e.getAttribute("contenteditable") === "true")
10039
10080
  return e;
10040
- const r = e.closest('[contenteditable="true"]');
10041
- return r instanceof HTMLElement ? r : null;
10081
+ const a = e.closest('[contenteditable="true"]');
10082
+ return a instanceof HTMLElement ? a : null;
10042
10083
  }
10043
- function C() {
10044
- let e = document.getElementById(D);
10045
- e || (e = document.createElement("style"), e.id = D, document.head.appendChild(e)), e.textContent = `
10084
+ function S() {
10085
+ let e = document.getElementById(I);
10086
+ e || (e = document.createElement("style"), e.id = I, document.head.appendChild(e)), e.textContent = `
10046
10087
  .rte-spell-check-panel {
10047
10088
  position: absolute;
10048
10089
  top: 12px;
@@ -10512,302 +10553,286 @@ function C() {
10512
10553
  }
10513
10554
  `;
10514
10555
  }
10515
- function h() {
10516
- if (l && document.contains(l))
10517
- return l;
10518
- const e = J();
10519
- return e && (l = e), e;
10556
+ function f() {
10557
+ if (d && document.contains(d))
10558
+ return d;
10559
+ const e = U();
10560
+ return e && (d = e), e;
10520
10561
  }
10521
- function W(e) {
10562
+ function J(e) {
10522
10563
  if (!e) return;
10523
- const t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, r = t == null ? void 0 : t.closest('[contenteditable="true"]');
10524
- r && (l = r);
10564
+ const t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, a = t == null ? void 0 : t.closest('[contenteditable="true"]');
10565
+ a && (d = a);
10525
10566
  }
10526
- function S(e) {
10567
+ function A(e) {
10527
10568
  if (!e) return null;
10528
10569
  const t = e.querySelector('[contenteditable="true"]');
10529
10570
  return t instanceof HTMLElement ? t : null;
10530
10571
  }
10531
- function ee() {
10532
- if (O) return;
10572
+ function ne() {
10573
+ if (F) return;
10533
10574
  const e = (t) => {
10534
- const r = t.target;
10535
- if (!r) return;
10536
- const i = r.closest(
10575
+ const a = t.target;
10576
+ if (!a) return;
10577
+ const r = a.closest(
10537
10578
  '.editora-toolbar-button[data-command="toggleSpellCheck"], .rte-toolbar-button[data-command="toggleSpellCheck"]'
10538
10579
  );
10539
- if (!i) return;
10540
- const a = i.closest("[data-editora-editor]"), s = S(a);
10541
- s && (u = s, l = s);
10580
+ if (!r) return;
10581
+ const s = r.closest("[data-editora-editor]"), i = A(s);
10582
+ i && (g = i, d = i);
10542
10583
  };
10543
- document.addEventListener("pointerdown", e, !0), O = !0;
10584
+ document.addEventListener("pointerdown", e, !0), F = !0;
10544
10585
  }
10545
- function te() {
10546
- const e = P();
10586
+ function oe() {
10587
+ const e = G();
10547
10588
  if (e && document.contains(e))
10548
- return l = e, u = null, e;
10549
- if (u && document.contains(u)) {
10550
- const t = u;
10551
- return u = null, l = t, t;
10589
+ return d = e, g = null, e;
10590
+ if (g && document.contains(g)) {
10591
+ const t = g;
10592
+ return g = null, d = t, t;
10552
10593
  }
10553
- return J();
10594
+ return U();
10554
10595
  }
10555
- function ie() {
10556
- f += 1, f === 1 && d && d.disconnect();
10596
+ function le() {
10597
+ v += 1, v === 1 && u && u.disconnect();
10557
10598
  }
10558
- function ae() {
10559
- if (f === 0 || (f -= 1, f > 0) || !d) return;
10560
- const e = h();
10561
- e && d.observe(e, B);
10599
+ function ce() {
10600
+ if (v === 0 || (v -= 1, v > 0) || !u) return;
10601
+ const e = f();
10602
+ e && u.observe(e, W);
10562
10603
  }
10563
10604
  function L(e) {
10564
- ie();
10605
+ le();
10565
10606
  try {
10566
10607
  return e();
10567
10608
  } finally {
10568
- ae();
10609
+ ce();
10569
10610
  }
10570
10611
  }
10571
- const re = () => {
10612
+ const de = () => {
10572
10613
  try {
10573
10614
  const e = localStorage.getItem("rte-custom-dictionary");
10574
- e && JSON.parse(e).forEach((r) => z.add(r.toLowerCase()));
10615
+ e && JSON.parse(e).forEach((a) => q.add(a.toLowerCase()));
10575
10616
  } catch (e) {
10576
10617
  console.warn("Failed to load custom dictionary:", e);
10577
10618
  }
10578
- }, se = () => {
10619
+ }, pe = () => {
10579
10620
  try {
10580
- const e = Array.from(z);
10621
+ const e = Array.from(q);
10581
10622
  localStorage.setItem("rte-custom-dictionary", JSON.stringify(e));
10582
10623
  } catch (e) {
10583
10624
  console.warn("Failed to save custom dictionary:", e);
10584
10625
  }
10585
10626
  };
10586
- function ne(e, t) {
10587
- const r = [];
10588
- for (let i = 0; i <= t.length; i++) r[i] = [i];
10589
- for (let i = 0; i <= e.length; i++) r[0][i] = i;
10590
- for (let i = 1; i <= t.length; i++)
10591
- for (let a = 1; a <= e.length; a++)
10592
- t.charAt(i - 1) === e.charAt(a - 1) ? r[i][a] = r[i - 1][a - 1] : r[i][a] = Math.min(
10593
- r[i - 1][a - 1] + 1,
10594
- // substitution
10595
- r[i][a - 1] + 1,
10596
- // insertion
10597
- r[i - 1][a] + 1
10598
- // deletion
10599
- );
10600
- return r[t.length][e.length];
10601
- }
10602
- function oe(e) {
10627
+ function ue(e) {
10603
10628
  const t = e.toLowerCase();
10604
- return $.has(t) || z.has(t) || q.has(t);
10629
+ return P.has(t) || q.has(t) || E.has(t);
10605
10630
  }
10606
- function le(e, t = 5) {
10607
- const r = e.toLowerCase(), a = Array.from($).map((s) => ({ word: s, distance: ne(r, s) }));
10608
- return a.sort((s, n) => s.distance - n.distance), a.filter((s) => s.distance <= 3).slice(0, t).map((s) => s.word);
10631
+ function me(e, t = 5) {
10632
+ return re(e, P, t);
10609
10633
  }
10610
- function ce(e) {
10634
+ function ge(e) {
10611
10635
  if (e.nodeType !== Node.ELEMENT_NODE) return !1;
10612
10636
  const t = e;
10613
10637
  return !!(t.closest('code, pre, [contenteditable="false"], .rte-widget, .rte-template, .rte-comment, .rte-merge-tag') || t.hasAttribute("data-comment-id") || t.hasAttribute("data-template") || t.hasAttribute("data-merge-tag"));
10614
10638
  }
10615
- function de(e) {
10616
- const t = [], r = /([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;
10617
- let i;
10618
- for (; (i = r.exec(e.data)) !== null; ) {
10619
- const a = i[0], s = i.index, n = s + a.length;
10620
- /https?:\/\//.test(a) || /@/.test(a) || /\{\{.*\}\}/.test(a) || /^\d+$/.test(a) || oe(a) || /[a-z][A-Z]/.test(a) || /-/.test(a) || a[0] === a[0].toUpperCase() && a.length > 1 || t.push({
10621
- id: `${a}-${s}`,
10639
+ function he(e) {
10640
+ const t = [], a = /([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;
10641
+ let r;
10642
+ for (; (r = a.exec(e.data)) !== null; ) {
10643
+ const s = r[0], i = r.index, n = i + s.length;
10644
+ /https?:\/\//.test(s) || /@/.test(s) || /\{\{.*\}\}/.test(s) || /^\d+$/.test(s) || ue(s) || /[a-z][A-Z]/.test(s) || /-/.test(s) || s[0] === s[0].toUpperCase() && s.length > 1 || t.push({
10645
+ id: `${s}-${i}`,
10622
10646
  node: e,
10623
- startOffset: s,
10647
+ startOffset: i,
10624
10648
  endOffset: n,
10625
- word: a,
10626
- suggestions: le(a),
10649
+ word: s,
10650
+ suggestions: me(s),
10627
10651
  ignored: !1
10628
10652
  });
10629
10653
  }
10630
10654
  return t;
10631
10655
  }
10632
- const J = () => {
10633
- const e = P();
10656
+ const U = () => {
10657
+ const e = G();
10634
10658
  if (e && document.contains(e))
10635
- return l = e, e;
10659
+ return d = e, e;
10636
10660
  const t = window.getSelection();
10637
10661
  if (t && t.rangeCount > 0) {
10638
- let i = t.getRangeAt(0).startContainer;
10639
- for (; i && i !== document.body; ) {
10640
- if (i.nodeType === Node.ELEMENT_NODE) {
10641
- const a = i;
10642
- if (a.getAttribute("contenteditable") === "true")
10643
- return a;
10662
+ let r = t.getRangeAt(0).startContainer;
10663
+ for (; r && r !== document.body; ) {
10664
+ if (r.nodeType === Node.ELEMENT_NODE) {
10665
+ const s = r;
10666
+ if (s.getAttribute("contenteditable") === "true")
10667
+ return s;
10644
10668
  }
10645
- i = i.parentNode;
10669
+ r = r.parentNode;
10646
10670
  }
10647
10671
  }
10648
- const r = document.activeElement;
10649
- if (r) {
10650
- if (r.getAttribute("contenteditable") === "true")
10651
- return r;
10652
- const i = r.closest('[contenteditable="true"]');
10653
- if (i) return i;
10654
- const a = r.closest("[data-editora-editor]");
10655
- if (a) {
10656
- const s = a.querySelector('[contenteditable="true"]');
10657
- if (s) return s;
10672
+ const a = document.activeElement;
10673
+ if (a) {
10674
+ if (a.getAttribute("contenteditable") === "true")
10675
+ return a;
10676
+ const r = a.closest('[contenteditable="true"]');
10677
+ if (r) return r;
10678
+ const s = a.closest("[data-editora-editor]");
10679
+ if (s) {
10680
+ const i = s.querySelector('[contenteditable="true"]');
10681
+ if (i) return i;
10658
10682
  }
10659
10683
  }
10660
10684
  return document.querySelector('[contenteditable="true"]');
10661
10685
  };
10662
10686
  function T() {
10663
- const e = h();
10687
+ const e = f();
10664
10688
  if (!e) return [];
10665
- const t = [], r = document.createTreeWalker(
10689
+ const t = [], a = document.createTreeWalker(
10666
10690
  e,
10667
10691
  NodeFilter.SHOW_TEXT,
10668
10692
  {
10669
- acceptNode: (a) => {
10670
- var s;
10671
- return !((s = a.textContent) != null && s.trim()) || a.parentNode && ce(a.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
10693
+ acceptNode: (s) => {
10694
+ var i;
10695
+ return !((i = s.textContent) != null && i.trim()) || s.parentNode && ge(s.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
10672
10696
  }
10673
10697
  }
10674
10698
  );
10675
- let i = r.nextNode();
10676
- for (; i; )
10677
- t.push(...de(i)), i = r.nextNode();
10699
+ let r = a.nextNode();
10700
+ for (; r; )
10701
+ t.push(...he(r)), r = a.nextNode();
10678
10702
  return t;
10679
10703
  }
10680
- function g(e) {
10681
- const t = h();
10704
+ function b(e) {
10705
+ const t = f();
10682
10706
  t && (e || (e = T()), L(() => {
10683
- t.querySelectorAll(".rte-misspelled").forEach((i) => {
10684
- const a = i.parentNode;
10685
- if (a) {
10686
- for (; i.firstChild; )
10687
- a.insertBefore(i.firstChild, i);
10688
- a.removeChild(i);
10707
+ t.querySelectorAll(".rte-misspelled").forEach((r) => {
10708
+ const s = r.parentNode;
10709
+ if (s) {
10710
+ for (; r.firstChild; )
10711
+ s.insertBefore(r.firstChild, r);
10712
+ s.removeChild(r);
10689
10713
  }
10690
- }), [...e].sort((i, a) => a.startOffset - i.startOffset).forEach((i) => {
10691
- if (q.has(i.word.toLowerCase())) return;
10692
- const a = i.node.data.length;
10693
- if (!(i.startOffset < 0 || i.endOffset > a || i.startOffset >= i.endOffset))
10714
+ }), [...e].sort((r, s) => s.startOffset - r.startOffset).forEach((r) => {
10715
+ if (E.has(r.word.toLowerCase())) return;
10716
+ const s = r.node.data.length;
10717
+ if (!(r.startOffset < 0 || r.endOffset > s || r.startOffset >= r.endOffset))
10694
10718
  try {
10695
- const s = document.createRange();
10696
- s.setStart(i.node, i.startOffset), s.setEnd(i.node, i.endOffset);
10719
+ const i = document.createRange();
10720
+ i.setStart(r.node, r.startOffset), i.setEnd(r.node, r.endOffset);
10697
10721
  const n = document.createElement("span");
10698
- n.className = "rte-misspelled", n.setAttribute("data-word", i.word), n.setAttribute("data-suggestions", i.suggestions.join(",")), n.setAttribute("title", `Suggestions: ${i.suggestions.join(", ")}`), n.style.borderBottom = "2px wavy red", n.style.cursor = "pointer", s.surroundContents(n);
10699
- } catch (s) {
10722
+ n.className = "rte-misspelled", n.setAttribute("data-word", r.word), n.setAttribute("data-suggestions", r.suggestions.join(",")), n.setAttribute("title", `Suggestions: ${r.suggestions.join(", ")}`), n.style.borderBottom = "2px wavy red", n.style.cursor = "pointer", i.surroundContents(n);
10723
+ } catch (i) {
10700
10724
  }
10701
10725
  });
10702
- }), j(e));
10726
+ }), z(e));
10703
10727
  }
10704
- function E() {
10705
- const e = h();
10728
+ function C() {
10729
+ const e = f();
10706
10730
  e && L(() => {
10707
10731
  e.querySelectorAll(".rte-misspelled").forEach((t) => {
10708
- const r = t.parentNode;
10709
- if (r) {
10732
+ const a = t.parentNode;
10733
+ if (a) {
10710
10734
  for (; t.firstChild; )
10711
- r.insertBefore(t.firstChild, t);
10712
- r.removeChild(t);
10735
+ a.insertBefore(t.firstChild, t);
10736
+ a.removeChild(t);
10713
10737
  }
10714
10738
  });
10715
10739
  });
10716
10740
  }
10717
- function pe(e, t) {
10741
+ function be(e, t) {
10718
10742
  L(() => {
10719
- const r = document.createRange();
10720
- r.setStart(e.node, e.startOffset), r.setEnd(e.node, e.endOffset);
10721
- const i = document.createTextNode(t);
10722
- r.deleteContents(), r.insertNode(i);
10743
+ const a = document.createRange();
10744
+ a.setStart(e.node, e.startOffset), a.setEnd(e.node, e.endOffset);
10745
+ const r = document.createTextNode(t);
10746
+ a.deleteContents(), a.insertNode(r);
10723
10747
  });
10724
10748
  }
10725
- function U(e) {
10726
- q.add(e.toLowerCase()), E(), g();
10727
- }
10728
10749
  function Y(e) {
10729
- z.add(e.toLowerCase()), se(), E(), g();
10750
+ E.add(e.toLowerCase()), C(), b();
10730
10751
  }
10731
- function ue(e) {
10732
- const t = h();
10752
+ function V(e) {
10753
+ q.add(e.toLowerCase()), pe(), C(), b();
10754
+ }
10755
+ function fe(e) {
10756
+ const t = f();
10733
10757
  if (!t) return { total: 0, misspelled: 0, accuracy: 100 };
10734
10758
  e || (e = T());
10735
- const r = e.filter((n) => !q.has(n.word.toLowerCase())).length, s = ((t.textContent || "").match(/[\p{L}\p{M}\p{N}]+/gu) || []).length;
10759
+ const a = e.filter((n) => !E.has(n.word.toLowerCase())).length, i = ((t.textContent || "").match(/[\p{L}\p{M}\p{N}]+/gu) || []).length;
10736
10760
  return {
10737
- total: s,
10738
- misspelled: r,
10739
- accuracy: s > 0 ? (s - r) / s * 100 : 100
10761
+ total: i,
10762
+ misspelled: a,
10763
+ accuracy: i > 0 ? (i - a) / i * 100 : 100
10740
10764
  };
10741
10765
  }
10742
- function me(e, t) {
10743
- const r = document.createTextNode(t);
10744
- e.replaceWith(r);
10766
+ function ye(e, t) {
10767
+ const a = document.createTextNode(t);
10768
+ e.replaceWith(a);
10745
10769
  }
10746
- function ge(e) {
10770
+ function ve(e) {
10747
10771
  e.classList.remove("rte-misspelled"), e.removeAttribute("data-word"), e.removeAttribute("data-suggestions"), e.removeAttribute("title"), e.style.borderBottom = "", e.style.cursor = "";
10748
10772
  }
10749
- function he(e, t, r, i, a) {
10750
- W(a), document.querySelectorAll(".rte-spellcheck-menu").forEach((p) => p.remove());
10751
- const s = document.createElement("div");
10752
- if (s.className = "rte-spellcheck-menu", i.slice(0, 5).forEach((p) => {
10753
- const w = document.createElement("div");
10754
- w.className = "rte-spellcheck-menu-item", w.textContent = p, w.onclick = () => {
10755
- me(a, p), window.setTimeout(() => {
10756
- m && (g(), j());
10757
- }, 0), s.remove();
10758
- }, s.appendChild(w);
10759
- }), i.length > 0) {
10760
- const p = document.createElement("div");
10761
- p.style.cssText = "height: 1px; background: #ddd; margin: 4px 0;", s.appendChild(p);
10773
+ function ke(e, t, a, r, s) {
10774
+ J(s), document.querySelectorAll(".rte-spellcheck-menu").forEach((m) => m.remove());
10775
+ const i = document.createElement("div");
10776
+ if (i.className = "rte-spellcheck-menu", r.slice(0, 5).forEach((m) => {
10777
+ const x = document.createElement("div");
10778
+ x.className = "rte-spellcheck-menu-item", x.textContent = m, x.onclick = () => {
10779
+ ye(s, m), window.setTimeout(() => {
10780
+ h && (b(), z());
10781
+ }, 0), i.remove();
10782
+ }, i.appendChild(x);
10783
+ }), r.length > 0) {
10784
+ const m = document.createElement("div");
10785
+ m.style.cssText = "height: 1px; background: #ddd; margin: 4px 0;", i.appendChild(m);
10762
10786
  }
10763
10787
  const n = document.createElement("div");
10764
10788
  n.className = "rte-spellcheck-menu-item meta", n.textContent = "Ignore Once", n.onclick = () => {
10765
- ge(a), s.remove();
10766
- }, s.appendChild(n);
10767
- const c = document.createElement("div");
10768
- c.className = "rte-spellcheck-menu-item meta", c.textContent = "Ignore All", c.onclick = () => {
10769
- U(r), s.remove();
10770
- }, s.appendChild(c);
10771
- const k = document.createElement("div");
10772
- k.className = "rte-spellcheck-menu-item positive", k.textContent = "Add to Dictionary", k.onclick = () => {
10773
- Y(r), s.remove();
10774
- }, s.appendChild(k), document.body.appendChild(s);
10775
- const A = s.getBoundingClientRect(), Z = window.innerWidth - A.width - 8, G = window.innerHeight - A.height - 8;
10776
- s.style.left = `${Math.max(8, Math.min(e, Z))}px`, s.style.top = `${Math.max(8, Math.min(t, G))}px`;
10777
- const M = (p) => {
10778
- s.contains(p.target) || (s.remove(), document.removeEventListener("mousedown", M));
10789
+ ve(s), i.remove();
10790
+ }, i.appendChild(n);
10791
+ const o = document.createElement("div");
10792
+ o.className = "rte-spellcheck-menu-item meta", o.textContent = "Ignore All", o.onclick = () => {
10793
+ Y(a), i.remove();
10794
+ }, i.appendChild(o);
10795
+ const l = document.createElement("div");
10796
+ l.className = "rte-spellcheck-menu-item positive", l.textContent = "Add to Dictionary", l.onclick = () => {
10797
+ V(a), i.remove();
10798
+ }, i.appendChild(l), document.body.appendChild(i);
10799
+ const p = i.getBoundingClientRect(), Z = window.innerWidth - p.width - 8, K = window.innerHeight - p.height - 8;
10800
+ i.style.left = `${Math.max(8, Math.min(e, Z))}px`, i.style.top = `${Math.max(8, Math.min(t, K))}px`;
10801
+ const O = (m) => {
10802
+ i.contains(m.target) || (i.remove(), document.removeEventListener("mousedown", O));
10779
10803
  };
10780
- setTimeout(() => document.addEventListener("mousedown", M), 0);
10804
+ setTimeout(() => document.addEventListener("mousedown", O), 0);
10781
10805
  }
10782
- function H() {
10783
- x || (v = (e) => {
10806
+ function _() {
10807
+ j || (w = (e) => {
10784
10808
  const t = e.target;
10785
10809
  if (t && t.classList.contains("rte-misspelled")) {
10786
- e.preventDefault(), W(t);
10787
- const r = t.getAttribute("data-word"), i = (t.getAttribute("data-suggestions") || "").split(",").filter((a) => a);
10788
- he(e.clientX, e.clientY, r, i, t);
10810
+ e.preventDefault(), J(t);
10811
+ const a = t.getAttribute("data-word"), r = (t.getAttribute("data-suggestions") || "").split(",").filter((s) => s);
10812
+ ke(e.clientX, e.clientY, a, r, t);
10789
10813
  }
10790
- }, document.addEventListener("contextmenu", v), x = !0);
10814
+ }, document.addEventListener("contextmenu", w), j = !0);
10791
10815
  }
10792
- function be() {
10793
- !x || !v || (document.removeEventListener("contextmenu", v), v = null, x = !1);
10816
+ function we() {
10817
+ !j || !w || (document.removeEventListener("contextmenu", w), w = null, j = !1);
10794
10818
  }
10795
- function fe(e) {
10819
+ function xe(e) {
10796
10820
  return e.closest("[data-editora-editor]") || e.parentElement || e;
10797
10821
  }
10798
- function I() {
10799
- const e = h();
10822
+ function R() {
10823
+ const e = f();
10800
10824
  if (!e)
10801
10825
  throw new Error("Spell check panel requested without active editor");
10802
- const t = fe(e);
10803
- C();
10804
- const r = document.createElement("div");
10805
- return r.className = "rte-spell-check-panel", window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t.appendChild(r), r;
10826
+ const t = xe(e);
10827
+ S();
10828
+ const a = document.createElement("div");
10829
+ return a.className = "rte-spell-check-panel", a.setAttribute("role", "complementary"), a.setAttribute("aria-label", "Spell check"), window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t.appendChild(a), a;
10806
10830
  }
10807
- function j(e) {
10808
- if (!o) return;
10809
- const t = e || T(), r = ue(t);
10810
- o.innerHTML = `
10831
+ function z(e) {
10832
+ if (!c) return;
10833
+ const t = e || T(), a = fe(t), r = c;
10834
+ Q(r, () => {
10835
+ r.innerHTML = `
10811
10836
  <div class="rte-spellcheck-header">
10812
10837
  <div>
10813
10838
  <h3 class="rte-spellcheck-title">Spell Check</h3>
@@ -10819,28 +10844,28 @@ function j(e) {
10819
10844
  <div class="rte-spellcheck-stats">
10820
10845
  <div class="rte-spellcheck-stat">
10821
10846
  <span class="rte-spellcheck-stat-label">Total</span>
10822
- <strong class="rte-spellcheck-stat-value">${r.total}</strong>
10847
+ <strong class="rte-spellcheck-stat-value">${a.total}</strong>
10823
10848
  </div>
10824
10849
  <div class="rte-spellcheck-stat">
10825
10850
  <span class="rte-spellcheck-stat-label">Misspelled</span>
10826
- <strong class="rte-spellcheck-stat-value">${r.misspelled}</strong>
10851
+ <strong class="rte-spellcheck-stat-value">${a.misspelled}</strong>
10827
10852
  </div>
10828
10853
  <div class="rte-spellcheck-stat">
10829
10854
  <span class="rte-spellcheck-stat-label">Accuracy</span>
10830
- <strong class="rte-spellcheck-stat-value">${r.accuracy.toFixed(1)}%</strong>
10855
+ <strong class="rte-spellcheck-stat-value">${a.accuracy.toFixed(1)}%</strong>
10831
10856
  </div>
10832
10857
  </div>
10833
10858
 
10834
10859
  <div class="rte-spellcheck-list">
10835
- ${t.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : t.map((a, s) => `
10836
- <div class="rte-spellcheck-item" data-word="${a.word}" data-index="${s}">
10860
+ ${t.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : t.map((i, n) => `
10861
+ <div class="rte-spellcheck-item" data-word="${i.word}" data-index="${n}">
10837
10862
  <button class="rte-spellcheck-word-header" type="button">
10838
- <span class="rte-spellcheck-word">${a.word}</span>
10863
+ <span class="rte-spellcheck-word">${i.word}</span>
10839
10864
  <span class="rte-spellcheck-caret">▶</span>
10840
10865
  </button>
10841
10866
  <div class="rte-spellcheck-suggestions">
10842
- ${a.suggestions.length > 0 ? `<div class="rte-spellcheck-actions">
10843
- ${a.suggestions.map((n) => `<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${n}" type="button">${n}</button>`).join("")}
10867
+ ${i.suggestions.length > 0 ? `<div class="rte-spellcheck-actions">
10868
+ ${i.suggestions.map((o) => `<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${o}" type="button">${o}</button>`).join("")}
10844
10869
  </div>` : '<div class="rte-spellcheck-subtitle">No suggestions available</div>'}
10845
10870
  <div class="rte-spellcheck-actions">
10846
10871
  <button class="rte-spellcheck-btn ignore-btn" type="button">Ignore</button>
@@ -10851,68 +10876,80 @@ function j(e) {
10851
10876
  `).join("")}
10852
10877
  </div>
10853
10878
  `;
10854
- const i = o.querySelector(".rte-spellcheck-close");
10855
- i == null || i.addEventListener("click", (a) => {
10856
- a.preventDefault(), a.stopPropagation(), N();
10857
- }), o.querySelectorAll(".rte-spellcheck-word-header").forEach((a) => {
10858
- a.addEventListener("click", () => {
10859
- const s = a.closest(".rte-spellcheck-item"), n = s == null ? void 0 : s.querySelector(".rte-spellcheck-suggestions"), c = a.querySelector(".rte-spellcheck-caret");
10860
- n && c && (n.classList.contains("show") ? (n.classList.remove("show"), c.textContent = "▶") : (n.classList.add("show"), c.textContent = "▼"));
10879
+ });
10880
+ const s = c.querySelector(".rte-spellcheck-close");
10881
+ s == null || s.addEventListener("click", (i) => {
10882
+ i.preventDefault(), i.stopPropagation(), M(!0);
10883
+ }), c.querySelectorAll(".rte-spellcheck-word-header").forEach((i) => {
10884
+ i.addEventListener("click", () => {
10885
+ const n = i.closest(".rte-spellcheck-item"), o = n == null ? void 0 : n.querySelector(".rte-spellcheck-suggestions"), l = i.querySelector(".rte-spellcheck-caret");
10886
+ o && l && (o.classList.contains("show") ? (o.classList.remove("show"), l.textContent = "▶") : (o.classList.add("show"), l.textContent = "▼"));
10861
10887
  });
10862
- }), o.querySelectorAll(".suggestion-btn").forEach((a) => {
10863
- a.addEventListener("click", () => {
10864
- const s = a.getAttribute("data-suggestion"), n = a.closest(".rte-spellcheck-item"), c = parseInt((n == null ? void 0 : n.getAttribute("data-index")) || "0", 10);
10865
- s !== null && t[c] && (pe(t[c], s), g());
10888
+ }), c.querySelectorAll(".suggestion-btn").forEach((i) => {
10889
+ i.addEventListener("click", () => {
10890
+ const n = i.getAttribute("data-suggestion"), o = i.closest(".rte-spellcheck-item"), l = parseInt((o == null ? void 0 : o.getAttribute("data-index")) || "0", 10);
10891
+ n !== null && t[l] && (be(t[l], n), b());
10866
10892
  });
10867
- }), o.querySelectorAll(".ignore-btn").forEach((a) => {
10868
- a.addEventListener("click", () => {
10869
- var n;
10870
- const s = (n = a.closest(".rte-spellcheck-item")) == null ? void 0 : n.getAttribute("data-word");
10871
- s && U(s);
10893
+ }), c.querySelectorAll(".ignore-btn").forEach((i) => {
10894
+ i.addEventListener("click", () => {
10895
+ var o;
10896
+ const n = (o = i.closest(".rte-spellcheck-item")) == null ? void 0 : o.getAttribute("data-word");
10897
+ n && Y(n);
10872
10898
  });
10873
- }), o.querySelectorAll(".add-btn").forEach((a) => {
10874
- a.addEventListener("click", () => {
10875
- var n;
10876
- const s = (n = a.closest(".rte-spellcheck-item")) == null ? void 0 : n.getAttribute("data-word");
10877
- s && Y(s);
10899
+ }), c.querySelectorAll(".add-btn").forEach((i) => {
10900
+ i.addEventListener("click", () => {
10901
+ var o;
10902
+ const n = (o = i.closest(".rte-spellcheck-item")) == null ? void 0 : o.getAttribute("data-word");
10903
+ n && V(n);
10878
10904
  });
10879
10905
  });
10880
10906
  }
10881
- function _() {
10882
- const e = h();
10883
- e && (d && d.disconnect(), d = new MutationObserver((t) => {
10884
- f > 0 || t.some((r) => r.type === "characterData" || r.type === "childList") && (b && clearTimeout(b), b = window.setTimeout(() => {
10885
- m && g();
10907
+ function $() {
10908
+ const e = f();
10909
+ e && (u && u.disconnect(), u = new MutationObserver((t) => {
10910
+ v > 0 || t.some((a) => a.type === "characterData" || a.type === "childList") && (y && clearTimeout(y), y = window.setTimeout(() => {
10911
+ h && b();
10886
10912
  }, 350));
10887
- }), d.observe(e, {
10888
- ...B
10913
+ }), u.observe(e, {
10914
+ ...W
10889
10915
  }));
10890
10916
  }
10891
- function V() {
10892
- d && (d.disconnect(), d = null), b && (clearTimeout(b), b = null);
10893
- }
10894
10917
  function X() {
10918
+ u && (u.disconnect(), u = null), y && (clearTimeout(y), y = null);
10919
+ }
10920
+ function N() {
10895
10921
  document.querySelectorAll(".rte-spellcheck-menu").forEach((e) => e.remove());
10896
10922
  }
10897
- function R() {
10898
- y || (y = (e) => {
10899
- e.key !== "Escape" || !m || (e.preventDefault(), e.stopPropagation(), N());
10900
- }, document.addEventListener("keydown", y, !0));
10923
+ function B() {
10924
+ k || (k = (e) => {
10925
+ if (e.key !== "Escape" || !h) return;
10926
+ const t = e.target;
10927
+ if (t && (c != null && c.contains(t) || d != null && d.contains(t))) {
10928
+ if (e.preventDefault(), e.stopPropagation(), document.querySelector(".rte-spellcheck-menu")) {
10929
+ N();
10930
+ return;
10931
+ }
10932
+ M();
10933
+ }
10934
+ }, document.addEventListener("keydown", k, !0));
10901
10935
  }
10902
- function ye() {
10903
- y && (document.removeEventListener("keydown", y, !0), y = null);
10936
+ function je() {
10937
+ k && (document.removeEventListener("keydown", k, !0), k = null);
10904
10938
  }
10905
- function N() {
10906
- return m && (E(), V(), be(), X(), o && (o.remove(), o = null), l = null, u = null, m = !1, ye()), !1;
10939
+ function M(e = !1) {
10940
+ if (!h) return !1;
10941
+ C(), X(), we(), N();
10942
+ const t = e || ee(c) ? d : null;
10943
+ return c && (c.remove(), c = null), d = null, g = null, h = !1, je(), t == null || t.focus({ preventScroll: !0 }), !1;
10907
10944
  }
10908
- function ve() {
10909
- const e = te();
10910
- return e ? m && l && l !== e ? (E(), V(), X(), o && (o.remove(), o = null), l = e, C(), H(), R(), g(), _(), o = I(), j(), !0) : m ? N() : (l = e, m = !0, C(), H(), R(), g(), _(), o && (o.remove(), o = null), o = I(), j(), !0) : !1;
10945
+ function ze() {
10946
+ const e = oe();
10947
+ return e ? h && d && d !== e ? (C(), X(), N(), c && (c.remove(), c = null), d = e, S(), _(), B(), b(), $(), c = R(), z(), D(c), !0) : h ? M() : (d = e, h = !0, S(), _(), B(), b(), $(), c && (c.remove(), c = null), c = R(), z(), D(c), !0) : !1;
10911
10948
  }
10912
- const ke = () => ({
10949
+ const Ee = () => ({
10913
10950
  name: "spellCheck",
10914
10951
  init: () => {
10915
- re(), ee();
10952
+ de(), ne();
10916
10953
  },
10917
10954
  toolbar: [
10918
10955
  {
@@ -10923,13 +10960,13 @@ const ke = () => ({
10923
10960
  }
10924
10961
  ],
10925
10962
  commands: {
10926
- toggleSpellCheck: (e, t) => (Q(t), ve(), !0)
10963
+ toggleSpellCheck: (e, t) => (se(t), ze(), !0)
10927
10964
  },
10928
10965
  keymap: {
10929
10966
  F7: "toggleSpellCheck"
10930
10967
  }
10931
10968
  });
10932
10969
  export {
10933
- ke as SpellCheckPlugin
10970
+ Ee as SpellCheckPlugin
10934
10971
  };
10935
- //# sourceMappingURL=SpellCheckPlugin.native-BGm2qPfn.mjs.map
10972
+ //# sourceMappingURL=SpellCheckPlugin.native-BE7os1Xj.mjs.map