@editora/core 1.0.15 → 1.0.16

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 (68) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-B1_vtXRz.mjs +3910 -0
  48. package/dist/index-C6BoNR2t.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2039 -473
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2208 -641
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -1,4 +1,4 @@
1
- function O(e, t) {
1
+ function H(e, t) {
2
2
  const o = Array.from({ length: t }).map(() => "<th><p><br></p></th>").join(""), n = Array.from({ length: e }).map(
3
3
  () => `<tr>${Array.from({ length: t }).map(() => "<td><p><br></p></td>").join("")}</tr>`
4
4
  ).join("");
@@ -59,7 +59,7 @@ function q() {
59
59
  id: "table-3x3",
60
60
  label: "Table 3x3",
61
61
  description: "Insert a 3 x 3 table",
62
- action: ({ insertHTML: e }) => e(O(3, 3)),
62
+ action: ({ insertHTML: e }) => e(H(3, 3)),
63
63
  keywords: ["table", "grid", "rows", "columns"]
64
64
  },
65
65
  {
@@ -207,31 +207,37 @@ function B() {
207
207
  padding: 12px;
208
208
  }
209
209
 
210
- ${u} .rte-slash-panel {
210
+ ${u} .rte-slash-panel,
211
+ .rte-slash-panel.rte-slash-theme-dark {
211
212
  border-color: #364152;
212
213
  background: #1f2937;
213
214
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.48);
214
215
  }
215
216
 
216
- ${u} .rte-slash-item {
217
+ ${u} .rte-slash-item,
218
+ .rte-slash-panel.rte-slash-theme-dark .rte-slash-item {
217
219
  color: #e5e7eb;
218
220
  }
219
221
 
220
222
  ${u} .rte-slash-item:hover,
221
- ${u} .rte-slash-item.active {
223
+ ${u} .rte-slash-item.active,
224
+ .rte-slash-panel.rte-slash-theme-dark .rte-slash-item:hover,
225
+ .rte-slash-panel.rte-slash-theme-dark .rte-slash-item.active {
222
226
  background: #334155;
223
227
  color: #bfdbfe;
224
228
  }
225
229
 
226
230
  ${u} .rte-slash-item-description,
227
- ${u} .rte-slash-empty {
231
+ ${u} .rte-slash-empty,
232
+ .rte-slash-panel.rte-slash-theme-dark .rte-slash-item-description,
233
+ .rte-slash-panel.rte-slash-theme-dark .rte-slash-empty {
228
234
  color: #9ca3af;
229
235
  }
230
236
  `, document.head.appendChild(e);
231
237
  }
232
- const s = ".rte-content, .editora-content", g = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap();
233
- let b = !1, f = null, h = 0, z = 0;
234
- function P(e) {
238
+ const c = ".rte-content, .editora-content", z = '[data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark', g = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap();
239
+ let b = !1, f = null, h = 0, P = 0;
240
+ function _(e) {
235
241
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
236
242
  }
237
243
  function I(e) {
@@ -241,27 +247,27 @@ function F(e) {
241
247
  if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
242
248
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
243
249
  const n = e.editorElement;
244
- if (n.matches(s)) return n;
245
- const r = n.querySelector(s);
250
+ if (n.matches(c)) return n;
251
+ const r = n.querySelector(c);
246
252
  if (r instanceof HTMLElement) return r;
247
253
  }
248
254
  const t = window.getSelection();
249
255
  if (t && t.rangeCount > 0) {
250
- const n = t.getRangeAt(0).startContainer, r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, i = r == null ? void 0 : r.closest(s);
256
+ const n = t.getRangeAt(0).startContainer, r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, i = r == null ? void 0 : r.closest(c);
251
257
  if (i) return i;
252
258
  }
253
259
  const o = document.activeElement;
254
260
  if (o) {
255
- if (o.matches(s)) return o;
256
- const n = o.closest(s);
261
+ if (o.matches(c)) return o;
262
+ const n = o.closest(c);
257
263
  if (n) return n;
258
264
  }
259
- return document.querySelector(s);
265
+ return document.querySelector(c);
260
266
  }
261
267
  function m(e) {
262
268
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
263
269
  }
264
- function _(e) {
270
+ function j(e) {
265
271
  return e ? /\s|[([{"'`]/.test(e) : !0;
266
272
  }
267
273
  function E(e) {
@@ -274,7 +280,7 @@ function y(e, t) {
274
280
  const o = window.getSelection();
275
281
  o && (o.removeAllRanges(), o.addRange(t), e.focus({ preventScroll: !0 }));
276
282
  }
277
- function j(e) {
283
+ function K(e) {
278
284
  if (!e.collapsed) return null;
279
285
  const t = e.startContainer, o = e.startOffset;
280
286
  if (t.nodeType === Node.TEXT_NODE) {
@@ -301,9 +307,9 @@ function j(e) {
301
307
  }
302
308
  return null;
303
309
  }
304
- function K(e, t, o, n) {
310
+ function Q(e, t, o, n) {
305
311
  const r = e.lastIndexOf(t);
306
- if (r < 0 || n && !_(e[r - 1]))
312
+ if (r < 0 || n && !j(e[r - 1]))
307
313
  return null;
308
314
  const i = e.slice(r + 1);
309
315
  return /\s/.test(i) || i.length > o ? null : {
@@ -312,7 +318,7 @@ function K(e, t, o, n) {
312
318
  startOffset: r
313
319
  };
314
320
  }
315
- function Q(e, t) {
321
+ function U(e, t) {
316
322
  const o = t.cloneRange();
317
323
  o.collapse(!1);
318
324
  const n = o.getClientRects();
@@ -325,10 +331,10 @@ function Q(e, t) {
325
331
  }
326
332
  function A(e, t) {
327
333
  if (!e.panel) return;
328
- const o = Q(e.editor, t), n = e.panel;
329
- n.style.display = "block", n.classList.add("show"), n.style.left = "0px", n.style.top = "0px";
330
- const r = n.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight;
331
- let l = Math.max(8, Math.min(o.left, i - r.width - 8)), d = o.bottom + 8;
334
+ const o = U(e.editor, t), n = e.panel;
335
+ n.classList.toggle("rte-slash-theme-dark", !!e.editor.closest(z)), n.style.display = "block", n.classList.add("show"), n.style.left = "0px", n.style.top = "0px";
336
+ const r = n.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight, l = Math.max(8, Math.min(o.left, i - r.width - 8));
337
+ let d = o.bottom + 8;
332
338
  d + r.height > a - 8 && (d = Math.max(8, o.top - r.height - 8)), n.style.position = "fixed", n.style.left = `${l}px`, n.style.top = `${d}px`;
333
339
  }
334
340
  function k(e, t) {
@@ -338,7 +344,7 @@ function k(e, t) {
338
344
  const i = m(e.slice(0, r)), a = m(e.slice(r, r + t.length)), l = m(e.slice(r + t.length));
339
345
  return `${i}<mark>${a}</mark>${l}`;
340
346
  }
341
- function U(e, t) {
347
+ function W(e, t) {
342
348
  if (e.panel && e.list) return;
343
349
  const o = document.createElement("div");
344
350
  o.className = "rte-slash-panel", o.style.display = "none", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false");
@@ -351,13 +357,13 @@ function U(e, t) {
351
357
  const a = i.closest(".rte-slash-item");
352
358
  if (!a) return;
353
359
  const l = Number(a.getAttribute("data-index"));
354
- Number.isFinite(l) && M(e, l);
360
+ Number.isFinite(l) && N(e, l);
355
361
  });
356
362
  }
357
- function c(e) {
363
+ function s(e) {
358
364
  e.panel && (e.panel.style.display = "none", e.panel.classList.remove("show"), e.isOpen = !1, e.filteredItems = [], e.activeIndex = 0, e.query = "", e.replaceRange = null, e.anchorRange = null);
359
365
  }
360
- function W(e, t, o) {
366
+ function Z(e, t, o) {
361
367
  if (!t) return e.slice(0, o);
362
368
  const n = t.toLowerCase();
363
369
  return e.filter((i) => [
@@ -368,7 +374,7 @@ function W(e, t, o) {
368
374
  ...i.keywords || []
369
375
  ].join(" ").toLowerCase().includes(n)).slice(0, o);
370
376
  }
371
- function Z(e, t) {
377
+ function G(e, t) {
372
378
  if (!e.list) return;
373
379
  const o = e.list;
374
380
  if (o.innerHTML = "", e.filteredItems.length === 0) {
@@ -384,7 +390,7 @@ function Z(e, t) {
384
390
  `, o.appendChild(i);
385
391
  }), e.filteredItems.length > 0 && o.setAttribute("aria-activedescendant", `rte-slash-item-${e.instanceId}-${e.activeIndex}`);
386
392
  }
387
- function G(e, t) {
393
+ function V(e, t) {
388
394
  if (t === e.innerHTML) return;
389
395
  const o = window.execEditorCommand || window.executeEditorCommand;
390
396
  if (typeof o == "function")
@@ -393,7 +399,7 @@ function G(e, t) {
393
399
  } catch (n) {
394
400
  }
395
401
  }
396
- function V(e) {
402
+ function X(e) {
397
403
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
398
404
  }
399
405
  function L(e, t) {
@@ -417,7 +423,7 @@ function L(e, t) {
417
423
  }
418
424
  return !0;
419
425
  }
420
- function X(e, t) {
426
+ function J(e, t) {
421
427
  e.focus({ preventScroll: !0 });
422
428
  try {
423
429
  if (document.execCommand("insertText", !1, t))
@@ -434,7 +440,7 @@ function X(e, t) {
434
440
  const i = document.createRange();
435
441
  return i.setStart(r, r.length), i.collapse(!0), y(e, i), !0;
436
442
  }
437
- function J(e, t) {
443
+ function Y(e, t) {
438
444
  switch (e.toLowerCase()) {
439
445
  case "paragraph":
440
446
  case "p":
@@ -502,9 +508,9 @@ function S(e, t, o) {
502
508
  }) !== !1) return !0;
503
509
  } catch (i) {
504
510
  }
505
- return J(t, o);
511
+ return Y(t, o);
506
512
  }
507
- async function Y(e, t) {
513
+ async function ee(e, t) {
508
514
  const o = e.editor, n = I(o), r = {
509
515
  editor: o,
510
516
  editorRoot: n,
@@ -515,7 +521,7 @@ async function Y(e, t) {
515
521
  };
516
522
  return t.action ? await Promise.resolve(t.action(r)) !== !1 : t.insertHTML ? L(o, t.insertHTML) : t.command ? S(o, t.command, t.commandValue) : !1;
517
523
  }
518
- async function M(e, t) {
524
+ async function N(e, t) {
519
525
  if (t < 0 || t >= e.filteredItems.length || !e.replaceRange) return;
520
526
  const o = e.filteredItems[t], n = e.editor, r = n.innerHTML, i = `${e.trigger}${e.query}`;
521
527
  if (!window.getSelection()) return;
@@ -526,11 +532,11 @@ async function M(e, t) {
526
532
  d.collapse(!0), y(n, d);
527
533
  let x = !1;
528
534
  try {
529
- x = await Y(e, o);
530
- } catch (le) {
535
+ x = await ee(e, o);
536
+ } catch (se) {
531
537
  x = !1;
532
538
  }
533
- c(e), x ? (V(n), G(n, r)) : i && X(n, i), n.focus({ preventScroll: !0 });
539
+ s(e), x ? (X(n), V(n, r)) : i && J(n, i), n.focus({ preventScroll: !0 });
534
540
  }
535
541
  function R(e, t) {
536
542
  if (e.filteredItems.length === 0) return;
@@ -547,61 +553,64 @@ function R(e, t) {
547
553
  function T(e) {
548
554
  if (!(!e.isOpen || !e.panel || !e.anchorRange)) {
549
555
  if (!e.editor.isConnected) {
550
- c(e);
556
+ s(e);
551
557
  return;
552
558
  }
553
559
  A(e, e.anchorRange);
554
560
  }
555
561
  }
556
- function N(e, t, o, n, r, i) {
557
- U(e, t), e.query = n, e.trigger = r, e.replaceRange = i.cloneRange(), e.anchorRange = o.cloneRange(), e.filteredItems = W(e.items, n, t.maxSuggestions), e.activeIndex = 0, e.isOpen = !0, e.panel && (Z(e, t), A(e, o));
562
+ function M(e, t, o, n, r, i) {
563
+ W(e, t), e.query = n, e.trigger = r, e.replaceRange = i.cloneRange(), e.anchorRange = o.cloneRange(), e.filteredItems = Z(e.items, n, t.maxSuggestions), e.activeIndex = 0, e.isOpen = !0, e.panel && (G(e, t), A(e, o));
558
564
  }
559
- function ee(e, t) {
565
+ function te(e, t) {
560
566
  const o = e.editor;
561
567
  if (o.getAttribute("contenteditable") === "false") {
562
- c(e);
568
+ s(e);
563
569
  return;
564
570
  }
565
571
  const n = E(o);
566
572
  if (!n || !n.collapsed) {
567
- c(e);
573
+ s(e);
568
574
  return;
569
575
  }
570
- const r = j(n);
576
+ const r = K(n);
571
577
  if (!r) {
572
- c(e);
578
+ s(e);
573
579
  return;
574
580
  }
575
- const i = K(
581
+ const i = Q(
576
582
  r.textBefore,
577
583
  t.triggerChar,
578
584
  t.maxQueryLength,
579
585
  t.requireBoundary
580
586
  );
581
587
  if (!i) {
582
- c(e);
588
+ s(e);
583
589
  return;
584
590
  }
585
591
  if (i.query.length < t.minChars) {
586
- c(e);
592
+ s(e);
587
593
  return;
588
594
  }
595
+ if (e.dismissedNode === r.node && e.dismissedOffset === i.startOffset)
596
+ return;
597
+ e.dismissedNode = null, e.dismissedOffset = -1;
589
598
  const a = n.cloneRange();
590
- a.setStart(r.node, i.startOffset), a.setEnd(r.node, r.caretOffset), N(e, t, n, i.query, i.trigger, a);
599
+ a.setStart(r.node, i.startOffset), a.setEnd(r.node, r.caretOffset), M(e, t, n, i.query, i.trigger, a);
591
600
  }
592
- function H(e, t) {
601
+ function O(e, t) {
593
602
  const o = e.editor;
594
603
  if (o.getAttribute("contenteditable") === "false")
595
604
  return !1;
596
605
  let n = E(o);
597
606
  n || (n = document.createRange(), n.selectNodeContents(o), n.collapse(!1), y(o, n));
598
607
  const r = n.cloneRange();
599
- return r.collapse(!0), N(e, t, n, "", t.triggerChar, r), !0;
608
+ return r.collapse(!0), M(e, t, n, "", t.triggerChar, r), !0;
600
609
  }
601
- function te(e) {
610
+ function ne(e) {
602
611
  return !(e.metaKey || e.ctrlKey) || e.altKey ? !1 : e.key === "/" || e.code === "Slash";
603
612
  }
604
- function ne(e, t) {
613
+ function re(e, t) {
605
614
  return {
606
615
  editor: e,
607
616
  panel: null,
@@ -613,18 +622,20 @@ function ne(e, t) {
613
622
  query: "",
614
623
  trigger: t.triggerChar,
615
624
  isOpen: !1,
616
- instanceId: ++z,
617
- anchorRange: null
625
+ instanceId: ++P,
626
+ anchorRange: null,
627
+ dismissedNode: null,
628
+ dismissedOffset: -1
618
629
  };
619
630
  }
620
631
  function w(e, t) {
621
632
  const o = g.get(e);
622
633
  if (o)
623
634
  return o.items = t.items, o;
624
- const n = ne(e, t);
635
+ const n = re(e, t);
625
636
  return g.set(e, n), n;
626
637
  }
627
- function re(e) {
638
+ function oe(e) {
628
639
  var o;
629
640
  const t = g.get(e);
630
641
  t && ((o = t.panel) != null && o.parentNode && t.panel.parentNode.removeChild(t.panel), g.delete(e));
@@ -633,15 +644,15 @@ function C(e, t, o) {
633
644
  if (p.has(e)) return;
634
645
  const n = {
635
646
  input: () => {
636
- ee(t, o);
647
+ te(t, o);
637
648
  },
638
649
  keydown: (r) => {
639
650
  if (t.editor.getAttribute("contenteditable") === "false") {
640
- c(t);
651
+ s(t);
641
652
  return;
642
653
  }
643
- if (!t.isOpen && te(r)) {
644
- r.preventDefault(), H(t, o);
654
+ if (!t.isOpen && ne(r)) {
655
+ r.preventDefault(), O(t, o);
645
656
  return;
646
657
  }
647
658
  if (t.isOpen) {
@@ -655,14 +666,14 @@ function C(e, t, o) {
655
666
  }
656
667
  if (r.key === "Enter" || r.key === "Tab") {
657
668
  if (t.filteredItems.length === 0) {
658
- r.key === "Tab" && r.preventDefault(), c(t);
669
+ r.key === "Tab" && r.preventDefault(), s(t);
659
670
  return;
660
671
  }
661
- r.preventDefault(), M(t, t.activeIndex);
672
+ r.preventDefault(), N(t, t.activeIndex);
662
673
  return;
663
674
  }
664
675
  if (r.key === "Escape") {
665
- r.preventDefault(), c(t);
676
+ r.preventDefault(), t.replaceRange && (t.dismissedNode = t.replaceRange.startContainer, t.dismissedOffset = t.replaceRange.startOffset), s(t);
666
677
  return;
667
678
  }
668
679
  }
@@ -670,19 +681,19 @@ function C(e, t, o) {
670
681
  blur: () => {
671
682
  window.setTimeout(() => {
672
683
  const r = document.activeElement;
673
- t.panel && r && t.panel.contains(r) || c(t);
684
+ t.panel && r && t.panel.contains(r) || s(t);
674
685
  }, 0);
675
686
  },
676
687
  mousedown: (r) => {
677
688
  if (!t.isOpen || !t.panel) return;
678
689
  const i = r.target;
679
- i && !t.panel.contains(i) && !e.contains(i) && c(t);
690
+ i && !t.panel.contains(i) && !e.contains(i) && s(t);
680
691
  },
681
692
  selectionchange: () => {
682
693
  if (!t.isOpen) return;
683
694
  const r = E(e);
684
695
  if (!r || !r.collapsed) {
685
- c(t);
696
+ s(t);
686
697
  return;
687
698
  }
688
699
  t.anchorRange = r.cloneRange(), T(t);
@@ -693,21 +704,21 @@ function C(e, t, o) {
693
704
  };
694
705
  e.addEventListener("input", n.input), e.addEventListener("keydown", n.keydown), e.addEventListener("blur", n.blur), document.addEventListener("mousedown", n.mousedown, !0), document.addEventListener("selectionchange", n.selectionchange), window.addEventListener("resize", n.reposition, { passive: !0 }), window.addEventListener("scroll", n.reposition, !0), p.set(e, n);
695
706
  }
696
- function oe(e) {
707
+ function ie(e) {
697
708
  const t = p.get(e);
698
709
  t && (e.removeEventListener("input", t.input), e.removeEventListener("keydown", t.keydown), e.removeEventListener("blur", t.blur), document.removeEventListener("mousedown", t.mousedown, !0), document.removeEventListener("selectionchange", t.selectionchange), window.removeEventListener("resize", t.reposition), window.removeEventListener("scroll", t.reposition, !0), p.delete(e));
699
710
  }
700
- function ie(e) {
711
+ function ae(e) {
701
712
  b || (b = !0, f = (t) => {
702
713
  const o = t.target;
703
714
  if (!(o instanceof Node)) return;
704
- const n = P(o), r = (n == null ? void 0 : n.closest(s)) || null;
715
+ const n = _(o), r = (n == null ? void 0 : n.closest(c)) || null;
705
716
  if (!r) return;
706
717
  const i = w(r, e);
707
718
  C(r, i, e);
708
719
  }, document.addEventListener("focusin", f, !0));
709
720
  }
710
- function ae() {
721
+ function le() {
711
722
  !b || !f || (document.removeEventListener("focusin", f, !0), b = !1, f = null);
712
723
  }
713
724
  const ce = (e = {}) => {
@@ -728,7 +739,7 @@ const ce = (e = {}) => {
728
739
  const r = F(n);
729
740
  if (!r) return !1;
730
741
  const i = w(r, t);
731
- return C(r, i, t), H(i, t);
742
+ return C(r, i, t), O(i, t);
732
743
  }
733
744
  },
734
745
  keymap: {
@@ -736,20 +747,20 @@ const ce = (e = {}) => {
736
747
  "Mod-Shift-7": "openSlashCommands"
737
748
  },
738
749
  init: () => {
739
- h += 1, ie(t), Array.from(document.querySelectorAll(s)).forEach((n) => {
750
+ h += 1, ae(t), Array.from(document.querySelectorAll(c)).forEach((n) => {
740
751
  const r = w(n, t);
741
752
  C(n, r, t);
742
753
  });
743
754
  },
744
755
  destroy: () => {
745
- h = Math.max(0, h - 1), Array.from(document.querySelectorAll(s)).forEach((n) => {
756
+ h = Math.max(0, h - 1), Array.from(document.querySelectorAll(c)).forEach((n) => {
746
757
  const r = g.get(n);
747
- r && (c(r), oe(n), re(n));
748
- }), h === 0 && ae();
758
+ r && (s(r), ie(n), oe(n));
759
+ }), h === 0 && le();
749
760
  }
750
761
  };
751
762
  };
752
763
  export {
753
764
  ce as SlashCommandsPlugin
754
765
  };
755
- //# sourceMappingURL=SlashCommandsPlugin.native-BiN6ODw5.mjs.map
766
+ //# sourceMappingURL=SlashCommandsPlugin.native-BDIIwGNs.mjs.map