@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 S = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding="true"]', ot = "rte-data-binding-styles", p = "rte-data-binding-dialog-overlay", b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pt = {
1
+ const S = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding="true"]', ot = "rte-data-binding-styles", p = "rte-data-binding-dialog-overlay", b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', yt = {
2
2
  dialogTitleInsert: "Insert Data Binding",
3
3
  dialogTitleEdit: "Edit Data Binding",
4
4
  keyLabel: "Data Key",
@@ -13,11 +13,11 @@ const S = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding=
13
13
  previewOnText: "Preview On",
14
14
  previewOffText: "Preview Off",
15
15
  tokenAriaPrefix: "Data binding token"
16
- }, v = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap();
17
- let K = null, k = null, z = 0, O = null, M = null, B = null, V = null;
18
- function yt(t) {
16
+ }, v = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap();
17
+ let R = null, k = null, z = 0, O = null, M = null, B = null, V = null;
18
+ function ht(t) {
19
19
  return {
20
- ...pt,
20
+ ...yt,
21
21
  ...t || {}
22
22
  };
23
23
  }
@@ -29,7 +29,7 @@ function dt(t = {}) {
29
29
  getData: t.getData,
30
30
  api: t.api,
31
31
  cacheTtlMs: Math.max(0, Number((e = t.cacheTtlMs) != null ? e : 3e4)),
32
- labels: yt(t.labels),
32
+ labels: ht(t.labels),
33
33
  defaultFormat: t.defaultFormat || "text",
34
34
  defaultFallback: t.defaultFallback || "",
35
35
  locale: a,
@@ -49,37 +49,30 @@ function q(t) {
49
49
  function _(t) {
50
50
  return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
51
51
  }
52
- function ht(t) {
52
+ function kt(t) {
53
53
  const a = q(t);
54
- if (_(a))
55
- return !0;
54
+ if (_(a)) return !0;
56
55
  const e = a.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
57
56
  return _(e) ? !0 : _(document.documentElement) || _(document.body);
58
57
  }
59
58
  function A(t, a = !0) {
60
- if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
61
- return t.contentElement;
59
+ if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
62
60
  if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
63
61
  const n = t.editorElement;
64
- if (n.matches(S))
65
- return n;
62
+ if (n.matches(S)) return n;
66
63
  const i = n.querySelector(S);
67
- if (i instanceof HTMLElement)
68
- return i;
64
+ if (i instanceof HTMLElement) return i;
69
65
  }
70
66
  const e = window.getSelection();
71
67
  if (e && e.rangeCount > 0) {
72
68
  const n = e.getRangeAt(0).startContainer, i = lt(n), o = i == null ? void 0 : i.closest(S);
73
- if (o)
74
- return o;
69
+ if (o) return o;
75
70
  }
76
71
  const r = document.activeElement;
77
72
  if (r) {
78
- if (r.matches(S))
79
- return r;
73
+ if (r.matches(S)) return r;
80
74
  const n = r.closest(S);
81
- if (n)
82
- return n;
75
+ if (n) return n;
83
76
  }
84
77
  return k && k.isConnected ? k : a ? document.querySelector(S) : null;
85
78
  }
@@ -88,8 +81,7 @@ function H(t) {
88
81
  }
89
82
  function st(t) {
90
83
  const a = window.getSelection();
91
- if (!a || a.rangeCount === 0)
92
- return null;
84
+ if (!a || a.rangeCount === 0) return null;
93
85
  const e = a.getRangeAt(0);
94
86
  return t.contains(e.commonAncestorContainer) ? e.cloneRange() : null;
95
87
  }
@@ -97,7 +89,7 @@ function ct(t, a) {
97
89
  const e = window.getSelection();
98
90
  e && (e.removeAllRanges(), e.addRange(a), t.focus({ preventScroll: !0 }));
99
91
  }
100
- function kt(t, a) {
92
+ function vt(t, a) {
101
93
  const e = (a || "").trim();
102
94
  if (e)
103
95
  return e.split(".").filter(Boolean).reduce((r, n) => {
@@ -105,9 +97,8 @@ function kt(t, a) {
105
97
  return r[n];
106
98
  }, t);
107
99
  }
108
- function vt() {
109
- if (typeof document == "undefined" || document.getElementById(ot))
110
- return;
100
+ function xt() {
101
+ if (typeof document == "undefined" || document.getElementById(ot)) return;
111
102
  const t = document.createElement("style");
112
103
  t.id = ot, t.textContent = `
113
104
  .rte-data-binding {
@@ -401,8 +392,7 @@ function Y(t) {
401
392
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
402
393
  }
403
394
  function Q(t, a) {
404
- if (a === t.innerHTML)
405
- return;
395
+ if (a === t.innerHTML) return;
406
396
  const e = window.execEditorCommand || window.executeEditorCommand;
407
397
  if (typeof e == "function")
408
398
  try {
@@ -451,14 +441,13 @@ function X(t) {
451
441
  const a = window.getSelection();
452
442
  if (a && a.rangeCount > 0) {
453
443
  const n = a.getRangeAt(0).startContainer, i = lt(n), o = i == null ? void 0 : i.closest(P);
454
- if (o && t.contains(o))
455
- return o;
444
+ if (o && t.contains(o)) return o;
456
445
  }
457
446
  const e = document.activeElement, r = e == null ? void 0 : e.closest(P);
458
447
  return r && t.contains(r) ? r : null;
459
448
  }
460
449
  function bt() {
461
- K && (K.cleanup(), K = null);
450
+ R && (R.cleanup(), R = null);
462
451
  }
463
452
  function et(t, a, e) {
464
453
  const r = q(t);
@@ -469,13 +458,11 @@ function et(t, a, e) {
469
458
  }
470
459
  });
471
460
  }
472
- function xt(t, a, e) {
461
+ function wt(t, a, e) {
473
462
  const r = a.format || "text";
474
- if (t == null)
475
- return a.fallback || "";
463
+ if (t == null) return a.fallback || "";
476
464
  if (r === "json") {
477
- if (typeof t == "string")
478
- return t;
465
+ if (typeof t == "string") return t;
479
466
  try {
480
467
  return JSON.stringify(t);
481
468
  } catch (n) {
@@ -484,8 +471,7 @@ function xt(t, a, e) {
484
471
  }
485
472
  if (r === "date") {
486
473
  const n = t instanceof Date ? t : new Date(String(t));
487
- if (Number.isNaN(n.getTime()))
488
- return String(t);
474
+ if (Number.isNaN(n.getTime())) return String(t);
489
475
  try {
490
476
  return new Intl.DateTimeFormat(e.locale, e.dateFormatOptions).format(n);
491
477
  } catch (i) {
@@ -494,8 +480,7 @@ function xt(t, a, e) {
494
480
  }
495
481
  if (r === "number" || r === "currency") {
496
482
  const n = typeof t == "number" ? t : Number(t);
497
- if (!Number.isFinite(n))
498
- return String(t);
483
+ if (!Number.isFinite(n)) return String(t);
499
484
  const i = { ...e.numberFormatOptions };
500
485
  if (r === "currency") {
501
486
  const o = (a.currency || "USD").toUpperCase();
@@ -515,19 +500,19 @@ function C(t, a, e, r) {
515
500
  t.textContent = ut(n), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i}. Press Enter to edit.`);
516
501
  return;
517
502
  }
518
- const o = kt(r, i), l = o == null, d = l ? n.fallback || "" : xt(o, n, a);
503
+ const o = vt(r, i), l = o == null, d = l ? n.fallback || "" : wt(o, n, a);
519
504
  t.textContent = d || n.fallback || "", t.classList.add("rte-data-binding-preview"), l && !(n.fallback || "").trim() && t.classList.add("rte-data-binding-missing"), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i} = ${t.textContent || ""}. Press Enter to edit.`);
520
505
  }
521
506
  function w(t) {
522
507
  return typeof t == "object" && t !== null && !Array.isArray(t);
523
508
  }
524
- function wt(t, a) {
509
+ function Et(t, a) {
525
510
  return a ? a.split(".").filter(Boolean).reduce((e, r) => {
526
511
  if (!(!w(e) && !Array.isArray(e)))
527
512
  return e[r];
528
513
  }, t) : t;
529
514
  }
530
- function Et(t, a, e) {
515
+ function Dt(t, a, e) {
531
516
  const r = a.api, n = q(t), i = { editor: t, editorRoot: n, signal: e };
532
517
  if (r.buildRequest) {
533
518
  const m = r.buildRequest(i);
@@ -557,16 +542,15 @@ function Et(t, a, e) {
557
542
  }
558
543
  return { url: u.toString(), init: s };
559
544
  }
560
- async function Dt(t, a) {
545
+ async function At(t, a) {
561
546
  var d, u;
562
547
  const e = a.api;
563
- if (!e)
564
- return {};
548
+ if (!e) return {};
565
549
  const r = new AbortController(), n = q(t), i = { editor: t, editorRoot: n, signal: r.signal }, o = Math.max(0, Number((d = e.timeoutMs) != null ? d : 1e4));
566
550
  let l = null;
567
551
  o > 0 && (l = window.setTimeout(() => r.abort(), o));
568
552
  try {
569
- const { url: s, init: m } = Et(t, a, r.signal), f = await fetch(s, { ...m, signal: r.signal });
553
+ const { url: s, init: m } = Dt(t, a, r.signal), f = await fetch(s, { ...m, signal: r.signal });
570
554
  if (!f.ok)
571
555
  throw new Error(`Data binding API request failed: ${f.status}`);
572
556
  const $ = (e.responseType || "json") === "text" ? await f.text() : await f.json();
@@ -574,7 +558,7 @@ async function Dt(t, a) {
574
558
  const F = e.transformResponse($, i);
575
559
  return w(F) ? F : {};
576
560
  }
577
- const x = wt($, e.responsePath);
561
+ const x = Et($, e.responsePath);
578
562
  return w(x) ? x : w($) ? $ : { value: x };
579
563
  } catch (s) {
580
564
  return (s == null ? void 0 : s.name) !== "AbortError" && ((u = e.onError) == null || u.call(e, s, i)), {};
@@ -584,30 +568,25 @@ async function Dt(t, a) {
584
568
  }
585
569
  async function U(t, a) {
586
570
  const e = J.get(t);
587
- if (e)
588
- return e;
589
- const r = R.get(t), n = Date.now();
571
+ if (e) return e;
572
+ const r = N.get(t), n = Date.now();
590
573
  if (r && n - r.timestamp <= a.cacheTtlMs)
591
574
  return r.data;
592
575
  const i = I.get(t);
593
- if (i)
594
- return i;
576
+ if (i) return i;
595
577
  const o = (async () => {
596
578
  try {
597
579
  if (typeof a.getData == "function") {
598
580
  const d = await Promise.resolve(a.getData({ editor: t, editorRoot: q(t) }));
599
- if (w(d))
600
- return d;
581
+ if (w(d)) return d;
601
582
  }
602
583
  if (a.api) {
603
- const d = await Dt(t, a);
604
- if (w(d))
605
- return d;
584
+ const d = await At(t, a);
585
+ if (w(d)) return d;
606
586
  }
607
587
  if (typeof a.data == "function") {
608
588
  const d = await Promise.resolve(a.data());
609
- if (w(d))
610
- return d;
589
+ if (w(d)) return d;
611
590
  }
612
591
  return w(a.data) ? a.data : {};
613
592
  } finally {
@@ -616,7 +595,7 @@ async function U(t, a) {
616
595
  })();
617
596
  I.set(t, o);
618
597
  const l = await o;
619
- return R.set(t, { timestamp: n, data: l }), l;
598
+ return N.set(t, { timestamp: n, data: l }), l;
620
599
  }
621
600
  async function Z(t, a, e) {
622
601
  const r = G(t, a);
@@ -635,18 +614,21 @@ function gt(t, a) {
635
614
  const n = document.createRange();
636
615
  n.setStart(r, 1), n.collapse(!0), ct(t, n), t.normalize();
637
616
  }
638
- function At(t) {
639
- const a = t.metaKey || t.ctrlKey, e = t.key.toLowerCase(), r = a && t.altKey && t.shiftKey && e === "d", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f7";
640
- return r || n;
617
+ function mt(t) {
618
+ return typeof t.key == "string" ? t.key.toLowerCase() : "";
641
619
  }
642
620
  function St(t) {
643
- const a = t.metaKey || t.ctrlKey, e = t.key.toLowerCase(), r = a && t.altKey && t.shiftKey && e === "b", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f8";
621
+ const a = t.metaKey || t.ctrlKey, e = mt(t), r = a && t.altKey && t.shiftKey && e === "d", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f7";
622
+ return r || n;
623
+ }
624
+ function Tt(t) {
625
+ const a = t.metaKey || t.ctrlKey, e = mt(t), r = a && t.altKey && t.shiftKey && e === "b", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f8";
644
626
  return r || n;
645
627
  }
646
628
  function L(t, a, e, r, n) {
647
629
  bt();
648
630
  const i = e === "insert" ? st(t) : null, o = a.labels, l = n ? W(n, a) : j(r || {}, a), d = document.createElement("div");
649
- d.className = p, ht(t) && d.classList.add("rte-data-binding-theme-dark");
631
+ d.className = p, kt(t) && d.classList.add("rte-data-binding-theme-dark");
650
632
  const u = document.createElement("section");
651
633
  u.className = "rte-data-binding-dialog", u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "true"), u.setAttribute("aria-labelledby", "rte-data-binding-dialog-title"), u.innerHTML = `
652
634
  <header class="rte-data-binding-header">
@@ -697,25 +679,23 @@ function L(t, a, e, r, n) {
697
679
  };
698
680
  $(), f == null || f.addEventListener("change", $);
699
681
  const x = () => {
700
- d.removeEventListener("click", nt), d.removeEventListener("keydown", rt, !0), document.removeEventListener("keydown", F, !0), d.parentNode && d.parentNode.removeChild(d), K = null, t.focus({ preventScroll: !0 });
682
+ d.removeEventListener("click", nt), d.removeEventListener("keydown", rt, !0), document.removeEventListener("keydown", F, !0), d.parentNode && d.parentNode.removeChild(d), R = null, t.focus({ preventScroll: !0 });
701
683
  }, F = (c) => {
702
684
  c.key === "Escape" && (c.preventDefault(), c.stopPropagation(), x());
703
685
  }, nt = (c) => {
704
686
  c.target === d && x();
705
- }, mt = (c) => {
706
- if (c.key !== "Tab")
707
- return;
687
+ }, pt = (c) => {
688
+ if (c.key !== "Tab") return;
708
689
  const y = Array.from(
709
690
  u.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
710
691
  );
711
- if (y.length === 0)
712
- return;
713
- const E = y[0], D = y[y.length - 1], N = document.activeElement;
714
- if (c.shiftKey && N === E) {
692
+ if (y.length === 0) return;
693
+ const E = y[0], D = y[y.length - 1], K = document.activeElement;
694
+ if (c.shiftKey && K === E) {
715
695
  c.preventDefault(), D.focus();
716
696
  return;
717
697
  }
718
- !c.shiftKey && N === D && (c.preventDefault(), E.focus());
698
+ !c.shiftKey && K === D && (c.preventDefault(), E.focus());
719
699
  }, at = async () => {
720
700
  const c = ((s == null ? void 0 : s.value) || "").trim();
721
701
  if (!c) {
@@ -733,8 +713,8 @@ function L(t, a, e, r, n) {
733
713
  ), E = t.innerHTML;
734
714
  if (n) {
735
715
  tt(n, y, o);
736
- const D = v.get(t) === !0, N = D ? await U(t, a) : void 0;
737
- C(n, a, D, N);
716
+ const D = v.get(t) === !0, K = D ? await U(t, a) : void 0;
717
+ C(n, a, D, K);
738
718
  } else {
739
719
  if (i)
740
720
  try {
@@ -753,7 +733,7 @@ function L(t, a, e, r, n) {
753
733
  c.preventDefault(), x();
754
734
  return;
755
735
  }
756
- mt(c), c.key === "Enter" && !c.shiftKey && c.target instanceof HTMLInputElement && (c.preventDefault(), at());
736
+ pt(c), c.key === "Enter" && !c.shiftKey && c.target instanceof HTMLInputElement && (c.preventDefault(), at());
757
737
  };
758
738
  u.addEventListener("click", (c) => {
759
739
  const y = c.target, E = y == null ? void 0 : y.getAttribute("data-action");
@@ -764,62 +744,55 @@ function L(t, a, e, r, n) {
764
744
  }
765
745
  E === "save" && at();
766
746
  }
767
- }), d.addEventListener("click", nt), d.addEventListener("keydown", rt, !0), document.addEventListener("keydown", F, !0), K = { cleanup: x }, s == null || s.focus();
747
+ }), d.addEventListener("click", nt), d.addEventListener("keydown", rt, !0), document.addEventListener("keydown", F, !0), R = { cleanup: x }, s == null || s.focus();
768
748
  }
769
- function Tt(t) {
749
+ function $t(t) {
770
750
  V = t, M || (M = (a) => {
771
751
  const e = a.target, r = e == null ? void 0 : e.closest(S);
772
- if (!r)
773
- return;
752
+ if (!r) return;
774
753
  k = r, g.has(r) || g.set(r, t);
775
754
  const n = g.get(r) || t;
776
755
  G(r, n);
777
756
  const i = v.get(r) === !0;
778
757
  et(r, i, n), i || Array.from(r.querySelectorAll(P)).forEach((l) => C(l, n, !1));
779
758
  }, document.addEventListener("focusin", M, !0)), O || (O = (a) => {
780
- if (document.querySelector(`.${p}`))
781
- return;
759
+ if (document.querySelector(`.${p}`)) return;
782
760
  const e = a.target;
783
- if (e != null && e.closest("input, textarea, select"))
784
- return;
761
+ if (e != null && e.closest("input, textarea, select")) return;
785
762
  const r = A(void 0, !1);
786
- if (!r || H(r))
787
- return;
763
+ if (!r || H(r)) return;
788
764
  const n = g.get(r) || V || t, i = e == null ? void 0 : e.closest(P);
789
765
  if (i && (a.key === "Enter" || a.key === " ")) {
790
766
  a.preventDefault(), a.stopPropagation(), k = r, L(r, n, "edit", void 0, i);
791
767
  return;
792
768
  }
793
- if (At(a)) {
769
+ if (St(a)) {
794
770
  a.preventDefault(), a.stopPropagation();
795
771
  const o = X(r);
796
772
  o ? L(r, n, "edit", void 0, o) : L(r, n, "insert");
797
773
  return;
798
774
  }
799
- if (St(a)) {
775
+ if (Tt(a)) {
800
776
  a.preventDefault(), a.stopPropagation();
801
777
  const o = v.get(r) !== !0;
802
778
  Z(r, n, o);
803
779
  }
804
780
  }, document.addEventListener("keydown", O, !0)), B || (B = (a) => {
805
- if (document.querySelector(`.${p}`) || a.defaultPrevented || a.button !== 0 || a.metaKey || a.ctrlKey || a.altKey || a.shiftKey)
806
- return;
781
+ if (document.querySelector(`.${p}`) || a.defaultPrevented || a.button !== 0 || a.metaKey || a.ctrlKey || a.altKey || a.shiftKey) return;
807
782
  const e = a.target, r = e == null ? void 0 : e.closest(P);
808
- if (!r)
809
- return;
783
+ if (!r) return;
810
784
  const n = r.closest(S);
811
- if (!n || H(n))
812
- return;
785
+ if (!n || H(n)) return;
813
786
  const i = g.get(n) || V || t;
814
787
  g.set(n, i), k = n, a.preventDefault(), a.stopPropagation(), r.focus({ preventScroll: !0 }), L(n, i, "edit", void 0, r);
815
788
  }, document.addEventListener("click", B, !0));
816
789
  }
817
- function $t() {
790
+ function Lt() {
818
791
  M && (document.removeEventListener("focusin", M, !0), M = null), O && (document.removeEventListener("keydown", O, !0), O = null), B && (document.removeEventListener("click", B, !0), B = null), V = null, k = null;
819
792
  }
820
- const Lt = (t = {}) => {
793
+ const Ct = (t = {}) => {
821
794
  const a = dt(t);
822
- return vt(), {
795
+ return xt(), {
823
796
  name: "dataBinding",
824
797
  toolbar: [
825
798
  {
@@ -846,8 +819,7 @@ const Lt = (t = {}) => {
846
819
  commands: {
847
820
  openDataBindingDialog: (e, r) => {
848
821
  const n = A(r);
849
- if (!n || H(n))
850
- return !1;
822
+ if (!n || H(n)) return !1;
851
823
  k = n;
852
824
  const i = g.get(n) || a;
853
825
  g.set(n, i), G(n, i);
@@ -859,14 +831,12 @@ const Lt = (t = {}) => {
859
831
  },
860
832
  insertDataBindingToken: async (e, r) => {
861
833
  const n = A(r);
862
- if (!n || H(n))
863
- return !1;
834
+ if (!n || H(n)) return !1;
864
835
  k = n;
865
836
  const i = g.get(n) || a;
866
837
  g.set(n, i);
867
838
  const o = j(e || {}, i);
868
- if (!o.key)
869
- return !1;
839
+ if (!o.key) return !1;
870
840
  const l = n.innerHTML, d = ft(o, i.labels);
871
841
  if (gt(n, d), v.get(n) === !0) {
872
842
  const s = await U(n, i);
@@ -876,17 +846,14 @@ const Lt = (t = {}) => {
876
846
  },
877
847
  editDataBindingToken: async (e, r) => {
878
848
  const n = A(r);
879
- if (!n || H(n))
880
- return !1;
849
+ if (!n || H(n)) return !1;
881
850
  k = n;
882
851
  const i = g.get(n) || a;
883
852
  g.set(n, i);
884
853
  const o = X(n);
885
- if (!o)
886
- return !1;
854
+ if (!o) return !1;
887
855
  const l = W(o, i), d = j({ ...l, ...e || {} }, i);
888
- if (!d.key)
889
- return !1;
856
+ if (!d.key) return !1;
890
857
  const u = n.innerHTML;
891
858
  tt(o, d, i.labels);
892
859
  const s = v.get(n) === !0, m = s ? await U(n, i) : void 0;
@@ -894,8 +861,7 @@ const Lt = (t = {}) => {
894
861
  },
895
862
  toggleDataBindingPreview: async (e, r) => {
896
863
  const n = A(r);
897
- if (!n)
898
- return !1;
864
+ if (!n) return !1;
899
865
  k = n;
900
866
  const i = g.get(n) || a;
901
867
  g.set(n, i);
@@ -904,9 +870,8 @@ const Lt = (t = {}) => {
904
870
  },
905
871
  setDataBindingData: async (e, r) => {
906
872
  const n = A(r);
907
- if (!n)
908
- return !1;
909
- if (k = n, e && typeof e == "object" ? (J.set(n, e), R.set(n, { timestamp: Date.now(), data: e })) : (J.delete(n), R.delete(n)), v.get(n) === !0) {
873
+ if (!n) return !1;
874
+ if (k = n, e && typeof e == "object" ? (J.set(n, e), N.set(n, { timestamp: Date.now(), data: e })) : (J.delete(n), N.delete(n)), v.get(n) === !0) {
910
875
  const i = g.get(n) || a;
911
876
  await Z(n, i, !0);
912
877
  }
@@ -914,9 +879,8 @@ const Lt = (t = {}) => {
914
879
  },
915
880
  refreshDataBindings: async (e, r) => {
916
881
  const n = A(r);
917
- if (!n)
918
- return !1;
919
- k = n, R.delete(n);
882
+ if (!n) return !1;
883
+ k = n, N.delete(n);
920
884
  const i = g.get(n) || a;
921
885
  g.set(n, i);
922
886
  const o = v.get(n) === !0;
@@ -934,7 +898,7 @@ const Lt = (t = {}) => {
934
898
  init: function(r) {
935
899
  z += 1;
936
900
  const n = this && typeof this.__pluginConfig == "object" ? dt({ ...a, ...this.__pluginConfig }) : a;
937
- Tt(n);
901
+ $t(n);
938
902
  const i = A(
939
903
  r && r.editorElement ? { editorElement: r.editorElement } : void 0,
940
904
  !1
@@ -946,11 +910,11 @@ const Lt = (t = {}) => {
946
910
  }
947
911
  },
948
912
  destroy: () => {
949
- z = Math.max(0, z - 1), z === 0 && (bt(), $t());
913
+ z = Math.max(0, z - 1), z === 0 && (bt(), Lt());
950
914
  }
951
915
  };
952
916
  };
953
917
  export {
954
- Lt as DataBindingPlugin
918
+ Ct as DataBindingPlugin
955
919
  };
956
- //# sourceMappingURL=DataBindingPlugin.native-427e9d75.mjs.map
920
+ //# sourceMappingURL=DataBindingPlugin.native-BoXwghTz.mjs.map
@@ -0,0 +1,153 @@
1
+ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", g = /* @__PURE__ */ new Set([
2
+ "P",
3
+ "DIV",
4
+ "H1",
5
+ "H2",
6
+ "H3",
7
+ "H4",
8
+ "H5",
9
+ "H6",
10
+ "LI",
11
+ "BLOCKQUOTE",
12
+ "PRE",
13
+ "TABLE",
14
+ "FIGURE",
15
+ "UL",
16
+ "OL"
17
+ ]), d = (e) => g.has(e.tagName) && e.getAttribute("contenteditable") !== "true", T = (e) => e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null, L = (e) => {
18
+ const n = e == null ? void 0 : e.contentElement;
19
+ if (n instanceof HTMLElement) return n;
20
+ const t = e == null ? void 0 : e.editorElement;
21
+ if (t instanceof HTMLElement) {
22
+ const r = t.querySelector(l);
23
+ if (r instanceof HTMLElement) return r;
24
+ if (t.getAttribute("contenteditable") === "true") return t;
25
+ }
26
+ const o = window.__editoraCommandEditorRoot;
27
+ if (o instanceof HTMLElement) {
28
+ const r = o.querySelector(l);
29
+ if (r instanceof HTMLElement) return r;
30
+ if (o.getAttribute("contenteditable") === "true") return o;
31
+ }
32
+ const i = window.getSelection();
33
+ if (i && i.rangeCount > 0) {
34
+ const r = T(i.getRangeAt(0).startContainer), c = r == null ? void 0 : r.closest(l);
35
+ if (c instanceof HTMLElement) return c;
36
+ const f = r == null ? void 0 : r.closest(C), E = f == null ? void 0 : f.querySelector(l);
37
+ if (E instanceof HTMLElement) return E;
38
+ }
39
+ const a = document.activeElement, s = a instanceof HTMLElement ? a.closest(l) : null;
40
+ return s instanceof HTMLElement ? s : document.querySelector(l);
41
+ }, h = (e) => {
42
+ const n = window.getSelection();
43
+ if (!n || n.rangeCount === 0) return null;
44
+ const t = n.getRangeAt(0);
45
+ return !e.contains(t.startContainer) || !e.contains(t.endContainer) ? null : t;
46
+ }, w = (e, n) => {
47
+ let t = T(n);
48
+ for (; t && t !== e && e.contains(t); ) {
49
+ if (d(t)) return t;
50
+ t = t.parentElement;
51
+ }
52
+ return d(e) ? e : null;
53
+ }, u = (e, n) => {
54
+ const t = w(e, n);
55
+ if (!t || t === e) return null;
56
+ const o = t.closest("li");
57
+ return o instanceof HTMLElement && e.contains(o) ? o : t;
58
+ }, R = (e, n) => {
59
+ if (typeof e.intersectsNode == "function")
60
+ try {
61
+ return e.intersectsNode(n);
62
+ } catch (o) {
63
+ return !1;
64
+ }
65
+ const t = document.createRange();
66
+ return t.selectNode(n), e.compareBoundaryPoints(Range.END_TO_START, t) < 0 && e.compareBoundaryPoints(Range.START_TO_END, t) > 0;
67
+ }, p = (e, n) => {
68
+ const t = [], o = /* @__PURE__ */ new Set(), i = (r) => {
69
+ !r || o.has(r) || r === n || !n.contains(r) || d(r) && (o.add(r), t.push(r));
70
+ };
71
+ if (e.collapsed)
72
+ return i(u(n, e.startContainer)), t;
73
+ i(u(n, e.startContainer)), i(u(n, e.endContainer));
74
+ const a = document.createTreeWalker(
75
+ n,
76
+ NodeFilter.SHOW_ELEMENT,
77
+ {
78
+ acceptNode: (r) => {
79
+ const c = r;
80
+ return !d(c) || c.closest("li") && c.tagName !== "LI" ? NodeFilter.FILTER_SKIP : R(e, c) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
81
+ }
82
+ }
83
+ );
84
+ let s = a.nextNode();
85
+ for (; s; )
86
+ i(s), s = a.nextNode();
87
+ return t.length === 0 && i(u(n, e.commonAncestorContainer)), t.filter((r) => !t.some((c) => c !== r && r.contains(c)));
88
+ }, S = (e, n, t) => {
89
+ if (n !== t) {
90
+ if (typeof window.execEditorCommand == "function") {
91
+ window.execEditorCommand("recordDomTransaction", e, n, t);
92
+ return;
93
+ }
94
+ if (typeof window.executeEditorCommand == "function")
95
+ try {
96
+ window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: n, afterHTML: t });
97
+ } catch (o) {
98
+ }
99
+ }
100
+ }, m = (e, n) => {
101
+ const t = L(n);
102
+ if (!t) return !1;
103
+ const o = h(t);
104
+ if (!o) return !1;
105
+ const i = p(o, t);
106
+ if (i.length === 0) return !1;
107
+ const a = t.innerHTML;
108
+ i.forEach((r) => {
109
+ r.setAttribute("dir", e);
110
+ });
111
+ const s = t.innerHTML;
112
+ return a === s ? !1 : (S(t, a, s), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), !0);
113
+ }, M = () => ({
114
+ name: "direction",
115
+ toolbar: [
116
+ {
117
+ label: "Left to Right",
118
+ command: "setDirectionLTR",
119
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M21 18H3M21 18L18 21M21 18L18 15M13 3V12M13 3H7M13 3C13.4596 3 13.9148 3.0776 14.3394 3.22836C14.764 3.37913 15.1499 3.6001 15.4749 3.87868C15.7999 4.15726 16.0577 4.48797 16.2336 4.85195C16.4095 5.21593 16.5 5.60603 16.5 6C16.5 6.39397 16.4095 6.78407 16.2336 7.14805C16.0577 7.51203 15.7999 7.84274 15.4749 8.12132C15.1499 8.3999 14.764 8.62087 14.3394 8.77164C13.9148 8.9224 13.4596 9 13 9V3ZM9 3V12" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
120
+ shortcut: "Mod-Shift-l"
121
+ },
122
+ {
123
+ label: "Right to Left",
124
+ command: "setDirectionRTL",
125
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M3 18H21M3 18L6 21M3 18L6 15M11 12V3H17M15 3V12M10.5 3C10.0404 3 9.58525 3.0776 9.16061 3.22836C8.73597 3.37913 8.35013 3.6001 8.02513 3.87868C7.70012 4.15726 7.44231 4.48797 7.26642 4.85195C7.09053 5.21593 7 5.60603 7 6C7 6.39397 7.09053 6.78407 7.26642 7.14805C7.44231 7.51203 7.70012 7.84274 8.02513 8.12132C8.35013 8.3999 8.73597 8.62087 9.16061 8.77164C9.58525 8.9224 10.0404 9 10.5 9L10.5 3Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
126
+ shortcut: "Mod-Shift-r"
127
+ }
128
+ ],
129
+ commands: {
130
+ setDirectionLTR: (e, n) => {
131
+ try {
132
+ return m("ltr", n);
133
+ } catch (t) {
134
+ return console.error("Failed to set LTR direction:", t), !1;
135
+ }
136
+ },
137
+ setDirectionRTL: (e, n) => {
138
+ try {
139
+ return m("rtl", n);
140
+ } catch (t) {
141
+ return console.error("Failed to set RTL direction:", t), !1;
142
+ }
143
+ }
144
+ },
145
+ keymap: {
146
+ "Mod-Shift-l": "setDirectionLTR",
147
+ "Mod-Shift-r": "setDirectionRTL"
148
+ }
149
+ });
150
+ export {
151
+ M as DirectionPlugin
152
+ };
153
+ //# sourceMappingURL=DirectionPlugin.native-Bl-QLFzO.mjs.map