@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
@@ -1,4 +1,4 @@
1
- const E = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", fe = "__editoraCommandEditorRoot", he = "rte-doc-schema-styles", m = "rte-doc-schema-panel", v = "document-schema", T = "doc-schema", R = "docSchema", w = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Me = {
1
+ const E = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", fe = "__editoraCommandEditorRoot", he = "rte-doc-schema-styles", m = "rte-doc-schema-panel", v = "document-schema", T = "doc-schema", R = "docSchema", w = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ae = {
2
2
  panelTitle: "Document Schema",
3
3
  panelAriaLabel: "Document schema panel",
4
4
  schemaLabel: "Schema",
@@ -21,11 +21,11 @@ const E = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-ed
21
21
  unknownHeadingMessage: "Heading is not part of selected schema",
22
22
  insertedSummaryPrefix: "Inserted missing sections"
23
23
  }, u = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new Set();
24
- let W = 0, Ae = 0, ge = 0, k = null, y = null, q = null, z = null, B = null, H = null, K = null;
24
+ let W = 0, Le = 0, ge = 0, k = null, y = null, q = null, z = null, B = null, H = null, K = null;
25
25
  function M(e) {
26
26
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
27
27
  }
28
- function Le(e) {
28
+ function Oe(e) {
29
29
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
30
30
  }
31
31
  function P(e, t, n) {
@@ -85,11 +85,10 @@ function pe() {
85
85
  }
86
86
  ];
87
87
  }
88
- function Oe(e, t, n) {
88
+ function Re(e, t, n) {
89
89
  var f, h;
90
90
  const r = n(e.title || "");
91
- if (!r)
92
- return null;
91
+ if (!r) return null;
93
92
  const s = ye(n(e.id || r)) || `section-${t + 1}`, o = P(Number((f = e.minOccurrences) != null ? f : 1), 0, 20), a = Math.max(1, o), c = P(Number((h = e.maxOccurrences) != null ? h : a), o, 40), i = n(e.placeholder || ""), l = Array.isArray(e.aliases) ? e.aliases.map((b) => n(b)).filter(Boolean) : [], d = [r, ...l].map((b) => ce(b, n)).filter(Boolean);
94
93
  return {
95
94
  id: s,
@@ -104,8 +103,7 @@ function Se(e, t) {
104
103
  const n = Array.isArray(e) && e.length > 0 ? e : pe(), r = [], s = /* @__PURE__ */ new Set();
105
104
  return n.forEach((o, a) => {
106
105
  const c = t(o.label || "");
107
- if (!c)
108
- return;
106
+ if (!c) return;
109
107
  const i = ye(t(o.id || c)) || `schema-${a + 1}`;
110
108
  let l = i, d = 1;
111
109
  for (; s.has(l); )
@@ -113,18 +111,16 @@ function Se(e, t) {
113
111
  s.add(l);
114
112
  const f = Array.isArray(o.sections) ? o.sections : [], h = [], b = /* @__PURE__ */ new Set();
115
113
  if (f.forEach(($, g) => {
116
- const x = Oe($, g, t);
117
- if (!x)
118
- return;
119
- let N = x.id, Ie = 1;
114
+ const x = Re($, g, t);
115
+ if (!x) return;
116
+ let N = x.id, Me = 1;
120
117
  for (; b.has(N); )
121
- N = `${x.id}-${Ie++}`;
118
+ N = `${x.id}-${Me++}`;
122
119
  b.add(N), h.push({
123
120
  ...x,
124
121
  id: N
125
122
  });
126
- }), h.length === 0)
127
- return;
123
+ }), h.length === 0) return;
128
124
  const O = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
129
125
  h.forEach(($, g) => {
130
126
  A.set($.id, g), $.matchKeys.forEach((x) => {
@@ -144,7 +140,7 @@ function Se(e, t) {
144
140
  }
145
141
  function Z(e = {}) {
146
142
  var o, a, c;
147
- const t = e.normalizeText || Le, n = Se(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((i) => i.id === r) ? r : ((o = n[0]) == null ? void 0 : o.id) || null;
143
+ const t = e.normalizeText || Oe, n = Se(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((i) => i.id === r) ? r : ((o = n[0]) == null ? void 0 : o.id) || null;
148
144
  return {
149
145
  schemas: n,
150
146
  defaultSchemaId: s,
@@ -152,13 +148,13 @@ function Z(e = {}) {
152
148
  debounceMs: P(Number((a = e.debounceMs) != null ? a : 260), 60, 2e3),
153
149
  maxIssues: P(Number((c = e.maxIssues) != null ? c : 80), 5, 500),
154
150
  labels: {
155
- ...Me,
151
+ ...Ae,
156
152
  ...e.labels || {}
157
153
  },
158
154
  normalizeText: t
159
155
  };
160
156
  }
161
- function Re(e) {
157
+ function He(e) {
162
158
  return {
163
159
  schemas: e.schemas.map((t) => ({
164
160
  id: t.id,
@@ -186,33 +182,27 @@ function le(e) {
186
182
  return e.closest(ie) || e;
187
183
  }
188
184
  function U(e) {
189
- if (!e)
190
- return null;
191
- if (e.matches(E))
192
- return e;
185
+ if (!e) return null;
186
+ if (e.matches(E)) return e;
193
187
  const t = e.querySelector(E);
194
188
  return t instanceof HTMLElement ? t : null;
195
189
  }
196
- function He() {
197
- if (typeof window == "undefined")
198
- return null;
190
+ function De() {
191
+ if (typeof window == "undefined") return null;
199
192
  const e = window[fe];
200
- if (!(e instanceof HTMLElement))
201
- return null;
193
+ if (!(e instanceof HTMLElement)) return null;
202
194
  window[fe] = null;
203
195
  const t = U(e);
204
- if (t)
205
- return t;
196
+ if (t) return t;
206
197
  const n = e.closest(ie);
207
198
  if (n) {
208
199
  const s = U(n);
209
- if (s)
210
- return s;
200
+ if (s) return s;
211
201
  }
212
202
  const r = e.closest(E);
213
203
  return r instanceof HTMLElement ? r : null;
214
204
  }
215
- function De(e) {
205
+ function Ne(e) {
216
206
  const t = e.closest("[data-editora-editor]");
217
207
  if (t && U(t) === e)
218
208
  return t;
@@ -230,25 +220,23 @@ function xe(e) {
230
220
  function Y(e) {
231
221
  return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
232
222
  }
233
- function Ne(e) {
223
+ function Pe(e) {
234
224
  const t = le(e);
235
- if (Y(t))
236
- return !0;
225
+ if (Y(t)) return !0;
237
226
  const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
238
227
  return Y(n) ? !0 : Y(document.documentElement) || Y(document.body);
239
228
  }
240
229
  function oe(e, t) {
241
- e.classList.remove("rte-doc-schema-theme-dark"), Ne(t) && e.classList.add("rte-doc-schema-theme-dark");
230
+ e.classList.remove("rte-doc-schema-theme-dark"), Pe(t) && e.classList.add("rte-doc-schema-theme-dark");
242
231
  }
243
- function Pe(e) {
232
+ function _e(e) {
244
233
  var t, n, r, s;
245
234
  for (let o = 0; o < e.length; o += 1) {
246
235
  const a = e[o];
247
236
  if (!(a.type !== "childList" || a.removedNodes.length === 0))
248
237
  for (let c = 0; c < a.removedNodes.length; c += 1) {
249
238
  const i = a.removedNodes[c];
250
- if (i.nodeType !== Node.ELEMENT_NODE)
251
- continue;
239
+ if (i.nodeType !== Node.ELEMENT_NODE) continue;
252
240
  const l = i;
253
241
  if ((t = l.matches) != null && t.call(l, E) || (n = l.matches) != null && n.call(l, `.${m}`) || (r = l.querySelector) != null && r.call(l, E) || (s = l.querySelector) != null && s.call(l, `.${m}`))
254
242
  return !0;
@@ -263,68 +251,57 @@ function Q() {
263
251
  }
264
252
  function I(e, t = !0, n = !0) {
265
253
  var c;
266
- if (Q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
267
- return e.contentElement;
254
+ if (Q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
268
255
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
269
256
  const i = U(e.editorElement);
270
- if (i)
271
- return i;
257
+ if (i) return i;
272
258
  }
273
- const r = He();
274
- if (r)
275
- return r;
259
+ const r = De();
260
+ if (r) return r;
276
261
  const s = window.getSelection();
277
262
  if (s && s.rangeCount > 0) {
278
263
  const i = (c = xe(s.getRangeAt(0).startContainer)) == null ? void 0 : c.closest(
279
264
  E
280
265
  );
281
- if (i)
282
- return i;
266
+ if (i) return i;
283
267
  }
284
268
  const o = document.activeElement;
285
269
  if (o) {
286
- if (o.matches(E))
287
- return o;
270
+ if (o.matches(E)) return o;
288
271
  const i = o.closest(E);
289
- if (i)
290
- return i;
272
+ if (i) return i;
291
273
  }
292
274
  if (n && y && y.isConnected)
293
275
  return y;
294
- if (!t)
295
- return null;
276
+ if (!t) return null;
296
277
  const a = document.querySelector(E);
297
278
  return a instanceof HTMLElement ? a : null;
298
279
  }
299
- function _e(e) {
280
+ function qe(e) {
300
281
  const t = e.target;
301
282
  if (t) {
302
283
  const r = t.closest(`.${m}`);
303
284
  if (r) {
304
285
  const o = Array.from(S.entries()).find(([, a]) => a === r);
305
- if (o)
306
- return o[0];
286
+ if (o) return o[0];
307
287
  }
308
288
  const s = t.closest(E);
309
- if (s)
310
- return s;
289
+ if (s) return s;
311
290
  }
312
291
  const n = document.activeElement;
313
292
  if (n) {
314
293
  const r = n.closest(`.${m}`);
315
294
  if (r) {
316
295
  const o = Array.from(S.entries()).find(([, a]) => a === r);
317
- if (o)
318
- return o[0];
296
+ if (o) return o[0];
319
297
  }
320
298
  const s = n.closest(E);
321
- if (s)
322
- return s;
299
+ if (s) return s;
323
300
  }
324
301
  return null;
325
302
  }
326
303
  function be(e, t, n) {
327
- const r = De(e);
304
+ const r = Ne(e);
328
305
  Array.from(
329
306
  r.querySelectorAll(
330
307
  `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
@@ -369,8 +346,7 @@ function Ee(e) {
369
346
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
370
347
  }
371
348
  function se(e, t) {
372
- if (!t.classList.contains("show"))
373
- return;
349
+ if (!t.classList.contains("show")) return;
374
350
  const n = le(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 440), s = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, n.right - r), s), a = Math.max(10, Math.min(window.innerHeight - 10, n.top + 12));
375
351
  t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${a}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
376
352
  }
@@ -378,12 +354,11 @@ function ee(e, t) {
378
354
  const n = e.querySelector(".rte-doc-schema-live");
379
355
  n && (n.textContent = t);
380
356
  }
381
- function qe(e, t) {
357
+ function ze(e, t) {
382
358
  const n = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), r = [];
383
359
  return n.forEach((s, o) => {
384
360
  const a = t(s.textContent || "");
385
- if (!a)
386
- return;
361
+ if (!a) return;
387
362
  const c = Number(s.tagName.slice(1)) || 0, i = ce(a, t);
388
363
  r.push({
389
364
  text: a,
@@ -398,8 +373,7 @@ function ve(e, t, n) {
398
373
  return r.forEach((o) => {
399
374
  var f;
400
375
  const a = n(o.textContent || "");
401
- if (!a)
402
- return;
376
+ if (!a) return;
403
377
  const c = ce(a, n), i = c && t.matchKeyToSection.get(c) || null, l = i && (f = t.orderBySectionId.get(i.id)) != null ? f : null, d = P(Number(o.tagName.slice(1)) || 0, 1, 6);
404
378
  s.push({
405
379
  element: o,
@@ -409,10 +383,9 @@ function ve(e, t, n) {
409
383
  });
410
384
  }), s;
411
385
  }
412
- function ze(e, t = 2) {
386
+ function Be(e, t = 2) {
413
387
  const n = e.filter((i) => i.section).map((i) => i.level), r = n.length > 0 ? n : e.map((i) => i.level);
414
- if (r.length === 0)
415
- return t;
388
+ if (r.length === 0) return t;
416
389
  const s = /* @__PURE__ */ new Map();
417
390
  r.forEach((i, l) => {
418
391
  s.has(i) || s.set(i, { count: 0, firstIndex: l });
@@ -424,14 +397,12 @@ function ze(e, t = 2) {
424
397
  (i.count > a || i.count === a && i.firstIndex < c || i.count === a && i.firstIndex === c && l < o) && (o = l, a = i.count, c = i.firstIndex);
425
398
  }), P(o, 1, 6);
426
399
  }
427
- function Be(e) {
400
+ function Ke(e) {
428
401
  var o;
429
402
  const t = window.getSelection();
430
- if (!t || t.rangeCount === 0)
431
- return null;
403
+ if (!t || t.rangeCount === 0) return null;
432
404
  const n = t.getRangeAt(0);
433
- if (((o = xe(n.startContainer)) == null ? void 0 : o.closest(E)) !== e)
434
- return null;
405
+ if (((o = xe(n.startContainer)) == null ? void 0 : o.closest(E)) !== e) return null;
435
406
  if (n.startContainer.nodeType === Node.ELEMENT_NODE) {
436
407
  const a = n.startContainer, c = a.childNodes[n.startOffset] || null;
437
408
  return { parent: a, referenceNode: c };
@@ -442,7 +413,7 @@ function Be(e) {
442
413
  referenceNode: n.startContainer.nextSibling || null
443
414
  } : null;
444
415
  }
445
- function Ke(e, t, n, r) {
416
+ function Ve(e, t, n, r) {
446
417
  var i;
447
418
  const s = ve(e, n, r), o = n.orderBySectionId.get(t.id);
448
419
  if (typeof o != "number" || s.length === 0)
@@ -467,7 +438,7 @@ function Ke(e, t, n, r) {
467
438
  }
468
439
  return { parent: e, referenceNode: null };
469
440
  }
470
- function Ve(e, t, n, r) {
441
+ function je(e, t, n, r) {
471
442
  const s = e.ownerDocument || document, o = `h${P(r, 1, 6)}`, a = s.createElement(o);
472
443
  a.setAttribute("data-doc-schema-section", t.id), a.textContent = t.title;
473
444
  const c = s.createElement("p");
@@ -485,13 +456,12 @@ function V(e, t, n, r = {}) {
485
456
  function J(e, t, n) {
486
457
  return e.replace(/\{section\}/g, t || "").replace(/\{heading\}/g, n || "").trim();
487
458
  }
488
- function je(e, t, n) {
459
+ function Ue(e, t, n) {
489
460
  var i;
490
- const r = qe(e, n.normalizeText), s = [], o = /* @__PURE__ */ new Map(), a = [];
461
+ const r = ze(e, n.normalizeText), s = [], o = /* @__PURE__ */ new Map(), a = [];
491
462
  for (let l = 0; l < r.length && !(s.length >= n.maxIssues); l += 1) {
492
463
  const d = r[l];
493
- if (!d.key)
494
- continue;
464
+ if (!d.key) continue;
495
465
  const f = t.matchKeyToSection.get(d.key);
496
466
  if (f) {
497
467
  o.set(f.id, (o.get(f.id) || 0) + 1), a.push({ section: f, heading: d });
@@ -581,11 +551,9 @@ function D(e) {
581
551
  }
582
552
  function _(e) {
583
553
  const t = S.get(e);
584
- if (!t)
585
- return;
554
+ if (!t) return;
586
555
  const n = u.get(e) || k;
587
- if (!n)
588
- return;
556
+ if (!n) return;
589
557
  const r = p(e, n), s = L(n, r.activeSchemaId), o = t.querySelector(".rte-doc-schema-label");
590
558
  o && (o.textContent = n.labels.schemaLabel);
591
559
  const a = t.querySelector('[data-field="schema"]');
@@ -632,7 +600,7 @@ function G(e, t = !1) {
632
600
  n && (n.classList.remove("show"), F.set(e, !1), D(e), t && e.focus({ preventScroll: !0 }));
633
601
  }
634
602
  function ae(e) {
635
- const t = Fe(e);
603
+ const t = We(e);
636
604
  S.forEach((r, s) => {
637
605
  s !== e && G(s, !1);
638
606
  }), t.classList.add("show"), F.set(e, !0), _(e), se(e, t), D(e);
@@ -643,9 +611,8 @@ function ke(e, t) {
643
611
  const n = me(e);
644
612
  return (typeof t == "boolean" ? t : !n) ? ae(e) : G(e, !1), !0;
645
613
  }
646
- function Ue(e, t) {
647
- if (t === e.innerHTML)
648
- return;
614
+ function Ge(e, t) {
615
+ if (t === e.innerHTML) return;
649
616
  const n = window.execEditorCommand || window.executeEditorCommand;
650
617
  if (typeof n == "function")
651
618
  try {
@@ -653,13 +620,12 @@ function Ue(e, t) {
653
620
  } catch (r) {
654
621
  }
655
622
  }
656
- function Ge(e) {
623
+ function Fe(e) {
657
624
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
658
625
  }
659
626
  function C(e, t, n) {
660
627
  const r = u.get(e) || k;
661
- if (!r)
662
- return [];
628
+ if (!r) return [];
663
629
  const s = p(e, r), o = S.get(e), a = e.innerHTML;
664
630
  if (!n && s.snapshot === a)
665
631
  return s.issues;
@@ -670,7 +636,7 @@ function C(e, t, n) {
670
636
  suggestion: "Set `defaultSchemaId` or update schema options."
671
637
  })
672
638
  ], s.headingCount = 0, s.recognizedHeadingCount = 0, s.missingCount = 1, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), s.issues;
673
- const i = je(e, c, r);
639
+ const i = Ue(e, c, r);
674
640
  return s.issues = i.issues, s.headingCount = i.headingCount, s.recognizedHeadingCount = i.recognizedHeadingCount, s.missingCount = i.missingCount, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), e.dispatchEvent(
675
641
  new CustomEvent("editora:doc-schema-validation", {
676
642
  bubbles: !0,
@@ -686,8 +652,7 @@ function C(e, t, n) {
686
652
  }
687
653
  function $e(e) {
688
654
  const t = u.get(e) || k;
689
- if (!t)
690
- return;
655
+ if (!t) return;
691
656
  de(e);
692
657
  const n = window.setTimeout(() => {
693
658
  te.delete(e), C(e, "realtime", !1);
@@ -696,21 +661,18 @@ function $e(e) {
696
661
  }
697
662
  function Ce(e, t) {
698
663
  const n = u.get(e) || k;
699
- if (!n)
700
- return !1;
664
+ if (!n) return !1;
701
665
  const r = p(e, n), s = typeof t == "boolean" ? t : !r.realtimeEnabled;
702
666
  return r.realtimeEnabled = s, s ? $e(e) : de(e), _(e), D(e), !0;
703
667
  }
704
668
  function Te(e) {
705
669
  const t = u.get(e) || k;
706
- if (!t)
707
- return !1;
670
+ if (!t) return !1;
708
671
  const n = p(e, t), r = S.get(e);
709
672
  if (Ee(e))
710
673
  return r && ee(r, t.labels.readonlyMessage), !1;
711
674
  const s = L(t, n.activeSchemaId);
712
- if (!s)
713
- return !1;
675
+ if (!s) return !1;
714
676
  C(e, "insert-missing-pre", !0);
715
677
  const o = Array.from(
716
678
  new Set(
@@ -719,11 +681,11 @@ function Te(e) {
719
681
  ), a = s.sections.filter((h) => o.includes(h.id));
720
682
  if (a.length === 0)
721
683
  return r && ee(r, t.labels.noIssuesText), !1;
722
- const c = e.innerHTML, i = ve(e, s, t.normalizeText), l = ze(i, 2), d = Be(e);
684
+ const c = e.innerHTML, i = ve(e, s, t.normalizeText), l = Be(i, 2), d = Ke(e);
723
685
  a.forEach((h) => {
724
- const b = s.strictOrder ? Ke(e, h, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = Ve(e, h, t, l);
686
+ const b = s.strictOrder ? Ve(e, h, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = je(e, h, t, l);
725
687
  b.parent.insertBefore(O, b.referenceNode), b.parent.insertBefore(A, b.referenceNode);
726
- }), Ue(e, c), Ge(e), C(e, "insert-missing-post", !0);
688
+ }), Ge(e, c), Fe(e), C(e, "insert-missing-post", !0);
727
689
  const f = a.map((h) => h.title).join(", ");
728
690
  return e.dispatchEvent(
729
691
  new CustomEvent("editora:doc-schema-insert-missing", {
@@ -735,13 +697,12 @@ function Te(e) {
735
697
  })
736
698
  ), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${f}`), !0;
737
699
  }
738
- function Fe(e) {
700
+ function We(e) {
739
701
  const t = S.get(e);
740
- if (t)
741
- return t;
702
+ if (t) return t;
742
703
  const n = u.get(e) || k || Z();
743
704
  p(e, n);
744
- const r = `rte-doc-schema-panel-${Ae++}`, s = `${r}-schema`, o = document.createElement("section");
705
+ const r = `rte-doc-schema-panel-${Le++}`, s = `${r}-schema`, o = document.createElement("section");
745
706
  return o.className = m, o.id = r, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.innerHTML = `
746
707
  <header class="rte-doc-schema-header">
747
708
  <h2 class="rte-doc-schema-title">${M(n.labels.panelTitle)}</h2>
@@ -769,8 +730,7 @@ function Fe(e) {
769
730
  <div class="rte-doc-schema-live" aria-live="polite" aria-atomic="true"></div>
770
731
  `, o.addEventListener("click", (a) => {
771
732
  const c = a.target, i = c == null ? void 0 : c.closest("[data-action]");
772
- if (!i)
773
- return;
733
+ if (!i) return;
774
734
  const l = i.getAttribute("data-action");
775
735
  if (l === "close") {
776
736
  G(e, !0);
@@ -787,77 +747,72 @@ function Fe(e) {
787
747
  l === "toggle-realtime" && Ce(e);
788
748
  }), o.addEventListener("change", (a) => {
789
749
  const c = a.target;
790
- if (!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "schema")
791
- return;
750
+ if (!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "schema") return;
792
751
  const i = u.get(e) || k;
793
- if (!i)
794
- return;
752
+ if (!i) return;
795
753
  const l = p(e, i), d = c.value;
796
754
  L(i, d) && (l.activeSchemaId = d, l.snapshot = "", C(e, "schema-change", !0));
797
755
  }), o.addEventListener("keydown", (a) => {
798
756
  a.key === "Escape" && (a.preventDefault(), G(e, !0));
799
757
  }), oe(o, e), document.body.appendChild(o), S.set(e, o), F.set(e, !1), _(e), o;
800
758
  }
801
- function We(e) {
802
- const t = e.key.toLowerCase();
803
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
759
+ function Ie(e) {
760
+ return typeof e.key == "string" ? e.key.toLowerCase() : "";
804
761
  }
805
762
  function Ye(e) {
806
- const t = e.key.toLowerCase();
807
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "j";
763
+ const t = Ie(e);
764
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
808
765
  }
809
766
  function Je(e) {
767
+ const t = Ie(e);
768
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "j";
769
+ }
770
+ function Xe(e) {
810
771
  k = e, q || (q = (t) => {
811
772
  Q();
812
773
  const n = t.target, r = n == null ? void 0 : n.closest(E);
813
- if (!r)
814
- return;
774
+ if (!r) return;
815
775
  const s = u.get(r) || e;
816
776
  p(r, s), u.set(r, s), y = r, D(r);
817
777
  const o = S.get(r);
818
778
  o && (oe(o, r), se(r, o), _(r));
819
779
  }, document.addEventListener("focusin", q, !0)), z || (z = (t) => {
820
780
  const n = t.target, r = n == null ? void 0 : n.closest(E);
821
- if (!r)
822
- return;
781
+ if (!r) return;
823
782
  const s = u.get(r) || k;
824
783
  !s || !p(r, s).realtimeEnabled || $e(r);
825
784
  }, document.addEventListener("input", z, !0)), B || (B = (t) => {
826
- if (t.defaultPrevented)
827
- return;
785
+ if (t.defaultPrevented) return;
828
786
  const n = t.target;
829
- if (n != null && n.closest(`.${m}`) && t.key !== "Escape")
830
- return;
831
- const r = _e(t);
832
- if (!r)
833
- return;
787
+ if (n != null && n.closest(`.${m}`) && t.key !== "Escape") return;
788
+ const r = qe(t);
789
+ if (!r) return;
834
790
  const s = u.get(r) || k || e;
835
791
  if (p(r, s), u.set(r, s), y = r, t.key === "Escape" && me(r)) {
836
792
  t.preventDefault(), G(r, !0);
837
793
  return;
838
794
  }
839
- if (We(t)) {
795
+ if (Ye(t)) {
840
796
  t.preventDefault(), t.stopPropagation(), ke(r);
841
797
  return;
842
798
  }
843
- Ye(t) && (t.preventDefault(), t.stopPropagation(), C(r, "shortcut", !0));
799
+ Je(t) && (t.preventDefault(), t.stopPropagation(), C(r, "shortcut", !0));
844
800
  }, document.addEventListener("keydown", B, !0)), H || (H = () => {
845
801
  Q(), S.forEach((t, n) => {
846
802
  !n.isConnected || !t.isConnected || (oe(t, n), se(n, t));
847
803
  });
848
804
  }, window.addEventListener("scroll", H, !0), window.addEventListener("resize", H)), !K && typeof MutationObserver != "undefined" && document.body && (K = new MutationObserver((t) => {
849
- Pe(t) && Q();
805
+ _e(t) && Q();
850
806
  }), K.observe(document.body, {
851
807
  childList: !0,
852
808
  subtree: !0
853
809
  }));
854
810
  }
855
- function Xe() {
811
+ function Ze() {
856
812
  q && (document.removeEventListener("focusin", q, !0), q = null), z && (document.removeEventListener("input", z, !0), z = null), B && (document.removeEventListener("keydown", B, !0), B = null), H && (window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", H), H = null), K && (K.disconnect(), K = null), S.forEach((t) => t.remove()), S.clear(), Array.from(ne).forEach((t) => ue(t)), k = null, y = null;
857
813
  }
858
- function Ze() {
859
- if (typeof document == "undefined" || document.getElementById(he))
860
- return;
814
+ function Qe() {
815
+ if (typeof document == "undefined" || document.getElementById(he)) return;
861
816
  const e = document.createElement("style");
862
817
  e.id = he, e.textContent = `
863
818
  .rte-toolbar-group-items.${v},
@@ -1230,9 +1185,9 @@ function Ze() {
1230
1185
  }
1231
1186
  `, document.head.appendChild(e);
1232
1187
  }
1233
- const Qe = (e = {}) => {
1188
+ const et = (e = {}) => {
1234
1189
  const t = Z(e), n = /* @__PURE__ */ new Set();
1235
- return Ze(), {
1190
+ return Qe(), {
1236
1191
  name: "docSchema",
1237
1192
  toolbar: [
1238
1193
  {
@@ -1267,50 +1222,43 @@ const Qe = (e = {}) => {
1267
1222
  commands: {
1268
1223
  docSchema: (r, s) => {
1269
1224
  const o = I(s, !1, !1);
1270
- if (!o)
1271
- return !1;
1225
+ if (!o) return !1;
1272
1226
  const a = u.get(o) || t;
1273
1227
  return p(o, a), u.set(o, a), y = o, ae(o), !0;
1274
1228
  },
1275
1229
  openDocSchemaPanel: (r, s) => {
1276
1230
  const o = I(s, !1, !1);
1277
- if (!o)
1278
- return !1;
1231
+ if (!o) return !1;
1279
1232
  const a = u.get(o) || t;
1280
1233
  return p(o, a), u.set(o, a), y = o, ae(o), !0;
1281
1234
  },
1282
1235
  toggleDocSchemaPanel: (r, s) => {
1283
1236
  const o = I(s, !1, !1);
1284
- if (!o)
1285
- return !1;
1237
+ if (!o) return !1;
1286
1238
  const a = u.get(o) || t;
1287
1239
  return p(o, a), u.set(o, a), y = o, ke(o, typeof r == "boolean" ? r : void 0);
1288
1240
  },
1289
1241
  runDocSchemaValidation: (r, s) => {
1290
1242
  const o = I(s, !1, !1);
1291
- if (!o)
1292
- return !1;
1243
+ if (!o) return !1;
1293
1244
  const a = u.get(o) || t;
1294
1245
  return p(o, a), u.set(o, a), y = o, C(o, "command", !0), !0;
1295
1246
  },
1296
1247
  insertMissingDocSchemaSections: (r, s) => {
1297
1248
  const o = I(s, !1, !1);
1298
- if (!o)
1299
- return !1;
1249
+ if (!o) return !1;
1300
1250
  const a = u.get(o) || t;
1301
1251
  return p(o, a), u.set(o, a), y = o, Te(o);
1302
1252
  },
1303
1253
  toggleDocSchemaRealtime: (r, s) => {
1304
1254
  const o = I(s, !1, !1);
1305
- if (!o)
1306
- return !1;
1255
+ if (!o) return !1;
1307
1256
  const a = u.get(o) || t;
1308
1257
  return p(o, a), u.set(o, a), y = o, Ce(o, typeof r == "boolean" ? r : void 0);
1309
1258
  },
1310
1259
  setDocSchemaMode: (r, s) => {
1311
1260
  const o = I(s, !1, !1);
1312
- if (!o)
1313
- return !1;
1261
+ if (!o) return !1;
1314
1262
  const a = u.get(o) || t, c = p(o, a);
1315
1263
  u.set(o, a);
1316
1264
  const i = typeof r == "string" ? r : (r == null ? void 0 : r.schemaId) || (r == null ? void 0 : r.id);
@@ -1318,9 +1266,8 @@ const Qe = (e = {}) => {
1318
1266
  },
1319
1267
  setDocSchemaOptions: (r, s) => {
1320
1268
  const o = I(s, !1, !1);
1321
- if (!o || !r || typeof r != "object")
1322
- return !1;
1323
- const a = u.get(o) || t, c = X.get(o) || Re(a), i = {
1269
+ if (!o || !r || typeof r != "object") return !1;
1270
+ const a = u.get(o) || t, c = X.get(o) || He(a), i = {
1324
1271
  ...c,
1325
1272
  ...r,
1326
1273
  labels: {
@@ -1336,8 +1283,7 @@ const Qe = (e = {}) => {
1336
1283
  },
1337
1284
  getDocSchemaState: (r, s) => {
1338
1285
  const o = I(s, !1, !1);
1339
- if (!o)
1340
- return !1;
1286
+ if (!o) return !1;
1341
1287
  const a = u.get(o) || t;
1342
1288
  p(o, a);
1343
1289
  const c = we(o);
@@ -1363,7 +1309,7 @@ const Qe = (e = {}) => {
1363
1309
  init: function(s) {
1364
1310
  W += 1;
1365
1311
  const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Z(o);
1366
- Je(a);
1312
+ Xe(a);
1367
1313
  const c = I(
1368
1314
  s != null && s.editorElement ? { editorElement: s.editorElement } : void 0,
1369
1315
  !1,
@@ -1372,11 +1318,11 @@ const Qe = (e = {}) => {
1372
1318
  c && (y = c, n.add(c), p(c, a), u.set(c, a), X.set(c, o), D(c), C(c, "init", !0));
1373
1319
  },
1374
1320
  destroy: () => {
1375
- n.forEach((r) => ue(r)), n.clear(), W = Math.max(0, W - 1), !(W > 0) && Xe();
1321
+ n.forEach((r) => ue(r)), n.clear(), W = Math.max(0, W - 1), !(W > 0) && Ze();
1376
1322
  }
1377
1323
  };
1378
1324
  };
1379
1325
  export {
1380
- Qe as DocSchemaPlugin
1326
+ et as DocSchemaPlugin
1381
1327
  };
1382
- //# sourceMappingURL=DocSchemaPlugin.native-8e41eda0.mjs.map
1328
+ //# sourceMappingURL=DocSchemaPlugin.native-DUSVRHqT.mjs.map