@editora/core 1.0.9 → 1.0.10

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
  3. package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
  4. package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
  5. package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
  6. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  7. package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
  8. package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  9. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  10. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  11. package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
  12. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  13. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  14. package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
  15. package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
  16. package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
  17. package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
  18. package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
  19. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  20. package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
  21. package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
  22. package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
  23. package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
  24. package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
  25. package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
  26. package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
  27. package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
  28. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  29. package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
  30. package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
  31. package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  32. package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
  33. package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
  34. package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
  35. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  36. package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
  37. package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
  38. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  39. package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
  40. package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
  41. package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
  42. package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
  43. package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
  44. package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
  45. package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
  46. package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
  47. package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
  48. package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
  49. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  50. package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
  51. package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
  52. package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
  53. package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
  54. package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  55. package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
  56. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  57. package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
  58. package/dist/core.css +1 -0
  59. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  60. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
  61. package/dist/editora.min.js +13 -14
  62. package/dist/editora.umd.js +13 -14
  63. package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
  64. package/dist/index-BslAFzmv.mjs +16544 -0
  65. package/dist/index-CPMGUZfB.js +10 -0
  66. package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
  67. package/dist/index.cjs.js +1 -1
  68. package/dist/index.es-BYD2KEo6.mjs +6666 -0
  69. package/dist/index.esm.js +7 -12
  70. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  71. package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
  72. package/dist/plugin-loader.js +67 -67
  73. package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
  74. package/dist/webcomponent-core.js +131 -168
  75. package/dist/webcomponent-core.min.css +1 -1
  76. package/dist/webcomponent-core.min.js +139 -63
  77. package/dist/webcomponent.cjs.js +1 -1
  78. package/dist/webcomponent.esm.js +1 -1
  79. package/dist/webcomponent.js +191 -228
  80. package/dist/webcomponent.min.css +1 -1
  81. package/dist/webcomponent.min.js +1240 -1344
  82. package/package.json +1 -1
  83. package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
  84. package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
  85. package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
  86. package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
  87. package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
  88. package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
  89. package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
  90. package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
  91. package/dist/MathPlugin.native-735bbac2.mjs +0 -296
  92. package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
  93. package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
  94. package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
  95. package/dist/documentManager-8327fb6e.mjs +0 -9166
  96. package/dist/index-072ef022.js +0 -11
  97. package/dist/index-49d31221.mjs +0 -16860
  98. package/dist/index.es-b47a189f.mjs +0 -5782
  99. package/dist/style.css +0 -1
@@ -20,8 +20,7 @@ function f(n) {
20
20
  }
21
21
  function h(n) {
22
22
  const t = [], e = f(n.startContainer), i = f(n.endContainer);
23
- if (!e && !i)
24
- return t;
23
+ if (!e && !i) return t;
25
24
  if (n.collapsed)
26
25
  return e && t.push(e), t;
27
26
  if (e === i)
@@ -38,8 +37,7 @@ function h(n) {
38
37
  }
39
38
  r = r.nextElementSibling;
40
39
  }
41
- if (!r)
42
- break;
40
+ if (!r) break;
43
41
  }
44
42
  i && !t.includes(i) && t.push(i);
45
43
  }
@@ -50,8 +48,7 @@ function E(n) {
50
48
  return t ? t.closest(".rte-content, .editora-content") || t.closest('[contenteditable="true"]') : null;
51
49
  }
52
50
  function m(n, t) {
53
- if (!n || t === n.innerHTML)
54
- return;
51
+ if (!n || t === n.innerHTML) return;
55
52
  const e = window.execEditorCommand || window.executeEditorCommand;
56
53
  if (typeof e == "function")
57
54
  try {
@@ -61,11 +58,9 @@ function m(n, t) {
61
58
  }
62
59
  const p = (n) => {
63
60
  var u;
64
- if (!n || !["left", "center", "right", "justify"].includes(n))
65
- return !1;
61
+ if (!n || !["left", "center", "right", "justify"].includes(n)) return !1;
66
62
  const e = window.getSelection();
67
- if (!e || e.rangeCount === 0)
68
- return !1;
63
+ if (!e || e.rangeCount === 0) return !1;
69
64
  const i = e.getRangeAt(0).cloneRange(), o = E(i), s = (o == null ? void 0 : o.innerHTML) || "", r = h(i);
70
65
  if (r.length > 0)
71
66
  r.forEach((l) => {
@@ -110,4 +105,4 @@ export {
110
105
  b as TextAlignmentPlugin,
111
106
  p as setTextAlignmentCommand
112
107
  };
113
- //# sourceMappingURL=TextAlignmentPlugin.native-9357b3ed.mjs.map
108
+ //# sourceMappingURL=TextAlignmentPlugin.native-sM_1s00t.mjs.map
@@ -1,4 +1,4 @@
1
- import { a as v, b as w } from "./anchoredPopover-5cca53ba.mjs";
1
+ import { a as v, b as w } from "./anchoredPopover-Bxds0VoB.mjs";
2
2
  let l = null, d = null, x = null, i = "#000000";
3
3
  const u = '[data-theme="dark"], .dark, .editora-theme-dark', C = [
4
4
  "#000000",
@@ -22,8 +22,7 @@ function y() {
22
22
  const r = n.closest(
23
23
  '[data-editora-editor="true"], .rte-editor, .editora-editor'
24
24
  );
25
- if (r)
26
- return r;
25
+ if (r) return r;
27
26
  }
28
27
  }
29
28
  const o = document.activeElement;
@@ -50,8 +49,7 @@ function E(e) {
50
49
  const a = Array.from(
51
50
  n.querySelectorAll(`[data-command="${e}"]`)
52
51
  ), s = c(a);
53
- if (s)
54
- return s;
52
+ if (s) return s;
55
53
  }
56
54
  const r = Array.from(
57
55
  document.querySelectorAll(`[data-command="${e}"]`)
@@ -59,13 +57,11 @@ function E(e) {
59
57
  return c(r);
60
58
  }
61
59
  function S(e) {
62
- if (e != null && e.closest(u))
63
- return !0;
60
+ if (e != null && e.closest(u)) return !0;
64
61
  const o = window.getSelection();
65
62
  if (o && o.rangeCount > 0) {
66
63
  const c = o.getRangeAt(0).startContainer, n = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement;
67
- if (n != null && n.closest(u))
68
- return !0;
64
+ if (n != null && n.closest(u)) return !0;
69
65
  }
70
66
  const t = document.activeElement;
71
67
  return t != null && t.closest(u) ? !0 : document.body.matches(u) || document.documentElement.matches(u);
@@ -83,8 +79,7 @@ function f(e) {
83
79
  }
84
80
  function T() {
85
81
  const e = window.getSelection();
86
- if (!e || e.rangeCount === 0)
87
- return "#000000";
82
+ if (!e || e.rangeCount === 0) return "#000000";
88
83
  let t = e.getRangeAt(0).startContainer;
89
84
  for (; t && t !== document.body; ) {
90
85
  if (t.nodeType === Node.ELEMENT_NODE) {
@@ -97,11 +92,9 @@ function T() {
97
92
  return "#000000";
98
93
  }
99
94
  function A(e) {
100
- if (e.startsWith("#"))
101
- return e;
95
+ if (e.startsWith("#")) return e;
102
96
  const o = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
103
- if (!o)
104
- return "#000000";
97
+ if (!o) return "#000000";
105
98
  const t = parseInt(o[1]), c = parseInt(o[2]), n = parseInt(o[3]);
106
99
  return "#" + [t, c, n].map((r) => {
107
100
  const a = r.toString(16);
@@ -170,8 +163,7 @@ function L(e) {
170
163
  }), P();
171
164
  }
172
165
  function P() {
173
- if (!l)
174
- return;
166
+ if (!l) return;
175
167
  const e = l.querySelector(".rte-color-picker-close");
176
168
  e == null || e.addEventListener("click", () => p()), l.querySelectorAll(".rte-color-swatch").forEach((n) => {
177
169
  n.addEventListener("click", () => {
@@ -197,27 +189,23 @@ function P() {
197
189
  });
198
190
  }
199
191
  function h(e) {
200
- if (!l)
201
- return;
192
+ if (!l) return;
202
193
  const o = l.querySelector(".rte-color-preview-box"), t = l.querySelector(".rte-color-preview-label");
203
194
  o && (o.style.backgroundColor = e, o.style.border = e === "#ffffff" ? "1px solid #ccc" : "none"), t && (t.textContent = e.toUpperCase());
204
195
  }
205
196
  function k(e) {
206
- if (!l)
207
- return;
197
+ if (!l) return;
208
198
  l.querySelectorAll(".rte-color-swatch").forEach((t) => {
209
199
  t.getAttribute("data-color") === e ? t.classList.add("selected") : t.classList.remove("selected");
210
200
  });
211
201
  }
212
202
  function $(e) {
213
- if (!l)
214
- return;
203
+ if (!l) return;
215
204
  const o = l.querySelector(".rte-color-input-native");
216
205
  o && (o.value = e);
217
206
  }
218
207
  function _(e) {
219
- if (!l)
220
- return;
208
+ if (!l) return;
221
209
  const o = l.querySelector(".rte-color-input-text");
222
210
  o && (o.value = e);
223
211
  }
@@ -538,4 +526,4 @@ const M = () => ({
538
526
  export {
539
527
  M as TextColorPlugin
540
528
  };
541
- //# sourceMappingURL=TextColorPlugin.native-d53ed459.mjs.map
529
+ //# sourceMappingURL=TextColorPlugin.native-Bwl_bSmc.mjs.map
@@ -16,25 +16,20 @@ const J = typeof InputEvent != "undefined" && typeof InputEvent.prototype == "ob
16
16
  "CANVAS"
17
17
  ]);
18
18
  function ee(e) {
19
- if (!e)
20
- return null;
19
+ if (!e) return null;
21
20
  const t = e.querySelector('[contenteditable="true"]');
22
21
  return t instanceof HTMLElement ? t : null;
23
22
  }
24
23
  function te() {
25
- if (typeof window == "undefined")
26
- return null;
24
+ if (typeof window == "undefined") return null;
27
25
  const e = window[_];
28
- if (!(e instanceof HTMLElement))
29
- return null;
26
+ if (!(e instanceof HTMLElement)) return null;
30
27
  window[_] = null;
31
28
  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);
32
29
  if (t) {
33
30
  const r = ee(t);
34
- if (r)
35
- return r;
36
- if (t.getAttribute("contenteditable") === "true")
37
- return t;
31
+ if (r) return r;
32
+ if (t.getAttribute("contenteditable") === "true") return t;
38
33
  }
39
34
  if (e.getAttribute("contenteditable") === "true")
40
35
  return e;
@@ -42,32 +37,25 @@ function te() {
42
37
  return n instanceof HTMLElement ? n : null;
43
38
  }
44
39
  function ne(e) {
45
- if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
46
- return e.contentElement;
40
+ if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
47
41
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
48
42
  const o = e.editorElement;
49
- if (o.getAttribute("contenteditable") === "true")
50
- return o;
43
+ if (o.getAttribute("contenteditable") === "true") return o;
51
44
  const a = o.querySelector('[contenteditable="true"]');
52
- if (a instanceof HTMLElement)
53
- return a;
45
+ if (a instanceof HTMLElement) return a;
54
46
  }
55
47
  const t = te();
56
- if (t && document.contains(t))
57
- return t;
48
+ if (t && document.contains(t)) return t;
58
49
  const n = window.getSelection();
59
50
  if (n && n.rangeCount > 0) {
60
51
  const o = n.getRangeAt(0).startContainer, a = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement, c = a == null ? void 0 : a.closest(p);
61
- if (c)
62
- return c;
52
+ if (c) return c;
63
53
  }
64
54
  const r = document.activeElement;
65
55
  if (r) {
66
- if (r.matches(p))
67
- return r;
56
+ if (r.matches(p)) return r;
68
57
  const o = r.closest(p);
69
- if (o)
70
- return o;
58
+ if (o) return o;
71
59
  }
72
60
  return h != null && h.isConnected ? h : document.querySelector(p);
73
61
  }
@@ -101,8 +89,7 @@ function ae(e) {
101
89
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
102
90
  }
103
91
  function oe(e, t) {
104
- if (t === e.innerHTML)
105
- return;
92
+ if (t === e.innerHTML) return;
106
93
  const n = window.execEditorCommand || window.executeEditorCommand;
107
94
  if (typeof n == "function")
108
95
  try {
@@ -165,8 +152,7 @@ function ie(e, t) {
165
152
  }
166
153
  function b(e) {
167
154
  const t = window.getSelection();
168
- if (!t || t.rangeCount === 0)
169
- return null;
155
+ if (!t || t.rangeCount === 0) return null;
170
156
  const n = t.getRangeAt(0);
171
157
  return e.contains(n.commonAncestorContainer) ? n : null;
172
158
  }
@@ -175,8 +161,7 @@ function ue() {
175
161
  "selectionchange",
176
162
  () => {
177
163
  const e = window.getSelection();
178
- if (!e || e.rangeCount === 0)
179
- return;
164
+ if (!e || e.rangeCount === 0) return;
180
165
  const t = e.getRangeAt(0), n = E(t.startContainer), r = (n == null ? void 0 : n.closest(p)) || null;
181
166
  r && (L.set(r, t.cloneRange()), h = r);
182
167
  },
@@ -189,8 +174,7 @@ function C(e, t) {
189
174
  return;
190
175
  }
191
176
  const n = window.getSelection();
192
- if (!n)
193
- return;
177
+ if (!n) return;
194
178
  const r = document.createRange();
195
179
  r.setStartAfter(t), r.collapse(!0), n.removeAllRanges(), n.addRange(r), e.focus({ preventScroll: !0 });
196
180
  }
@@ -200,15 +184,13 @@ function O(e, t) {
200
184
  return;
201
185
  }
202
186
  const n = window.getSelection();
203
- if (!n)
204
- return;
187
+ if (!n) return;
205
188
  const r = document.createRange();
206
189
  r.setStartBefore(t), r.collapse(!0), n.removeAllRanges(), n.addRange(r), e.focus({ preventScroll: !0 });
207
190
  }
208
191
  function de(e, t, n) {
209
192
  const r = window.getSelection();
210
- if (!r)
211
- return;
193
+ if (!r) return;
212
194
  const o = document.createRange();
213
195
  o.setStart(t, Math.max(0, n)), o.collapse(!0), r.removeAllRanges(), r.addRange(o), e.focus({ preventScroll: !0 });
214
196
  }
@@ -218,17 +200,13 @@ function V(e) {
218
200
  const c = L.get(e);
219
201
  c && e.contains(c.commonAncestorContainer) && (t = c.cloneRange());
220
202
  }
221
- if (!t || !t.collapsed)
222
- return;
203
+ if (!t || !t.collapsed) return;
223
204
  const n = E(t.startContainer);
224
- if (!n)
225
- return;
205
+ if (!n) return;
226
206
  const r = n.closest(g);
227
- if (!r || !e.contains(r) || !r.parentNode)
228
- return;
207
+ if (!r || !e.contains(r) || !r.parentNode) return;
229
208
  const o = window.getSelection();
230
- if (!o)
231
- return;
209
+ if (!o) return;
232
210
  const a = document.createRange();
233
211
  a.setStartAfter(r), a.collapse(!0), o.removeAllRanges(), o.addRange(a), e.focus({ preventScroll: !0 });
234
212
  }
@@ -240,8 +218,7 @@ function K(e, t) {
240
218
  }
241
219
  function fe(e) {
242
220
  const t = b(e);
243
- if (t && t.collapsed)
244
- return t;
221
+ if (t && t.collapsed) return t;
245
222
  const n = L.get(e);
246
223
  return n && n.collapsed && e.contains(n.commonAncestorContainer) ? n.cloneRange() : null;
247
224
  }
@@ -249,14 +226,11 @@ function ge(e) {
249
226
  return e.matches(g) || e.matches(f) ? (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 : Q.has(e.tagName);
250
227
  }
251
228
  function W(e, t) {
252
- if (t !== "insertParagraph")
253
- return !1;
229
+ if (t !== "insertParagraph") return !1;
254
230
  const n = fe(e);
255
- if (!n)
256
- return !1;
231
+ if (!n) return !1;
257
232
  const r = E(n.startContainer);
258
- if (!r)
259
- return !1;
233
+ if (!r) return !1;
260
234
  const o = r.closest("li");
261
235
  return !(o instanceof HTMLElement) || !e.contains(o) || (o.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !1 : !Array.from(o.querySelectorAll("*")).some(
262
236
  (s) => ge(s)
@@ -273,8 +247,7 @@ function he(e) {
273
247
  }
274
248
  function me(e) {
275
249
  return (e.textContent || "").length > 0 ? !0 : Array.from(e.childNodes).some((n) => {
276
- if (n.nodeType !== Node.ELEMENT_NODE)
277
- return !1;
250
+ if (n.nodeType !== Node.ELEMENT_NODE) return !1;
278
251
  const r = n;
279
252
  return ["BR", "IMG", "TABLE", "VIDEO", "AUDIO", "SVG", "MATH"].includes(r.tagName);
280
253
  });
@@ -283,15 +256,13 @@ function pe(e) {
283
256
  return Array.from(e.childNodes).some((t) => {
284
257
  if (t.nodeType === Node.TEXT_NODE)
285
258
  return (t.textContent || "").length > 0;
286
- if (t.nodeType !== Node.ELEMENT_NODE)
287
- return !1;
259
+ if (t.nodeType !== Node.ELEMENT_NODE) return !1;
288
260
  const n = t;
289
261
  return ["BR", "IMG", "TABLE", "VIDEO", "AUDIO", "SVG", "MATH"].includes(n.tagName);
290
262
  });
291
263
  }
292
264
  function Ee(e, t, n) {
293
- if (!e.collapsed)
294
- return null;
265
+ if (!e.collapsed) return null;
295
266
  const r = e.startContainer, o = e.startOffset;
296
267
  let a = null;
297
268
  if (r.nodeType === Node.TEXT_NODE) {
@@ -318,14 +289,12 @@ function Te(e, t, n) {
318
289
  }
319
290
  function x(e, t, n) {
320
291
  const r = t.parentNode;
321
- if (!r)
322
- return !1;
292
+ if (!r) return !1;
323
293
  const o = Array.prototype.indexOf.call(r.childNodes, t), a = ke(t, n === "backward");
324
294
  return a ? (n === "backward" ? a.data = a.data.slice(0, -1) : a.data = a.data.slice(1), a.data.length === 0 && a.remove(), pe(t) ? (n === "backward" ? C(e, t) : O(e, t), !0) : (t.remove(), de(e, r, o), !0)) : !1;
325
295
  }
326
296
  function Z(e) {
327
- if (e.startContainer !== e.endContainer || e.startContainer.nodeType !== Node.ELEMENT_NODE)
328
- return null;
297
+ if (e.startContainer !== e.endContainer || e.startContainer.nodeType !== Node.ELEMENT_NODE) return null;
329
298
  const t = e.startContainer;
330
299
  return e.endOffset - e.startOffset !== 1 ? null : t.childNodes[e.startOffset] || null;
331
300
  }
@@ -367,23 +336,19 @@ function Ae(e, t) {
367
336
  return !1;
368
337
  }
369
338
  });
370
- if (r.length !== 1)
371
- return null;
339
+ if (r.length !== 1) return null;
372
340
  const o = r[0], a = (e.toString() || "").replace(/\s+/g, ""), c = (o.textContent || "").replace(/\s+/g, "");
373
341
  return !c || a !== c ? null : o;
374
342
  }
375
343
  function U(e, t, n) {
376
- if (t.collapsed)
377
- return null;
344
+ if (t.collapsed) return null;
378
345
  const r = t.cloneContents();
379
- if (!me(r))
380
- return null;
346
+ if (!me(r)) return null;
381
347
  const o = ie(r, n);
382
348
  return t.deleteContents(), t.insertNode(o), C(e, o), o;
383
349
  }
384
350
  function Ne(e, t, n) {
385
- if (!t.collapsed)
386
- return t;
351
+ if (!t.collapsed) return t;
387
352
  const r = t.startContainer, o = t.startOffset;
388
353
  if (r.nodeType === Node.TEXT_NODE) {
389
354
  const s = r;
@@ -406,8 +371,7 @@ function Ne(e, t, n) {
406
371
  const u = t.cloneRange();
407
372
  if (i.nodeType === Node.TEXT_NODE) {
408
373
  const d = i;
409
- if (d.length === 0)
410
- continue;
374
+ if (d.length === 0) continue;
411
375
  u.setStart(d, d.length - 1), u.setEnd(d, d.length);
412
376
  } else
413
377
  u.setStartBefore(i), u.setEndAfter(i);
@@ -421,8 +385,7 @@ function Ne(e, t, n) {
421
385
  const u = t.cloneRange();
422
386
  if (i.nodeType === Node.TEXT_NODE) {
423
387
  const d = i;
424
- if (d.length === 0)
425
- continue;
388
+ if (d.length === 0) continue;
426
389
  u.setStart(d, 0), u.setEnd(d, 1);
427
390
  } else
428
391
  u.setStartBefore(i), u.setEndAfter(i);
@@ -450,8 +413,7 @@ function Ne(e, t, n) {
450
413
  }
451
414
  function z(e, t, n) {
452
415
  let r = b(e);
453
- if (!r)
454
- return !1;
416
+ if (!r) return !1;
455
417
  const o = Ce(e, r.cloneRange());
456
418
  if (!ce(o, r)) {
457
419
  const d = window.getSelection();
@@ -470,8 +432,7 @@ function z(e, t, n) {
470
432
  }
471
433
  function $(e, t, n) {
472
434
  const r = b(e);
473
- if (!r)
474
- return !1;
435
+ if (!r) return !1;
475
436
  const o = n.includes("Backward") ? "backward" : "forward", a = e.innerHTML;
476
437
  if (r.collapsed && Te(e, r.cloneRange(), o))
477
438
  return m(e, a), !0;
@@ -484,8 +445,7 @@ function $(e, t, n) {
484
445
  return m(e, a), !0;
485
446
  }
486
447
  const s = r.collapsed ? Ne(e, r.cloneRange(), o) : r.cloneRange();
487
- if (!s)
488
- return !1;
448
+ if (!s) return !1;
489
449
  const l = I(s, e);
490
450
  return l ? (o === "backward" ? O(e, l) : C(e, l), !0) : U(e, s, t) ? (H(e), m(e, a), !0) : !1;
491
451
  }
@@ -506,8 +466,7 @@ function H(e) {
506
466
  let n = !0;
507
467
  for (; n; )
508
468
  n = !1, Array.from(e.querySelectorAll(f)).forEach((o) => {
509
- if (!o.isConnected)
510
- return;
469
+ if (!o.isConnected) return;
511
470
  let a = o.nextSibling;
512
471
  for (; a && a.nodeType === Node.TEXT_NODE && !(a.textContent || "").trim(); )
513
472
  a = a.nextSibling;
@@ -524,8 +483,7 @@ function Y(e) {
524
483
  }
525
484
  function ye(e) {
526
485
  const t = b(e);
527
- if (!t)
528
- return [];
486
+ if (!t) return [];
529
487
  const n = /* @__PURE__ */ new Set(), r = t.startContainer.nodeType === Node.ELEMENT_NODE ? t.startContainer : t.startContainer.parentElement, o = t.endContainer.nodeType === Node.ELEMENT_NODE ? t.endContainer : t.endContainer.parentElement, a = r == null ? void 0 : r.closest(w);
530
488
  a && e.contains(a) && n.add(a);
531
489
  const c = o == null ? void 0 : o.closest(w);
@@ -539,12 +497,10 @@ function ye(e) {
539
497
  }
540
498
  function A(e, t, n) {
541
499
  const r = n === "all" ? Y(e) : ye(e);
542
- if (r.length === 0)
543
- return !1;
500
+ if (r.length === 0) return !1;
544
501
  const o = e.innerHTML;
545
502
  return r.forEach((a) => {
546
- if (!a.isConnected)
547
- return;
503
+ if (!a.isConnected) return;
548
504
  const c = a.matches(g), s = a.matches(f);
549
505
  if (!(!c && !s)) {
550
506
  if (t === "accept") {
@@ -556,8 +512,7 @@ function A(e, t, n) {
556
512
  }), H(e), m(e, o), !0;
557
513
  }
558
514
  function Se(e) {
559
- if (!(e instanceof Node))
560
- return null;
515
+ if (!(e instanceof Node)) return null;
561
516
  const t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
562
517
  return (t == null ? void 0 : t.closest(p)) || null;
563
518
  }
@@ -565,11 +520,9 @@ function Me() {
565
520
  F || typeof document == "undefined" || (F = !0, document.addEventListener(
566
521
  "focusin",
567
522
  (e) => {
568
- if (!T.enabledByDefault)
569
- return;
523
+ if (!T.enabledByDefault) return;
570
524
  const t = Se(e.target);
571
- if (!t)
572
- return;
525
+ if (!t) return;
573
526
  h = t;
574
527
  const n = R(t, T);
575
528
  n.enabled ? (M(t, n), y(t, !0), S(t, "toggleTrackChanges", !0)) : k(t);
@@ -579,8 +532,7 @@ function Me() {
579
532
  }
580
533
  function we(e, t) {
581
534
  return (n) => {
582
- if (!t.enabled || e.getAttribute("data-track-changes") !== "true")
583
- return;
535
+ if (!t.enabled || e.getAttribute("data-track-changes") !== "true") return;
584
536
  h = e;
585
537
  const r = n.inputType || "";
586
538
  if (r === "insertParagraph" || r === "insertLineBreak") {
@@ -595,16 +547,14 @@ function we(e, t) {
595
547
  }
596
548
  if (r === "insertText" || r === "insertCompositionText") {
597
549
  const o = n.data || "";
598
- if (!o)
599
- return;
550
+ if (!o) return;
600
551
  n.preventDefault(), z(e, t, o);
601
552
  }
602
553
  };
603
554
  }
604
555
  function Re(e, t) {
605
556
  return (n) => {
606
- if (!t.enabled || e.getAttribute("data-track-changes") !== "true" || n.key !== "Enter" || J)
607
- return;
557
+ if (!t.enabled || e.getAttribute("data-track-changes") !== "true" || n.key !== "Enter" || J) return;
608
558
  const r = n.shiftKey ? "insertLineBreak" : "insertParagraph";
609
559
  W(e, r) || (h = e, n.preventDefault(), n.stopPropagation(), K(e, r));
610
560
  };
@@ -612,26 +562,22 @@ function Re(e, t) {
612
562
  function xe(e, t) {
613
563
  return (n) => {
614
564
  var o;
615
- if (n.__editoraSmartPasteHandled === !0 || n.defaultPrevented || !t.enabled || e.getAttribute("data-track-changes") !== "true")
616
- return;
565
+ if (n.__editoraSmartPasteHandled === !0 || n.defaultPrevented || !t.enabled || e.getAttribute("data-track-changes") !== "true") return;
617
566
  const r = ((o = n.clipboardData) == null ? void 0 : o.getData("text/plain")) || "";
618
567
  r && (n.preventDefault(), h = e, z(e, t, r));
619
568
  };
620
569
  }
621
570
  function ve(e, t) {
622
571
  return (n) => {
623
- if (!t.enabled || e.getAttribute("data-track-changes") !== "true")
624
- return;
572
+ if (!t.enabled || e.getAttribute("data-track-changes") !== "true") return;
625
573
  const r = b(e);
626
- if (!r || r.collapsed)
627
- return;
574
+ if (!r || r.collapsed) return;
628
575
  const o = r.toString();
629
576
  n.clipboardData && (n.clipboardData.setData("text/plain", o), n.preventDefault()), h = e, $(e, t, "deleteByCut");
630
577
  };
631
578
  }
632
579
  function M(e, t) {
633
- if (N.has(e))
634
- return;
580
+ if (N.has(e)) return;
635
581
  k(e);
636
582
  const n = {
637
583
  beforeInput: we(e, t),
@@ -646,8 +592,7 @@ function X(e) {
646
592
  t && (e.removeEventListener("beforeinput", t.beforeInput), e.removeEventListener("keydown", t.keydown), e.removeEventListener("paste", t.paste), e.removeEventListener("cut", t.cut), N.delete(e), D.delete(e));
647
593
  }
648
594
  function Le() {
649
- if (q || typeof document == "undefined")
650
- return;
595
+ if (q || typeof document == "undefined") return;
651
596
  q = !0;
652
597
  const e = document.createElement("style");
653
598
  e.id = "rte-track-changes-styles", e.textContent = `
@@ -740,8 +685,7 @@ const De = (e = {}) => {
740
685
  return o ? (h = o, o) : null;
741
686
  }, n = (r) => {
742
687
  const o = t(r);
743
- if (!o)
744
- return null;
688
+ if (!o) return null;
745
689
  const a = R(o, e);
746
690
  return { editor: o, state: a };
747
691
  };
@@ -775,8 +719,7 @@ const De = (e = {}) => {
775
719
  commands: {
776
720
  toggleTrackChanges: (r, o) => {
777
721
  const a = n(o);
778
- if (!a)
779
- return !1;
722
+ if (!a) return !1;
780
723
  const { editor: c, state: s } = a;
781
724
  return s.enabled = !s.enabled, s.enabled ? M(c, s) : (X(c), k(c), V(c)), y(c, s.enabled), S(c, "toggleTrackChanges", s.enabled), c.dispatchEvent(new CustomEvent("editora:track-changes-toggle", {
782
725
  bubbles: !0,
@@ -815,4 +758,4 @@ const De = (e = {}) => {
815
758
  export {
816
759
  De as TrackChangesPlugin
817
760
  };
818
- //# sourceMappingURL=TrackChangesPlugin.native-e96da509.mjs.map
761
+ //# sourceMappingURL=TrackChangesPlugin.native-Bghu2q4a.mjs.map