@editora/core 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
  3. package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
  4. package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
  5. package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
  6. package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
  7. package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
  8. package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
  9. package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
  10. package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
  11. package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
  12. package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
  13. package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
  14. package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
  15. package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
  16. package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
  17. package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
  18. package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
  19. package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
  20. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
  21. package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
  22. package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
  23. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
  24. package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
  25. package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
  26. package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
  27. package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
  28. package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
  29. package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
  30. package/dist/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
  31. package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
  32. package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
  33. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  34. package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
  35. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  36. package/dist/editora.min.js +13 -13
  37. package/dist/editora.umd.js +13 -13
  38. package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
  39. package/dist/index-BslAFzmv.mjs +16544 -0
  40. package/dist/index-D1LOqg5C.js +10 -0
  41. package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
  42. package/dist/index.cjs.js +1 -1
  43. package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
  44. package/dist/index.esm.js +2 -2
  45. package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
  46. package/dist/plugin-loader.js +77 -40
  47. package/dist/webcomponent-core.js +456 -346
  48. package/dist/webcomponent-core.min.css +1 -1
  49. package/dist/webcomponent-core.min.js +87 -107
  50. package/dist/webcomponent.cjs.js +1 -1
  51. package/dist/webcomponent.esm.js +1 -1
  52. package/dist/webcomponent.js +503 -356
  53. package/dist/webcomponent.min.css +1 -1
  54. package/dist/webcomponent.min.js +6003 -658
  55. package/package.json +2 -2
  56. package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
  57. package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
  58. package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
  59. package/dist/documentManager-irzj9n3V.mjs +0 -37627
  60. package/dist/index-CqWQFb3D.js +0 -10
@@ -1,4 +1,4 @@
1
- const H = /* @__PURE__ */ new Set([
1
+ const j = /* @__PURE__ */ new Set([
2
2
  "the",
3
3
  "a",
4
4
  "an",
@@ -109,32 +109,44 @@ const H = /* @__PURE__ */ new Set([
109
109
  "demo",
110
110
  "lorem",
111
111
  "ipsum"
112
- ]), E = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set();
113
- let u = !1, d = null, f = null, a = null, s = null, g = null, v = !1, h = null, O = !1, b = 0;
114
- const $ = {
112
+ ]), C = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set();
113
+ let u = !1, d = null, f = null, a = null, s = null, x = null, y = !1, h = null, _ = !1, b = 0, g = null;
114
+ const B = {
115
115
  characterData: !0,
116
116
  childList: !0,
117
117
  subtree: !0
118
- }, D = "rte-spellcheck-styles", F = "__editoraCommandEditorRoot";
119
- function q() {
118
+ }, H = "rte-spellcheck-styles", R = "__editoraCommandEditorRoot";
119
+ function K(e) {
120
+ var l;
121
+ const t = (e == null ? void 0 : e.contentElement) || (e == null ? void 0 : e.editorElement) || null;
122
+ if (!(t instanceof HTMLElement)) return;
123
+ const r = t.getAttribute("contenteditable") === "true" ? t : (l = t.querySelector) == null ? void 0 : l.call(t, '[contenteditable="true"]');
124
+ if (r instanceof HTMLElement) {
125
+ s = r, h = r;
126
+ return;
127
+ }
128
+ const n = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null), o = A(n);
129
+ o && (s = o, h = o);
130
+ }
131
+ function P() {
120
132
  if (typeof window == "undefined") return null;
121
- const e = window[F];
133
+ const e = window[R];
122
134
  if (!(e instanceof HTMLElement)) return null;
123
- window[F] = null;
124
- const r = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
125
- if (r) {
126
- const c = j(r);
127
- if (c) return c;
128
- if (r.getAttribute("contenteditable") === "true") return r;
135
+ window[R] = null;
136
+ 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);
137
+ if (t) {
138
+ const n = A(t);
139
+ if (n) return n;
140
+ if (t.getAttribute("contenteditable") === "true") return t;
129
141
  }
130
142
  if (e.getAttribute("contenteditable") === "true")
131
143
  return e;
132
- const t = e.closest('[contenteditable="true"]');
133
- return t instanceof HTMLElement ? t : null;
144
+ const r = e.closest('[contenteditable="true"]');
145
+ return r instanceof HTMLElement ? r : null;
134
146
  }
135
147
  function T() {
136
- let e = document.getElementById(D);
137
- e || (e = document.createElement("style"), e.id = D, document.head.appendChild(e)), e.textContent = `
148
+ let e = document.getElementById(H);
149
+ e || (e = document.createElement("style"), e.id = H, document.head.appendChild(e)), e.textContent = `
138
150
  .rte-spell-check-panel {
139
151
  position: absolute;
140
152
  top: 12px;
@@ -607,143 +619,143 @@ function T() {
607
619
  function k() {
608
620
  if (s && document.contains(s))
609
621
  return s;
610
- const e = B();
622
+ const e = V();
611
623
  return e && (s = e), e;
612
624
  }
613
- function z(e) {
625
+ function W(e) {
614
626
  if (!e) return;
615
- const r = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, t = r == null ? void 0 : r.closest('[contenteditable="true"]');
616
- t && (s = t);
627
+ const t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, r = t == null ? void 0 : t.closest('[contenteditable="true"]');
628
+ r && (s = r);
617
629
  }
618
- function j(e) {
630
+ function A(e) {
619
631
  if (!e) return null;
620
- const r = e.querySelector('[contenteditable="true"]');
621
- return r instanceof HTMLElement ? r : null;
632
+ const t = e.querySelector('[contenteditable="true"]');
633
+ return t instanceof HTMLElement ? t : null;
622
634
  }
623
- function X() {
624
- if (O) return;
625
- const e = (r) => {
626
- const t = r.target;
627
- if (!t) return;
628
- const c = t.closest(
635
+ function Q() {
636
+ if (_) return;
637
+ const e = (t) => {
638
+ const r = t.target;
639
+ if (!r) return;
640
+ const n = r.closest(
629
641
  '.editora-toolbar-button[data-command="toggleSpellCheck"], .rte-toolbar-button[data-command="toggleSpellCheck"]'
630
642
  );
631
- if (!c) return;
632
- const o = c.closest("[data-editora-editor]"), l = j(o);
643
+ if (!n) return;
644
+ const o = n.closest("[data-editora-editor]"), l = A(o);
633
645
  l && (h = l, s = l);
634
646
  };
635
- document.addEventListener("pointerdown", e, !0), O = !0;
647
+ document.addEventListener("pointerdown", e, !0), _ = !0;
636
648
  }
637
- function Z() {
638
- const e = q();
649
+ function ee() {
650
+ const e = P();
639
651
  if (e && document.contains(e))
640
652
  return s = e, h = null, e;
641
653
  if (h && document.contains(h)) {
642
- const r = h;
643
- return h = null, s = r, r;
654
+ const t = h;
655
+ return h = null, s = t, t;
644
656
  }
645
- return B();
657
+ return V();
646
658
  }
647
- function K() {
659
+ function te() {
648
660
  b += 1, b === 1 && d && d.disconnect();
649
661
  }
650
- function Q() {
662
+ function re() {
651
663
  if (b === 0 || (b -= 1, b > 0) || !d) return;
652
664
  const e = k();
653
- e && d.observe(e, $);
665
+ e && d.observe(e, B);
654
666
  }
655
- function L(e) {
656
- K();
667
+ function N(e) {
668
+ te();
657
669
  try {
658
670
  return e();
659
671
  } finally {
660
- Q();
672
+ re();
661
673
  }
662
674
  }
663
- const ee = () => {
675
+ const oe = () => {
664
676
  try {
665
677
  const e = localStorage.getItem("rte-custom-dictionary");
666
- e && JSON.parse(e).forEach((t) => E.add(t.toLowerCase()));
678
+ e && JSON.parse(e).forEach((r) => C.add(r.toLowerCase()));
667
679
  } catch (e) {
668
680
  console.warn("Failed to load custom dictionary:", e);
669
681
  }
670
- }, te = () => {
682
+ }, le = () => {
671
683
  try {
672
- const e = Array.from(E);
684
+ const e = Array.from(C);
673
685
  localStorage.setItem("rte-custom-dictionary", JSON.stringify(e));
674
686
  } catch (e) {
675
687
  console.warn("Failed to save custom dictionary:", e);
676
688
  }
677
689
  };
678
- function re(e, r) {
679
- const t = [];
680
- for (let c = 0; c <= r.length; c++) t[c] = [c];
681
- for (let c = 0; c <= e.length; c++) t[0][c] = c;
682
- for (let c = 1; c <= r.length; c++)
690
+ function ne(e, t) {
691
+ const r = [];
692
+ for (let n = 0; n <= t.length; n++) r[n] = [n];
693
+ for (let n = 0; n <= e.length; n++) r[0][n] = n;
694
+ for (let n = 1; n <= t.length; n++)
683
695
  for (let o = 1; o <= e.length; o++)
684
- r.charAt(c - 1) === e.charAt(o - 1) ? t[c][o] = t[c - 1][o - 1] : t[c][o] = Math.min(
685
- t[c - 1][o - 1] + 1,
696
+ t.charAt(n - 1) === e.charAt(o - 1) ? r[n][o] = r[n - 1][o - 1] : r[n][o] = Math.min(
697
+ r[n - 1][o - 1] + 1,
686
698
  // substitution
687
- t[c][o - 1] + 1,
699
+ r[n][o - 1] + 1,
688
700
  // insertion
689
- t[c - 1][o] + 1
701
+ r[n - 1][o] + 1
690
702
  // deletion
691
703
  );
692
- return t[r.length][e.length];
704
+ return r[t.length][e.length];
693
705
  }
694
- function oe(e) {
695
- const r = e.toLowerCase();
696
- return H.has(r) || E.has(r) || C.has(r);
706
+ function ce(e) {
707
+ const t = e.toLowerCase();
708
+ return j.has(t) || C.has(t) || S.has(t);
697
709
  }
698
- function le(e, r = 5) {
699
- const t = e.toLowerCase(), o = Array.from(H).map((l) => ({ word: l, distance: re(t, l) }));
700
- return o.sort((l, n) => l.distance - n.distance), o.filter((l) => l.distance <= 3).slice(0, r).map((l) => l.word);
710
+ function ae(e, t = 5) {
711
+ const r = e.toLowerCase(), o = Array.from(j).map((l) => ({ word: l, distance: ne(r, l) }));
712
+ return o.sort((l, c) => l.distance - c.distance), o.filter((l) => l.distance <= 3).slice(0, t).map((l) => l.word);
701
713
  }
702
- function ce(e) {
714
+ function se(e) {
703
715
  if (e.nodeType !== Node.ELEMENT_NODE) return !1;
704
- const r = e;
705
- return !!(r.closest('code, pre, [contenteditable="false"], .rte-widget, .rte-template, .rte-comment, .rte-merge-tag') || r.hasAttribute("data-comment-id") || r.hasAttribute("data-template") || r.hasAttribute("data-merge-tag"));
706
- }
707
- function ne(e) {
708
- const r = [], t = /([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;
709
- let c;
710
- for (; (c = t.exec(e.data)) !== null; ) {
711
- const o = c[0], l = c.index, n = l + o.length;
712
- /https?:\/\//.test(o) || /@/.test(o) || /\{\{.*\}\}/.test(o) || /^\d+$/.test(o) || oe(o) || /[a-z][A-Z]/.test(o) || /-/.test(o) || o[0] === o[0].toUpperCase() && o.length > 1 || r.push({
716
+ const t = e;
717
+ 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"));
718
+ }
719
+ function ie(e) {
720
+ const t = [], r = /([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;
721
+ let n;
722
+ for (; (n = r.exec(e.data)) !== null; ) {
723
+ const o = n[0], l = n.index, c = l + o.length;
724
+ /https?:\/\//.test(o) || /@/.test(o) || /\{\{.*\}\}/.test(o) || /^\d+$/.test(o) || ce(o) || /[a-z][A-Z]/.test(o) || /-/.test(o) || o[0] === o[0].toUpperCase() && o.length > 1 || t.push({
713
725
  id: `${o}-${l}`,
714
726
  node: e,
715
727
  startOffset: l,
716
- endOffset: n,
728
+ endOffset: c,
717
729
  word: o,
718
- suggestions: le(o),
730
+ suggestions: ae(o),
719
731
  ignored: !1
720
732
  });
721
733
  }
722
- return r;
734
+ return t;
723
735
  }
724
- const B = () => {
725
- const e = q();
736
+ const V = () => {
737
+ const e = P();
726
738
  if (e && document.contains(e))
727
739
  return s = e, e;
728
- const r = window.getSelection();
729
- if (r && r.rangeCount > 0) {
730
- let c = r.getRangeAt(0).startContainer;
731
- for (; c && c !== document.body; ) {
732
- if (c.nodeType === Node.ELEMENT_NODE) {
733
- const o = c;
740
+ const t = window.getSelection();
741
+ if (t && t.rangeCount > 0) {
742
+ let n = t.getRangeAt(0).startContainer;
743
+ for (; n && n !== document.body; ) {
744
+ if (n.nodeType === Node.ELEMENT_NODE) {
745
+ const o = n;
734
746
  if (o.getAttribute("contenteditable") === "true")
735
747
  return o;
736
748
  }
737
- c = c.parentNode;
749
+ n = n.parentNode;
738
750
  }
739
751
  }
740
- const t = document.activeElement;
741
- if (t) {
742
- if (t.getAttribute("contenteditable") === "true")
743
- return t;
744
- const c = t.closest('[contenteditable="true"]');
745
- if (c) return c;
746
- const o = t.closest("[data-editora-editor]");
752
+ const r = document.activeElement;
753
+ if (r) {
754
+ if (r.getAttribute("contenteditable") === "true")
755
+ return r;
756
+ const n = r.closest('[contenteditable="true"]');
757
+ if (n) return n;
758
+ const o = r.closest("[data-editora-editor]");
747
759
  if (o) {
748
760
  const l = o.querySelector('[contenteditable="true"]');
749
761
  if (l) return l;
@@ -751,154 +763,154 @@ const B = () => {
751
763
  }
752
764
  return document.querySelector('[contenteditable="true"]');
753
765
  };
754
- function N() {
766
+ function M() {
755
767
  const e = k();
756
768
  if (!e) return [];
757
- const r = [], t = document.createTreeWalker(
769
+ const t = [], r = document.createTreeWalker(
758
770
  e,
759
771
  NodeFilter.SHOW_TEXT,
760
772
  {
761
773
  acceptNode: (o) => {
762
774
  var l;
763
- return !((l = o.textContent) != null && l.trim()) || o.parentNode && ce(o.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
775
+ return !((l = o.textContent) != null && l.trim()) || o.parentNode && se(o.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
764
776
  }
765
777
  }
766
778
  );
767
- let c = t.nextNode();
768
- for (; c; )
769
- r.push(...ne(c)), c = t.nextNode();
770
- return r;
779
+ let n = r.nextNode();
780
+ for (; n; )
781
+ t.push(...ie(n)), n = r.nextNode();
782
+ return t;
771
783
  }
772
784
  function m(e) {
773
- const r = k();
774
- r && (e || (e = N()), L(() => {
775
- r.querySelectorAll(".rte-misspelled").forEach((t) => {
776
- const c = t.parentNode;
777
- if (c) {
778
- for (; t.firstChild; )
779
- c.insertBefore(t.firstChild, t);
780
- c.removeChild(t);
785
+ const t = k();
786
+ t && (e || (e = M()), N(() => {
787
+ t.querySelectorAll(".rte-misspelled").forEach((r) => {
788
+ const n = r.parentNode;
789
+ if (n) {
790
+ for (; r.firstChild; )
791
+ n.insertBefore(r.firstChild, r);
792
+ n.removeChild(r);
781
793
  }
782
- }), e.forEach((t) => {
783
- if (C.has(t.word.toLowerCase())) return;
784
- const c = t.node.data.length;
785
- if (!(t.startOffset < 0 || t.endOffset > c || t.startOffset >= t.endOffset))
794
+ }), e.forEach((r) => {
795
+ if (S.has(r.word.toLowerCase())) return;
796
+ const n = r.node.data.length;
797
+ if (!(r.startOffset < 0 || r.endOffset > n || r.startOffset >= r.endOffset))
786
798
  try {
787
799
  const o = document.createRange();
788
- o.setStart(t.node, t.startOffset), o.setEnd(t.node, t.endOffset);
800
+ o.setStart(r.node, r.startOffset), o.setEnd(r.node, r.endOffset);
789
801
  const l = document.createElement("span");
790
- l.className = "rte-misspelled", l.setAttribute("data-word", t.word), l.setAttribute("data-suggestions", t.suggestions.join(",")), l.setAttribute("title", `Suggestions: ${t.suggestions.join(", ")}`), l.style.borderBottom = "2px wavy red", l.style.cursor = "pointer", o.surroundContents(l);
802
+ l.className = "rte-misspelled", l.setAttribute("data-word", r.word), l.setAttribute("data-suggestions", r.suggestions.join(",")), l.setAttribute("title", `Suggestions: ${r.suggestions.join(", ")}`), l.style.borderBottom = "2px wavy red", l.style.cursor = "pointer", o.surroundContents(l);
791
803
  } catch (o) {
792
804
  }
793
805
  });
794
- }), y(e));
806
+ }), E(e));
795
807
  }
796
- function S() {
808
+ function L() {
797
809
  const e = k();
798
- e && L(() => {
799
- e.querySelectorAll(".rte-misspelled").forEach((r) => {
800
- const t = r.parentNode;
801
- if (t) {
802
- for (; r.firstChild; )
803
- t.insertBefore(r.firstChild, r);
804
- t.removeChild(r);
810
+ e && N(() => {
811
+ e.querySelectorAll(".rte-misspelled").forEach((t) => {
812
+ const r = t.parentNode;
813
+ if (r) {
814
+ for (; t.firstChild; )
815
+ r.insertBefore(t.firstChild, t);
816
+ r.removeChild(t);
805
817
  }
806
818
  });
807
819
  });
808
820
  }
809
- function ae(e, r) {
810
- L(() => {
811
- const t = document.createRange();
812
- t.setStart(e.node, e.startOffset), t.setEnd(e.node, e.endOffset);
813
- const c = document.createTextNode(r);
814
- t.deleteContents(), t.insertNode(c);
821
+ function de(e, t) {
822
+ N(() => {
823
+ const r = document.createRange();
824
+ r.setStart(e.node, e.startOffset), r.setEnd(e.node, e.endOffset);
825
+ const n = document.createTextNode(t);
826
+ r.deleteContents(), r.insertNode(n);
815
827
  });
816
828
  }
817
- function P(e) {
818
- C.add(e.toLowerCase()), S(), m();
829
+ function G(e) {
830
+ S.add(e.toLowerCase()), L(), m();
819
831
  }
820
- function W(e) {
821
- E.add(e.toLowerCase()), te(), S(), m();
832
+ function J(e) {
833
+ C.add(e.toLowerCase()), le(), L(), m();
822
834
  }
823
- function se(e) {
824
- const r = k();
825
- if (!r) return { total: 0, misspelled: 0, accuracy: 100 };
826
- e || (e = N());
827
- const t = e.filter((n) => !C.has(n.word.toLowerCase())).length, l = ((r.textContent || "").match(/[\p{L}\p{M}\p{N}]+/gu) || []).length;
835
+ function pe(e) {
836
+ const t = k();
837
+ if (!t) return { total: 0, misspelled: 0, accuracy: 100 };
838
+ e || (e = M());
839
+ const r = e.filter((c) => !S.has(c.word.toLowerCase())).length, l = ((t.textContent || "").match(/[\p{L}\p{M}\p{N}]+/gu) || []).length;
828
840
  return {
829
841
  total: l,
830
- misspelled: t,
831
- accuracy: l > 0 ? (l - t) / l * 100 : 100
842
+ misspelled: r,
843
+ accuracy: l > 0 ? (l - r) / l * 100 : 100
832
844
  };
833
845
  }
834
- function ie(e, r) {
835
- const t = document.createTextNode(r);
836
- e.replaceWith(t);
846
+ function he(e, t) {
847
+ const r = document.createTextNode(t);
848
+ e.replaceWith(r);
837
849
  }
838
- function de(e) {
850
+ function ue(e) {
839
851
  e.classList.remove("rte-misspelled"), e.removeAttribute("data-word"), e.removeAttribute("data-suggestions"), e.removeAttribute("title"), e.style.borderBottom = "", e.style.cursor = "";
840
852
  }
841
- function pe(e, r, t, c, o) {
842
- z(o), document.querySelectorAll(".rte-spellcheck-menu").forEach((p) => p.remove());
853
+ function me(e, t, r, n, o) {
854
+ W(o), document.querySelectorAll(".rte-spellcheck-menu").forEach((p) => p.remove());
843
855
  const l = document.createElement("div");
844
- if (l.className = "rte-spellcheck-menu", c.slice(0, 5).forEach((p) => {
845
- const w = document.createElement("div");
846
- w.className = "rte-spellcheck-menu-item", w.textContent = p, w.onclick = () => {
847
- ie(o, p), window.setTimeout(() => {
848
- u && (m(), y());
856
+ if (l.className = "rte-spellcheck-menu", n.slice(0, 5).forEach((p) => {
857
+ const v = document.createElement("div");
858
+ v.className = "rte-spellcheck-menu-item", v.textContent = p, v.onclick = () => {
859
+ he(o, p), window.setTimeout(() => {
860
+ u && (m(), E());
849
861
  }, 0), l.remove();
850
- }, l.appendChild(w);
851
- }), c.length > 0) {
862
+ }, l.appendChild(v);
863
+ }), n.length > 0) {
852
864
  const p = document.createElement("div");
853
865
  p.style.cssText = "height: 1px; background: #ddd; margin: 4px 0;", l.appendChild(p);
854
866
  }
855
- const n = document.createElement("div");
856
- n.className = "rte-spellcheck-menu-item meta", n.textContent = "Ignore Once", n.onclick = () => {
857
- de(o), l.remove();
858
- }, l.appendChild(n);
867
+ const c = document.createElement("div");
868
+ c.className = "rte-spellcheck-menu-item meta", c.textContent = "Ignore Once", c.onclick = () => {
869
+ ue(o), l.remove();
870
+ }, l.appendChild(c);
859
871
  const i = document.createElement("div");
860
872
  i.className = "rte-spellcheck-menu-item meta", i.textContent = "Ignore All", i.onclick = () => {
861
- P(t), l.remove();
873
+ G(r), l.remove();
862
874
  }, l.appendChild(i);
863
- const x = document.createElement("div");
864
- x.className = "rte-spellcheck-menu-item positive", x.textContent = "Add to Dictionary", x.onclick = () => {
865
- W(t), l.remove();
866
- }, l.appendChild(x), document.body.appendChild(l);
867
- const A = l.getBoundingClientRect(), U = window.innerWidth - A.width - 8, Y = window.innerHeight - A.height - 8;
868
- l.style.left = `${Math.max(8, Math.min(e, U))}px`, l.style.top = `${Math.max(8, Math.min(r, Y))}px`;
869
- const M = (p) => {
870
- l.contains(p.target) || (l.remove(), document.removeEventListener("mousedown", M));
875
+ const w = document.createElement("div");
876
+ w.className = "rte-spellcheck-menu-item positive", w.textContent = "Add to Dictionary", w.onclick = () => {
877
+ J(r), l.remove();
878
+ }, l.appendChild(w), document.body.appendChild(l);
879
+ const D = l.getBoundingClientRect(), X = window.innerWidth - D.width - 8, Z = window.innerHeight - D.height - 8;
880
+ l.style.left = `${Math.max(8, Math.min(e, X))}px`, l.style.top = `${Math.max(8, Math.min(t, Z))}px`;
881
+ const F = (p) => {
882
+ l.contains(p.target) || (l.remove(), document.removeEventListener("mousedown", F));
871
883
  };
872
- setTimeout(() => document.addEventListener("mousedown", M), 0);
884
+ setTimeout(() => document.addEventListener("mousedown", F), 0);
873
885
  }
874
- function _() {
875
- v || (g = (e) => {
876
- const r = e.target;
877
- if (r && r.classList.contains("rte-misspelled")) {
878
- e.preventDefault(), z(r);
879
- const t = r.getAttribute("data-word"), c = (r.getAttribute("data-suggestions") || "").split(",").filter((o) => o);
880
- pe(e.clientX, e.clientY, t, c, r);
881
- }
882
- }, document.addEventListener("contextmenu", g), v = !0);
886
+ function I() {
887
+ y || (x = (e) => {
888
+ const t = e.target;
889
+ if (t && t.classList.contains("rte-misspelled")) {
890
+ e.preventDefault(), W(t);
891
+ const r = t.getAttribute("data-word"), n = (t.getAttribute("data-suggestions") || "").split(",").filter((o) => o);
892
+ me(e.clientX, e.clientY, r, n, t);
893
+ }
894
+ }, document.addEventListener("contextmenu", x), y = !0);
883
895
  }
884
- function he() {
885
- !v || !g || (document.removeEventListener("contextmenu", g), g = null, v = !1);
896
+ function ke() {
897
+ !y || !x || (document.removeEventListener("contextmenu", x), x = null, y = !1);
886
898
  }
887
- function ue(e) {
899
+ function fe(e) {
888
900
  return e.closest("[data-editora-editor]") || e.parentElement || e;
889
901
  }
890
- function I() {
902
+ function q() {
891
903
  const e = k();
892
904
  if (!e)
893
905
  throw new Error("Spell check panel requested without active editor");
894
- const r = ue(e);
906
+ const t = fe(e);
895
907
  T();
896
- const t = document.createElement("div");
897
- return t.className = "rte-spell-check-panel", window.getComputedStyle(r).position === "static" && (r.style.position = "relative"), r.appendChild(t), t;
908
+ const r = document.createElement("div");
909
+ return r.className = "rte-spell-check-panel", window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t.appendChild(r), r;
898
910
  }
899
- function y(e) {
911
+ function E(e) {
900
912
  if (!a) return;
901
- const r = e || N(), t = se(r);
913
+ const t = e || M(), r = pe(t);
902
914
  a.innerHTML = `
903
915
  <div class="rte-spellcheck-header">
904
916
  <div>
@@ -911,20 +923,20 @@ function y(e) {
911
923
  <div class="rte-spellcheck-stats">
912
924
  <div class="rte-spellcheck-stat">
913
925
  <span class="rte-spellcheck-stat-label">Total</span>
914
- <strong class="rte-spellcheck-stat-value">${t.total}</strong>
926
+ <strong class="rte-spellcheck-stat-value">${r.total}</strong>
915
927
  </div>
916
928
  <div class="rte-spellcheck-stat">
917
929
  <span class="rte-spellcheck-stat-label">Misspelled</span>
918
- <strong class="rte-spellcheck-stat-value">${t.misspelled}</strong>
930
+ <strong class="rte-spellcheck-stat-value">${r.misspelled}</strong>
919
931
  </div>
920
932
  <div class="rte-spellcheck-stat">
921
933
  <span class="rte-spellcheck-stat-label">Accuracy</span>
922
- <strong class="rte-spellcheck-stat-value">${t.accuracy.toFixed(1)}%</strong>
934
+ <strong class="rte-spellcheck-stat-value">${r.accuracy.toFixed(1)}%</strong>
923
935
  </div>
924
936
  </div>
925
937
 
926
938
  <div class="rte-spellcheck-list">
927
- ${r.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : r.map((o, l) => `
939
+ ${t.length === 0 ? '<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>' : t.map((o, l) => `
928
940
  <div class="rte-spellcheck-item" data-word="${o.word}" data-index="${l}">
929
941
  <button class="rte-spellcheck-word-header" type="button">
930
942
  <span class="rte-spellcheck-word">${o.word}</span>
@@ -932,7 +944,7 @@ function y(e) {
932
944
  </button>
933
945
  <div class="rte-spellcheck-suggestions">
934
946
  ${o.suggestions.length > 0 ? `<div class="rte-spellcheck-actions">
935
- ${o.suggestions.map((n) => `<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${n}" type="button">${n}</button>`).join("")}
947
+ ${o.suggestions.map((c) => `<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${c}" type="button">${c}</button>`).join("")}
936
948
  </div>` : '<div class="rte-spellcheck-subtitle">No suggestions available</div>'}
937
949
  <div class="rte-spellcheck-actions">
938
950
  <button class="rte-spellcheck-btn ignore-btn" type="button">Ignore</button>
@@ -943,60 +955,68 @@ function y(e) {
943
955
  `).join("")}
944
956
  </div>
945
957
  `;
946
- const c = a.querySelector(".rte-spellcheck-close");
947
- c == null || c.addEventListener("click", (o) => {
948
- o.preventDefault(), o.stopPropagation(), J();
958
+ const n = a.querySelector(".rte-spellcheck-close");
959
+ n == null || n.addEventListener("click", (o) => {
960
+ o.preventDefault(), o.stopPropagation(), O();
949
961
  }), a.querySelectorAll(".rte-spellcheck-word-header").forEach((o) => {
950
962
  o.addEventListener("click", () => {
951
- const l = o.closest(".rte-spellcheck-item"), n = l == null ? void 0 : l.querySelector(".rte-spellcheck-suggestions"), i = o.querySelector(".rte-spellcheck-caret");
952
- n && i && (n.classList.contains("show") ? (n.classList.remove("show"), i.textContent = "▶") : (n.classList.add("show"), i.textContent = "▼"));
963
+ const l = o.closest(".rte-spellcheck-item"), c = l == null ? void 0 : l.querySelector(".rte-spellcheck-suggestions"), i = o.querySelector(".rte-spellcheck-caret");
964
+ c && i && (c.classList.contains("show") ? (c.classList.remove("show"), i.textContent = "▶") : (c.classList.add("show"), i.textContent = "▼"));
953
965
  });
954
966
  }), a.querySelectorAll(".suggestion-btn").forEach((o) => {
955
967
  o.addEventListener("click", () => {
956
- const l = o.getAttribute("data-suggestion"), n = o.closest(".rte-spellcheck-item");
957
- n == null || n.getAttribute("data-word");
958
- const i = parseInt((n == null ? void 0 : n.getAttribute("data-index")) || "0");
959
- r[i] && (ae(r[i], l), m());
968
+ const l = o.getAttribute("data-suggestion"), c = o.closest(".rte-spellcheck-item");
969
+ c == null || c.getAttribute("data-word");
970
+ const i = parseInt((c == null ? void 0 : c.getAttribute("data-index")) || "0");
971
+ t[i] && (de(t[i], l), m());
960
972
  });
961
973
  }), a.querySelectorAll(".ignore-btn").forEach((o) => {
962
974
  o.addEventListener("click", () => {
963
- const l = o.closest(".rte-spellcheck-item"), n = l == null ? void 0 : l.getAttribute("data-word");
964
- P(n);
975
+ const l = o.closest(".rte-spellcheck-item"), c = l == null ? void 0 : l.getAttribute("data-word");
976
+ G(c);
965
977
  });
966
978
  }), a.querySelectorAll(".add-btn").forEach((o) => {
967
979
  o.addEventListener("click", () => {
968
- const l = o.closest(".rte-spellcheck-item"), n = l == null ? void 0 : l.getAttribute("data-word");
969
- W(n);
980
+ const l = o.closest(".rte-spellcheck-item"), c = l == null ? void 0 : l.getAttribute("data-word");
981
+ J(c);
970
982
  });
971
983
  });
972
984
  }
973
- function R() {
985
+ function $() {
974
986
  const e = k();
975
- e && (d && d.disconnect(), d = new MutationObserver((r) => {
976
- b > 0 || r.some((t) => t.type === "characterData" || t.type === "childList") && (f && clearTimeout(f), f = window.setTimeout(() => {
987
+ e && (d && d.disconnect(), d = new MutationObserver((t) => {
988
+ b > 0 || t.some((r) => r.type === "characterData" || r.type === "childList") && (f && clearTimeout(f), f = window.setTimeout(() => {
977
989
  u && m();
978
990
  }, 350));
979
991
  }), d.observe(e, {
980
- ...$
992
+ ...B
981
993
  }));
982
994
  }
983
- function V() {
995
+ function U() {
984
996
  d && (d.disconnect(), d = null), f && (clearTimeout(f), f = null);
985
997
  }
986
- function G() {
998
+ function Y() {
987
999
  document.querySelectorAll(".rte-spellcheck-menu").forEach((e) => e.remove());
988
1000
  }
989
- function J() {
990
- return u && (S(), V(), he(), G(), a && (a.remove(), a = null), s = null, h = null, u = !1), !1;
1001
+ function z() {
1002
+ g || (g = (e) => {
1003
+ e.key !== "Escape" || !u || (e.preventDefault(), e.stopPropagation(), O());
1004
+ }, document.addEventListener("keydown", g, !0));
1005
+ }
1006
+ function be() {
1007
+ g && (document.removeEventListener("keydown", g, !0), g = null);
1008
+ }
1009
+ function O() {
1010
+ return u && (L(), U(), ke(), Y(), a && (a.remove(), a = null), s = null, h = null, u = !1, be()), !1;
991
1011
  }
992
- function me() {
993
- const e = Z();
994
- return e ? u && s && s !== e ? (S(), V(), G(), a && (a.remove(), a = null), s = e, T(), _(), m(), R(), a = I(), y(), !0) : u ? J() : (s = e, u = !0, T(), _(), m(), R(), a && (a.remove(), a = null), a = I(), y(), !0) : !1;
1012
+ function ge() {
1013
+ const e = ee();
1014
+ return e ? u && s && s !== e ? (L(), U(), Y(), a && (a.remove(), a = null), s = e, T(), I(), z(), m(), $(), a = q(), E(), !0) : u ? O() : (s = e, u = !0, T(), I(), z(), m(), $(), a && (a.remove(), a = null), a = q(), E(), !0) : !1;
995
1015
  }
996
- const ke = () => ({
1016
+ const xe = () => ({
997
1017
  name: "spellCheck",
998
1018
  init: () => {
999
- ee(), X();
1019
+ oe(), Q();
1000
1020
  },
1001
1021
  toolbar: [
1002
1022
  {
@@ -1007,13 +1027,13 @@ const ke = () => ({
1007
1027
  }
1008
1028
  ],
1009
1029
  commands: {
1010
- toggleSpellCheck: () => (me(), !0)
1030
+ toggleSpellCheck: (e, t) => (K(t), ge(), !0)
1011
1031
  },
1012
1032
  keymap: {
1013
1033
  F7: "toggleSpellCheck"
1014
1034
  }
1015
1035
  });
1016
1036
  export {
1017
- ke as SpellCheckPlugin
1037
+ xe as SpellCheckPlugin
1018
1038
  };
1019
- //# sourceMappingURL=SpellCheckPlugin.native-C8bPvRHy.mjs.map
1039
+ //# sourceMappingURL=SpellCheckPlugin.native-BZB9AewP.mjs.map