@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
@@ -706,11 +706,9 @@ const y = '[data-theme="dark"], .dark, .editora-theme-dark', C = () => ({
706
706
  return e ? (E(e), !0) : !1;
707
707
  },
708
708
  insertEmoji: (r, t) => {
709
- if (!r)
710
- return !1;
709
+ if (!r) return !1;
711
710
  const e = (t == null ? void 0 : t.contentElement) || b();
712
- if (!e)
713
- return !1;
711
+ if (!e) return !1;
714
712
  try {
715
713
  return k(r, e), !0;
716
714
  } catch (o) {
@@ -787,8 +785,7 @@ function z(r, t) {
787
785
  o == null || o.addEventListener("click", (i) => {
788
786
  var j;
789
787
  const c = i.target.closest(".emojis-item");
790
- if (!c)
791
- return;
788
+ if (!c) return;
792
789
  const h = c.getAttribute("data-emoji") || ((j = c.textContent) == null ? void 0 : j.trim()) || "";
793
790
  h && (k(h, t), m());
794
791
  });
@@ -831,8 +828,7 @@ function b() {
831
828
  const r = window.getSelection();
832
829
  if (r && r.rangeCount > 0) {
833
830
  const e = r.anchorNode, o = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement, a = o == null ? void 0 : o.closest(".editora-content, .rte-content");
834
- if (a)
835
- return a;
831
+ if (a) return a;
836
832
  }
837
833
  const t = document.activeElement;
838
834
  return t && (t.classList.contains("editora-content") || t.classList.contains("rte-content")) ? t : document.querySelector(".editora-content, .rte-content");
@@ -842,8 +838,7 @@ function A(r) {
842
838
  return t ? !!t.closest(y) : !1;
843
839
  }
844
840
  function L() {
845
- if (document.getElementById("emojis-dialog-styles"))
846
- return;
841
+ if (document.getElementById("emojis-dialog-styles")) return;
847
842
  const r = document.createElement("style");
848
843
  r.id = "emojis-dialog-styles", r.textContent = `
849
844
  .emojis-overlay {
@@ -1119,4 +1114,4 @@ function L() {
1119
1114
  export {
1120
1115
  C as EmojisPlugin
1121
1116
  };
1122
- //# sourceMappingURL=EmojisPlugin.native-65c5ac47.mjs.map
1117
+ //# sourceMappingURL=EmojisPlugin.native-CitxxlWX.mjs.map
@@ -47,8 +47,7 @@ const E = () => ({
47
47
  ],
48
48
  commands: {
49
49
  setFontFamily: (e) => {
50
- if (!e)
51
- return !1;
50
+ if (!e) return !1;
52
51
  try {
53
52
  return C(e), !0;
54
53
  } catch (t) {
@@ -101,8 +100,7 @@ function A(e, t, n) {
101
100
  }
102
101
  function C(e) {
103
102
  const t = window.getSelection();
104
- if (!t || t.rangeCount === 0)
105
- return;
103
+ if (!t || t.rangeCount === 0) return;
106
104
  const n = t.getRangeAt(0), r = n.cloneRange(), a = h(n.commonAncestorContainer);
107
105
  if (n.collapsed)
108
106
  return;
@@ -113,8 +111,7 @@ function C(e) {
113
111
  o.selectNodeContents(s), t.removeAllRanges(), t.addRange(o), f(a);
114
112
  return;
115
113
  }
116
- if (!a)
117
- return;
114
+ if (!a) return;
118
115
  const m = new Set(
119
116
  Array.from(a.querySelectorAll("font[face]"))
120
117
  ), u = new Set(
@@ -158,4 +155,4 @@ function F(e, t) {
158
155
  export {
159
156
  E as FontFamilyPlugin
160
157
  };
161
- //# sourceMappingURL=FontFamilyPlugin.native-f9bc255a.mjs.map
158
+ //# sourceMappingURL=FontFamilyPlugin.native-j8hMTbg4.mjs.map
@@ -71,12 +71,10 @@ const O = () => ({
71
71
  },
72
72
  setFontSize: (e) => {
73
73
  var o;
74
- if (!e)
75
- return !1;
74
+ if (!e) return !1;
76
75
  try {
77
76
  const n = e.trim().match(/^(\d+(?:\.\d+)?)(px|em|rem)?$/i);
78
- if (!n)
79
- return !1;
77
+ if (!n) return !1;
80
78
  const i = parseFloat(n[1]), r = ((o = n[2]) == null ? void 0 : o.toLowerCase()) || "px";
81
79
  return r === "px" && (i < 8 || i > 72) || (r === "em" || r === "rem") && (i < 0.5 || i > 5) ? !1 : (C(i, r), !0);
82
80
  } catch (t) {
@@ -134,8 +132,7 @@ function E(e, o, t, n) {
134
132
  const i = Array.from(
135
133
  e.querySelectorAll("font[size], [style*='font-size']")
136
134
  ), r = (s) => {
137
- if (!n || !s.isConnected)
138
- return !1;
135
+ if (!n || !s.isConnected) return !1;
139
136
  try {
140
137
  if (typeof n.intersectsNode == "function")
141
138
  return n.intersectsNode(s);
@@ -177,8 +174,7 @@ function T(e, o, t) {
177
174
  }
178
175
  function y(e) {
179
176
  const o = window.getSelection();
180
- if (!o || o.rangeCount === 0)
181
- return;
177
+ if (!o || o.rangeCount === 0) return;
182
178
  const { value: t, unit: n } = h();
183
179
  let i = e;
184
180
  (n === "em" || n === "rem") && (i = e * 0.125);
@@ -206,8 +202,7 @@ function h() {
206
202
  }
207
203
  function C(e, o = "px") {
208
204
  const t = window.getSelection();
209
- if (!t || t.rangeCount === 0)
210
- return;
205
+ if (!t || t.rangeCount === 0) return;
211
206
  const n = t.getRangeAt(0), i = n.cloneRange(), r = x(n.commonAncestorContainer);
212
207
  if (n.collapsed)
213
208
  return;
@@ -218,8 +213,7 @@ function C(e, o = "px") {
218
213
  m.selectNodeContents(a), t.removeAllRanges(), t.addRange(m);
219
214
  return;
220
215
  }
221
- if (!r)
222
- return;
216
+ if (!r) return;
223
217
  const l = new Set(
224
218
  Array.from(
225
219
  r.querySelectorAll("font[size], [style*='font-size']")
@@ -262,8 +256,7 @@ function v(e, o) {
262
256
  function z() {
263
257
  setTimeout(() => {
264
258
  const { value: e, unit: o } = h(), t = window.getSelection();
265
- if (!t || t.rangeCount === 0)
266
- return;
259
+ if (!t || t.rangeCount === 0) return;
267
260
  let n = null, r = t.getRangeAt(0).startContainer;
268
261
  for (; r; ) {
269
262
  if (r instanceof HTMLElement && (r.classList.contains("rte-editor") || r.classList.contains("editora-editor") || r.hasAttribute("data-editora-editor"))) {
@@ -272,8 +265,7 @@ function z() {
272
265
  }
273
266
  r = r.parentNode;
274
267
  }
275
- if (!n)
276
- return;
268
+ if (!n) return;
277
269
  const c = n.querySelector(
278
270
  ".rte-toolbar-wrapper, .editora-toolbar-container"
279
271
  ) || n, s = Array.from(
@@ -281,8 +273,7 @@ function z() {
281
273
  'input[data-command="setFontSize"], input.editora-toolbar-input.font-size, input.rte-toolbar-input.font-size, input[title="Font Size"]'
282
274
  )
283
275
  );
284
- if (s.length === 0)
285
- return;
276
+ if (s.length === 0) return;
286
277
  const l = `${e % 1 === 0 ? e.toString() : e.toFixed(2).replace(/\.?0+$/, "")}${o}`;
287
278
  s.forEach((u) => {
288
279
  u.value = l;
@@ -292,4 +283,4 @@ function z() {
292
283
  export {
293
284
  O as FontSizePlugin
294
285
  };
295
- //# sourceMappingURL=FontSizePlugin.native-f5647872.mjs.map
286
+ //# sourceMappingURL=FontSizePlugin.native-B_jCh7dY.mjs.map
@@ -1,8 +1,7 @@
1
1
  const C = ".rte-content, .editora-content", x = '.rte-footnotes[data-type="footnotes"]', p = ".rte-footnote-ref[data-footnote-id]", h = 'li.rte-footnote-item[data-type="footnote"]', k = "__editoraCommandEditorRoot";
2
2
  let w = !1, T = !1, N = 0;
3
3
  function _() {
4
- if (w || typeof document == "undefined")
5
- return;
4
+ if (w || typeof document == "undefined") return;
6
5
  w = !0;
7
6
  const t = document.createElement("style");
8
7
  t.id = "editora-footnote-plugin-styles", t.textContent = `
@@ -95,25 +94,20 @@ function L(t) {
95
94
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
96
95
  }
97
96
  function q(t) {
98
- if (!t)
99
- return null;
97
+ if (!t) return null;
100
98
  const e = t.querySelector('[contenteditable="true"]');
101
99
  return e instanceof HTMLElement ? e : null;
102
100
  }
103
101
  function H() {
104
- if (typeof window == "undefined")
105
- return null;
102
+ if (typeof window == "undefined") return null;
106
103
  const t = window[k];
107
- if (!(t instanceof HTMLElement))
108
- return null;
104
+ if (!(t instanceof HTMLElement)) return null;
109
105
  window[k] = null;
110
106
  const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
111
107
  if (e) {
112
108
  const o = q(e);
113
- if (o)
114
- return o;
115
- if (e.getAttribute("contenteditable") === "true")
116
- return e;
109
+ if (o) return o;
110
+ if (e.getAttribute("contenteditable") === "true") return e;
117
111
  }
118
112
  if (t.getAttribute("contenteditable") === "true")
119
113
  return t;
@@ -122,8 +116,7 @@ function H() {
122
116
  }
123
117
  function B(t) {
124
118
  const e = t.closest('[contenteditable="true"]');
125
- if (!e)
126
- return null;
119
+ if (!e) return null;
127
120
  let n = e, o = n.parentElement;
128
121
  for (; o; )
129
122
  o.getAttribute("contenteditable") === "true" && (n = o), o = o.parentElement;
@@ -131,8 +124,7 @@ function B(t) {
131
124
  }
132
125
  function u(t) {
133
126
  const e = L(t);
134
- if (!e)
135
- return null;
127
+ if (!e) return null;
136
128
  const n = e.closest(C);
137
129
  return n || B(e);
138
130
  }
@@ -145,11 +137,9 @@ function M() {
145
137
  if (t && document.contains(t))
146
138
  return t;
147
139
  const e = $();
148
- if (e)
149
- return e;
140
+ if (e) return e;
150
141
  const n = document.activeElement, o = n ? u(n) : null;
151
- if (o)
152
- return o;
142
+ if (o) return o;
153
143
  const r = document.querySelector(C);
154
144
  return r || document.querySelector('[contenteditable="true"]');
155
145
  }
@@ -195,8 +185,7 @@ function A(t) {
195
185
  t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
196
186
  }
197
187
  function S(t, e) {
198
- if (!t || e === t.innerHTML)
199
- return;
188
+ if (!t || e === t.innerHTML) return;
200
189
  const n = window.execEditorCommand || window.executeEditorCommand;
201
190
  if (typeof n == "function")
202
191
  try {
@@ -230,21 +219,17 @@ function V(t) {
230
219
  }
231
220
  function R(t) {
232
221
  const e = t.parentNode;
233
- if (!e)
234
- return;
222
+ if (!e) return;
235
223
  const n = Array.from(e.childNodes).indexOf(t);
236
- if (n < 0)
237
- return;
224
+ if (n < 0) return;
238
225
  const o = window.getSelection();
239
- if (!o)
240
- return;
226
+ if (!o) return;
241
227
  const r = document.createRange();
242
228
  r.setStart(e, n), r.setEnd(e, n + 1), o.removeAllRanges(), o.addRange(r), t.focus({ preventScroll: !0 });
243
229
  }
244
230
  function O(t, e) {
245
231
  const n = window.getSelection();
246
- if (!n)
247
- return;
232
+ if (!n) return;
248
233
  const o = Math.max(0, Math.min(e, t.childNodes.length)), r = document.createRange();
249
234
  r.setStart(t, o), r.collapse(!0), n.removeAllRanges(), n.addRange(r);
250
235
  }
@@ -259,8 +244,7 @@ function b(t, e, n) {
259
244
  if (o.nodeType === Node.ELEMENT_NODE) {
260
245
  const c = o;
261
246
  if (n === "previous") {
262
- if (r > 0)
263
- return c.childNodes[r - 1] || null;
247
+ if (r > 0) return c.childNodes[r - 1] || null;
264
248
  } else if (r < c.childNodes.length)
265
249
  return c.childNodes[r] || null;
266
250
  }
@@ -269,15 +253,13 @@ function b(t, e, n) {
269
253
  let i = o;
270
254
  for (; i && i !== e; ) {
271
255
  const c = n === "previous" ? i.previousSibling : i.nextSibling;
272
- if (c)
273
- return c;
256
+ if (c) return c;
274
257
  i = i.parentNode;
275
258
  }
276
259
  return null;
277
260
  }
278
261
  function Y(t, e, n) {
279
- if (!t.collapsed)
280
- return null;
262
+ if (!t.collapsed) return null;
281
263
  const o = (c) => c instanceof HTMLElement && c.matches(p) ? c : null, { startContainer: r, startOffset: i } = t;
282
264
  if (r.nodeType === Node.ELEMENT_NODE) {
283
265
  const c = r;
@@ -298,15 +280,13 @@ function Y(t, e, n) {
298
280
  }
299
281
  function m(t) {
300
282
  const e = Array.from(t.querySelectorAll(p)).filter((a) => !a.closest(x)), n = g(t, e.length > 0);
301
- if (!n)
302
- return;
283
+ if (!n) return;
303
284
  const o = D(n), r = Array.from(o.querySelectorAll(h)), i = /* @__PURE__ */ new Map();
304
285
  r.forEach((a) => i.set(a.id, a));
305
286
  const c = [];
306
287
  e.forEach((a, f) => {
307
288
  const l = a.getAttribute("data-footnote-id");
308
- if (!l)
309
- return;
289
+ if (!l) return;
310
290
  const s = f + 1;
311
291
  a.setAttribute("data-number", String(s)), a.id = `ref-${l}`, a.textContent = String(s);
312
292
  let d = i.get(l);
@@ -319,11 +299,9 @@ function m(t) {
319
299
  }
320
300
  function F(t, e) {
321
301
  const n = u(t), o = t.parentNode;
322
- if (!n || !o)
323
- return !1;
302
+ if (!n || !o) return !1;
324
303
  const r = n.innerHTML, i = Array.from(o.childNodes).indexOf(t);
325
- if (i < 0)
326
- return !1;
304
+ if (i < 0) return !1;
327
305
  const c = t.getAttribute("data-footnote-id") || "";
328
306
  if (t.remove(), c) {
329
307
  const a = n.querySelector(
@@ -336,49 +314,38 @@ function F(t, e) {
336
314
  function G() {
337
315
  T || typeof document == "undefined" || (T = !0, document.addEventListener("click", (t) => {
338
316
  const e = t.target;
339
- if (!e)
340
- return;
317
+ if (!e) return;
341
318
  const n = e.closest(p);
342
319
  if (n) {
343
320
  const f = u(n);
344
- if (!f || !f.contains(n))
345
- return;
321
+ if (!f || !f.contains(n)) return;
346
322
  t.preventDefault(), t.stopPropagation(), R(n), n.classList.add("rte-footnote-selected"), window.setTimeout(() => n.classList.remove("rte-footnote-selected"), 1200);
347
323
  const l = n.getAttribute("data-footnote-id");
348
- if (!l)
349
- return;
324
+ if (!l) return;
350
325
  const s = f.querySelector(
351
326
  `${h}#${CSS.escape(l)}`
352
327
  );
353
- if (!s)
354
- return;
328
+ if (!s) return;
355
329
  s.scrollIntoView({ behavior: "smooth", block: "center" }), v(s);
356
330
  return;
357
331
  }
358
332
  const o = e.closest(".rte-footnote-backref");
359
- if (!o)
360
- return;
333
+ if (!o) return;
361
334
  const r = o.closest(h);
362
- if (!r)
363
- return;
335
+ if (!r) return;
364
336
  const i = u(r);
365
- if (!i || !i.contains(r))
366
- return;
337
+ if (!i || !i.contains(r)) return;
367
338
  t.preventDefault(), t.stopPropagation();
368
339
  const c = r.id;
369
- if (!c)
370
- return;
340
+ if (!c) return;
371
341
  const a = X(i, c);
372
342
  a && (a.scrollIntoView({ behavior: "smooth", block: "center" }), v(a), R(a));
373
343
  }), document.addEventListener("keydown", (t) => {
374
- if (t.key !== "Backspace" && t.key !== "Delete")
375
- return;
344
+ if (t.key !== "Backspace" && t.key !== "Delete") return;
376
345
  const e = window.getSelection();
377
- if (!e || e.rangeCount === 0)
378
- return;
346
+ if (!e || e.rangeCount === 0) return;
379
347
  const n = e.getRangeAt(0), o = u(n.commonAncestorContainer);
380
- if (!o || !o.contains(n.commonAncestorContainer))
381
- return;
348
+ if (!o || !o.contains(n.commonAncestorContainer)) return;
382
349
  const r = K(n);
383
350
  if (r) {
384
351
  t.preventDefault(), t.stopPropagation(), F(r, t.key);
@@ -394,11 +361,9 @@ function G() {
394
361
  }
395
362
  const J = (t = "") => {
396
363
  const e = M();
397
- if (!e)
398
- return !1;
364
+ if (!e) return !1;
399
365
  const n = e.innerHTML, o = window.getSelection();
400
- if (!o)
401
- return !1;
366
+ if (!o) return !1;
402
367
  let r;
403
368
  try {
404
369
  r = V(e);
@@ -415,8 +380,7 @@ const J = (t = "") => {
415
380
  const a = document.createRange();
416
381
  a.setStartAfter(c), a.collapse(!0), o.removeAllRanges(), o.addRange(a);
417
382
  const f = g(e, !0);
418
- if (!f)
419
- return !1;
383
+ if (!f) return !1;
420
384
  const l = D(f), s = t.trim() || "Footnote";
421
385
  return l.appendChild(I(i, s)), m(e), S(e, n), A(e), !0;
422
386
  }, Q = () => {
@@ -433,11 +397,9 @@ const J = (t = "") => {
433
397
  const n = document.querySelector('[contenteditable="true"]');
434
398
  n && m(n);
435
399
  }, U = (t) => {
436
- if (!t)
437
- return;
400
+ if (!t) return;
438
401
  const e = Array.from(document.querySelectorAll(p)).find((i) => i.getAttribute("data-footnote-id") === t) || null, n = document.getElementById(t), o = u(e || n);
439
- if (!o)
440
- return;
402
+ if (!o) return;
441
403
  const r = o.innerHTML;
442
404
  e == null || e.remove(), n == null || n.remove(), m(o), S(o, r), A(o);
443
405
  }, W = () => (_(), G(), {
@@ -460,4 +422,4 @@ export {
460
422
  J as insertFootnoteCommand,
461
423
  Q as renumberAllFootnotes
462
424
  };
463
- //# sourceMappingURL=FootnotePlugin.native-494657b3.mjs.map
425
+ //# sourceMappingURL=FootnotePlugin.native-D730OGRm.mjs.map
@@ -74,4 +74,4 @@ export {
74
74
  d as isFullscreenActive,
75
75
  i as toggleFullscreen
76
76
  };
77
- //# sourceMappingURL=FullscreenPlugin.native-87ce92e9.mjs.map
77
+ //# sourceMappingURL=FullscreenPlugin.native-ChXyxeNw.mjs.map
@@ -0,0 +1,249 @@
1
+ const f = '.rte-content, .editora-content, [contenteditable="true"]', y = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", g = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "PRE"]), E = "p,div,h1,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,table", B = /* @__PURE__ */ new Set(["p", "h1", "h2", "h3", "h4", "h5", "h6"]);
2
+ function H(e) {
3
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
4
+ }
5
+ function S(e) {
6
+ const n = e == null ? void 0 : e.contentElement;
7
+ if (n instanceof HTMLElement) return n;
8
+ const t = e == null ? void 0 : e.editorElement;
9
+ if (t instanceof HTMLElement) {
10
+ const a = t.querySelector(f);
11
+ if (a instanceof HTMLElement) return a;
12
+ if (t.getAttribute("contenteditable") === "true") return t;
13
+ }
14
+ const r = window.getSelection();
15
+ if (r && r.rangeCount > 0) {
16
+ const a = H(r.getRangeAt(0).startContainer), i = a == null ? void 0 : a.closest(f);
17
+ if (i instanceof HTMLElement) return i;
18
+ const c = a == null ? void 0 : a.closest(y), u = c == null ? void 0 : c.querySelector(f);
19
+ if (u instanceof HTMLElement) return u;
20
+ }
21
+ const s = document.activeElement, o = s == null ? void 0 : s.closest(f);
22
+ return o instanceof HTMLElement ? o : document.querySelector(f);
23
+ }
24
+ function N(e) {
25
+ const n = window.getSelection();
26
+ if (!n || n.rangeCount === 0) return null;
27
+ const t = n.getRangeAt(0);
28
+ return !e.contains(t.startContainer) || !e.contains(t.endContainer) ? null : t;
29
+ }
30
+ function T(e, n) {
31
+ let t = H(n);
32
+ if (!t || t === e || !e.contains(t)) return null;
33
+ for (; t.parentElement && t.parentElement !== e; )
34
+ t = t.parentElement;
35
+ if (t.parentElement !== e) return null;
36
+ if (t.matches(E)) return t;
37
+ const r = t.closest(E);
38
+ return r instanceof HTMLElement && r.parentElement === e ? r : t;
39
+ }
40
+ function C(e, n) {
41
+ if (typeof e.intersectsNode == "function")
42
+ try {
43
+ return e.intersectsNode(n);
44
+ } catch (r) {
45
+ return !1;
46
+ }
47
+ const t = document.createRange();
48
+ return t.selectNode(n), e.compareBoundaryPoints(Range.END_TO_START, t) < 0 && e.compareBoundaryPoints(Range.START_TO_END, t) > 0;
49
+ }
50
+ function w(e, n) {
51
+ const t = T(e, n.startContainer), r = T(e, n.endContainer);
52
+ if (!t) return [];
53
+ if (!r || t === r) return [t];
54
+ const o = Array.from(e.children).filter(
55
+ (a) => a instanceof HTMLElement
56
+ ).filter((a) => C(n, a));
57
+ return o.length > 0 ? o : [t];
58
+ }
59
+ function A(e, n) {
60
+ Array.from(e.attributes).forEach((t) => {
61
+ n.setAttribute(t.name, t.value);
62
+ });
63
+ }
64
+ function p(e, n) {
65
+ for (; e.firstChild; )
66
+ n.appendChild(e.firstChild);
67
+ }
68
+ function I(e) {
69
+ return e.tagName !== "P" || e.attributes.length > 0 || (e.textContent || "").trim() !== "" ? !1 : !e.querySelector("img, video, table, iframe, hr, pre, ul, ol");
70
+ }
71
+ function d(e, n) {
72
+ const t = document.createElement(e);
73
+ return n && A(n, t), t;
74
+ }
75
+ function v(e, n) {
76
+ const t = d(n, e);
77
+ return p(e, t), t.innerHTML.trim() || (t.innerHTML = "<br>"), t;
78
+ }
79
+ function R(e) {
80
+ const n = e.cloneNode(!1);
81
+ return n instanceof HTMLElement ? n : document.createElement(e.tagName.toLowerCase());
82
+ }
83
+ function L(e, n, t) {
84
+ const r = e.parentNode;
85
+ if (!r) return [];
86
+ const s = document.createDocumentFragment(), o = [];
87
+ let a = null;
88
+ const i = () => {
89
+ a && a.children.length > 0 && s.appendChild(a), a = null;
90
+ };
91
+ return Array.from(e.children).forEach((c) => {
92
+ if (c instanceof HTMLLIElement) {
93
+ if (n.has(c)) {
94
+ i();
95
+ const u = v(c, t);
96
+ s.appendChild(u), o.push(u);
97
+ return;
98
+ }
99
+ a || (a = R(e)), a.appendChild(c);
100
+ }
101
+ }), i(), r.insertBefore(s, e), r.removeChild(e), o;
102
+ }
103
+ function _(e, n) {
104
+ var r;
105
+ if (e.tagName.toLowerCase() === n) return [e];
106
+ const t = d(n, e);
107
+ return p(e, t), t.innerHTML.trim() || (t.innerHTML = "<br>"), (r = e.parentNode) == null || r.replaceChild(t, e), [t];
108
+ }
109
+ function O(e, n) {
110
+ const t = e.parentNode;
111
+ if (!t) return [];
112
+ const r = document.createDocumentFragment(), s = [];
113
+ return Array.from(e.childNodes).forEach((o) => {
114
+ if (o instanceof HTMLElement && I(o)) {
115
+ o.remove();
116
+ return;
117
+ }
118
+ if (o instanceof HTMLUListElement || o instanceof HTMLOListElement) {
119
+ Array.from(o.children).forEach((i) => {
120
+ if (!(i instanceof HTMLLIElement)) return;
121
+ const c = v(i, n);
122
+ r.appendChild(c), s.push(c);
123
+ }), o.remove();
124
+ return;
125
+ }
126
+ if (o instanceof HTMLElement && g.has(o.tagName)) {
127
+ const i = d(n, o);
128
+ p(o, i), r.appendChild(i), s.push(i);
129
+ return;
130
+ }
131
+ if (o.nodeType === Node.TEXT_NODE && (o.textContent || "").trim() === "") {
132
+ o.remove();
133
+ return;
134
+ }
135
+ const a = d(n, e);
136
+ a.appendChild(o), r.appendChild(a), s.push(a);
137
+ }), t.insertBefore(r, e), t.removeChild(e), s;
138
+ }
139
+ function b(e) {
140
+ const n = window.getSelection();
141
+ if (!n) return;
142
+ const t = document.createRange(), r = e instanceof HTMLElement && e.querySelector("p,li,h1,h2,h3,h4,h5,h6") || e;
143
+ t.selectNodeContents(r), t.collapse(!0), n.removeAllRanges(), n.addRange(t);
144
+ }
145
+ function k(e) {
146
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
147
+ }
148
+ function D(e, n, t) {
149
+ const r = window.execEditorCommand;
150
+ if (typeof r == "function") {
151
+ r("recordDomTransaction", e, n, t);
152
+ return;
153
+ }
154
+ const s = window.executeEditorCommand;
155
+ typeof s == "function" && s("recordDomTransaction", { editor: e, beforeHTML: n, afterHTML: t });
156
+ }
157
+ function P(e, n) {
158
+ const t = /* @__PURE__ */ new Map();
159
+ return Array.from(e.querySelectorAll("li")).filter(
160
+ (s) => s instanceof HTMLLIElement && C(n, s)
161
+ ).forEach((s) => {
162
+ var a;
163
+ const o = s.parentElement;
164
+ (o instanceof HTMLUListElement || o instanceof HTMLOListElement) && o.parentElement === e && (t.has(o) || t.set(o, /* @__PURE__ */ new Set()), (a = t.get(o)) == null || a.add(s));
165
+ }), t;
166
+ }
167
+ function m(e, n) {
168
+ const t = e.toLowerCase();
169
+ if (!B.has(t)) return !1;
170
+ const r = S(n);
171
+ if (!r) return !1;
172
+ const s = N(r);
173
+ if (!s) return !1;
174
+ const o = r.innerHTML, a = [], i = P(r, s);
175
+ i.size > 0 ? i.forEach((u, l) => {
176
+ a.push(...L(l, u, t));
177
+ }) : w(r, s).forEach((l) => {
178
+ if (l instanceof HTMLUListElement || l instanceof HTMLOListElement) {
179
+ const h = new Set(Array.from(l.children).filter(
180
+ (M) => M instanceof HTMLLIElement
181
+ ));
182
+ a.push(...L(l, h, t));
183
+ return;
184
+ }
185
+ if (g.has(l.tagName)) {
186
+ const h = l.querySelector(":scope > ul, :scope > ol, :scope > blockquote, :scope > table");
187
+ a.push(
188
+ ...h ? O(l, t) : _(l, t)
189
+ );
190
+ }
191
+ });
192
+ const c = r.innerHTML;
193
+ return o === c || a.length === 0 ? !1 : (D(r, o, c), k(r), b(a[0]), !0);
194
+ }
195
+ const q = () => ({
196
+ name: "heading",
197
+ // Toolbar button configuration with dropdown
198
+ toolbar: [
199
+ {
200
+ label: "P",
201
+ command: "setBlockType",
202
+ type: "dropdown",
203
+ options: [
204
+ { value: "p", label: "P" },
205
+ { value: "h1", label: "H1" },
206
+ { value: "h2", label: "H2" },
207
+ { value: "h3", label: "H3" },
208
+ { value: "h4", label: "H4" },
209
+ { value: "h5", label: "H5" },
210
+ { value: "h6", label: "H6" }
211
+ ],
212
+ icon: '<svg width="24" height="24" focusable="false"><path d="M16.1 8.6 14.2 4l-1.4.5 2.8 7.4c.1.4.5.6.9.6h.1c.4-.1.6-.5.6-.9l1.8-4.8-1.4-.5-1.5 2.3ZM4 11.5h6V10H4v1.5ZM18.5 3v1L17 7l.9.9L20.7 3h-2.2ZM5.5 12h1v7h1v-7h1v-.5h-3V12Zm4 0h1v7h1v-7h1v-.5h-3V12Zm10 1.5a2 2 0 0 0-2-2h-1v7.5h1v-2.7h1a2 2 0 0 0 2-2v-.8Zm-2 1.3h-1v-2.3h1a.8.8 0 1 1 0 1.6v.7Z" fill-rule="evenodd"></path></svg>'
213
+ }
214
+ ],
215
+ // Native command implementations
216
+ commands: {
217
+ /**
218
+ * Set block type to specific heading level or paragraph
219
+ */
220
+ setBlockType: (e, n) => e ? m(e, n) : !1,
221
+ /**
222
+ * Set heading level 1
223
+ */
224
+ setHeading1: (e, n) => m("h1", n),
225
+ /**
226
+ * Set heading level 2
227
+ */
228
+ setHeading2: (e, n) => m("h2", n),
229
+ /**
230
+ * Set heading level 3
231
+ */
232
+ setHeading3: (e, n) => m("h3", n),
233
+ /**
234
+ * Set to paragraph
235
+ */
236
+ setParagraph: (e, n) => m("p", n)
237
+ },
238
+ // Keyboard shortcuts
239
+ keymap: {
240
+ "Mod-Alt-1": "setHeading1",
241
+ "Mod-Alt-2": "setHeading2",
242
+ "Mod-Alt-3": "setHeading3",
243
+ "Mod-Alt-0": "setParagraph"
244
+ }
245
+ });
246
+ export {
247
+ q as HeadingPlugin
248
+ };
249
+ //# sourceMappingURL=HeadingPlugin.native-DZdvubrQ.mjs.map