@editora/core 1.0.22 → 1.0.24

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 (65) hide show
  1. package/README.md +247 -243
  2. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  3. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  4. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  5. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  6. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  7. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  8. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
  9. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  10. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  11. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  12. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  13. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  14. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  15. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
  16. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  17. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  18. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  19. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  20. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  21. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  22. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  23. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  24. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
  25. package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
  26. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  27. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  28. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  29. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  30. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  31. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  32. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  33. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  34. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  35. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  36. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  37. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  38. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  39. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  40. package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
  41. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  42. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
  43. package/dist/editora.min.js +21 -21
  44. package/dist/editora.umd.js +10 -10
  45. package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
  46. package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
  47. package/dist/index.cjs.js +1 -1
  48. package/dist/index.esm.js +2 -2
  49. package/dist/katex-DLIObQUm.mjs +11683 -0
  50. package/dist/katex.min--Ws3c9be.mjs +6 -0
  51. package/dist/notify-DCQGpmq-.mjs +60 -0
  52. package/dist/plugin-loader.js +54 -54
  53. package/dist/webcomponent-core.js +305 -234
  54. package/dist/webcomponent-core.min.css +1 -1
  55. package/dist/webcomponent-core.min.js +153 -80
  56. package/dist/webcomponent.cjs.js +1 -1
  57. package/dist/webcomponent.esm.js +1 -1
  58. package/dist/webcomponent.js +631 -560
  59. package/dist/webcomponent.min.css +1 -1
  60. package/dist/webcomponent.min.js +1677 -1328
  61. package/package.json +1 -1
  62. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  63. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  64. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  65. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
@@ -1,4 +1,4 @@
1
- import { i as fe } from "./dialogHelpers-DBf7WqYH.mjs";
1
+ import { i as fe } from "./dialogHelpers-Dzn8DHoF.mjs";
2
2
  const $ = ".rte-content, .editora-content", d = '[data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark', l = "rte-version-diff-overlay", J = "rte-version-diff-styles", de = {
3
3
  title: "Version Diff",
4
4
  baseline: "Baseline",
@@ -14,7 +14,7 @@ const $ = ".rte-content, .editora-content", d = '[data-theme="dark"], .dark, .ed
14
14
  ignoreWhitespace: "Ignore whitespace",
15
15
  largeDocFallback: "Large document fallback mode applied for performance."
16
16
  }, w = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
17
- let j = 0, H = null, z = null, V = null, S = null, M = null, D = null;
17
+ let P = 0, H = null, z = null, V = null, S = null, M = null, D = null;
18
18
  function u(e) {
19
19
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
20
20
  }
@@ -48,7 +48,7 @@ function N(e, i = !0) {
48
48
  function O(e) {
49
49
  return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || e;
50
50
  }
51
- function P(e) {
51
+ function j(e) {
52
52
  if (!e) return !1;
53
53
  const i = e.getAttribute("data-theme") || e.getAttribute("theme");
54
54
  if (i && i.toLowerCase() === "dark") return !0;
@@ -57,9 +57,9 @@ function P(e) {
57
57
  }
58
58
  function Q(e) {
59
59
  const i = O(e);
60
- if (P(i)) return !0;
60
+ if (j(i)) return !0;
61
61
  const t = i.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
62
- return !!(P(t) || P(document.documentElement) || P(document.body));
62
+ return !!(j(t) || j(document.documentElement) || j(document.body));
63
63
  }
64
64
  function ue(e) {
65
65
  const i = document.createElement("textarea");
@@ -535,7 +535,7 @@ function $e(e) {
535
535
  i == null || i.focus();
536
536
  }
537
537
  function Ee(e, i) {
538
- if (e.key !== "Tab") return;
538
+ if (e.key !== "Tab" || e.defaultPrevented) return;
539
539
  const t = Array.from(i.querySelectorAll(
540
540
  'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
541
541
  )).filter((f) => !f.hasAttribute("disabled"));
@@ -596,7 +596,7 @@ function ie(e, i, t) {
596
596
  <button type="button" role="tab" class="rte-version-diff-tab" data-tab="side" aria-selected="false">${u(o.tabSideBySide)}</button>
597
597
  </div>
598
598
 
599
- <main class="rte-version-diff-body">
599
+ <div class="rte-version-diff-body">
600
600
  <div class="rte-version-diff-summary" aria-live="polite"></div>
601
601
  <section class="rte-version-diff-panel active" data-panel="inline" role="tabpanel">
602
602
  <div class="rte-version-diff-inline" aria-label="Inline diff result"></div>
@@ -613,7 +613,7 @@ function ie(e, i, t) {
613
613
  </div>
614
614
  </div>
615
615
  </section>
616
- </main>
616
+ </div>
617
617
 
618
618
  <footer class="rte-version-diff-footer">
619
619
  <small>Shortcut: Ctrl/Cmd + Alt + D (fallback: F8)</small>
@@ -763,14 +763,14 @@ const Te = (e = {}) => {
763
763
  F8: "openVersionDiff"
764
764
  },
765
765
  init: () => {
766
- j += 1, Le(i), He();
766
+ P += 1, Le(i), He();
767
767
  },
768
768
  destroy: () => {
769
- j = Math.max(0, j - 1), j === 0 && (ne(), Ce(), Se());
769
+ P = Math.max(0, P - 1), P === 0 && (ne(), Ce(), Se());
770
770
  }
771
771
  };
772
772
  };
773
773
  export {
774
774
  Te as VersionDiffPlugin
775
775
  };
776
- //# sourceMappingURL=VersionDiffPlugin.native-Ca1fMWUJ.mjs.map
776
+ //# sourceMappingURL=VersionDiffPlugin.native-DJZIzFSK.mjs.map
@@ -0,0 +1,134 @@
1
+ import { r as k } from "./historyHelpers-B0-4mq1E.mjs";
2
+ const N = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
3
+ function M(e) {
4
+ return !!e.cloneContents().querySelector(N);
5
+ }
6
+ function E(e, n) {
7
+ var o, r;
8
+ const t = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : (o = e == null ? void 0 : e.parentElement) != null ? o : null;
9
+ return (t == null ? void 0 : t.closest('[contenteditable="true"]')) || ((r = n()) == null ? void 0 : r.querySelector('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
10
+ }
11
+ function x(e, n) {
12
+ const t = E(e, n);
13
+ t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
14
+ }
15
+ function O(e, n) {
16
+ let o = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
17
+ for (; o && o !== document.body; ) {
18
+ if (o.classList.contains(n)) {
19
+ const r = document.createRange();
20
+ if (r.selectNodeContents(o), r.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && r.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
21
+ return o;
22
+ }
23
+ o = o.parentElement;
24
+ }
25
+ return null;
26
+ }
27
+ function _(e) {
28
+ var s, a;
29
+ const n = window.getSelection(), t = (a = (s = e.savedRange) == null ? void 0 : s.commonAncestorContainer) != null ? a : n && n.rangeCount > 0 ? n.getRangeAt(0).commonAncestorContainer : null, o = E(t, e.getActiveEditorRoot), r = o ? o.innerHTML : null, l = q(e);
30
+ return l && o && r !== null && k(o, r), l;
31
+ }
32
+ function q(e) {
33
+ try {
34
+ if (e.savedRange) {
35
+ const s = window.getSelection();
36
+ s && (s.removeAllRanges(), s.addRange(e.savedRange.cloneRange()));
37
+ }
38
+ const n = window.getSelection();
39
+ if (!n || n.rangeCount === 0 || n.isCollapsed)
40
+ return !1;
41
+ const t = n.getRangeAt(0);
42
+ if (t.collapsed)
43
+ return !1;
44
+ const o = O(t, e.className);
45
+ if (o)
46
+ return e.styleProperty === "backgroundColor" ? o.style.backgroundColor = e.color : o.style.color = e.color, x(o, e.getActiveEditorRoot), !0;
47
+ const r = E(
48
+ t.commonAncestorContainer,
49
+ e.getActiveEditorRoot
50
+ );
51
+ r == null || r.focus({ preventScroll: !0 });
52
+ try {
53
+ document.execCommand("styleWithCSS", !1, "true");
54
+ } catch (s) {
55
+ }
56
+ let l = !1;
57
+ if (e.commands.forEach((s) => {
58
+ l || (l = document.execCommand(s, !1, e.color));
59
+ }), !l && !M(t)) {
60
+ const s = document.createElement("span");
61
+ e.styleProperty === "backgroundColor" ? s.style.backgroundColor = e.color : s.style.color = e.color, s.className = e.className;
62
+ const a = t.extractContents();
63
+ s.appendChild(a), t.insertNode(s), t.setStartAfter(s), t.collapse(!0), n.removeAllRanges(), n.addRange(t), l = !0;
64
+ }
65
+ return l ? (x(t.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
66
+ } catch (n) {
67
+ return e.warnMessage ? console.error(e.warnMessage, n) : console.error("[ColorApply] Failed to apply color", n), !1;
68
+ }
69
+ }
70
+ function B({
71
+ popover: e,
72
+ anchor: n,
73
+ onClose: t,
74
+ gap: o = 6,
75
+ margin: r = 8,
76
+ zIndex: l = 1e4,
77
+ label: s,
78
+ initialFocus: a
79
+ }) {
80
+ e.style.position = "fixed", e.style.zIndex = `${l}`, e.style.visibility = "hidden";
81
+ const y = () => {
82
+ if (!e.isConnected || !n.isConnected) {
83
+ t();
84
+ return;
85
+ }
86
+ const c = n.getBoundingClientRect();
87
+ if (c.width === 0 && c.height === 0) {
88
+ t();
89
+ return;
90
+ }
91
+ const i = e.getBoundingClientRect(), d = i.width || e.offsetWidth || 220, f = i.height || e.offsetHeight || 260, w = window.innerWidth, T = window.innerHeight;
92
+ let m = c.left, u = c.bottom + o;
93
+ if (m + d > w - r && (m = w - d - r), m = Math.max(r, m), u + f > T - r) {
94
+ const S = c.top - f - o;
95
+ S >= r ? u = S : u = Math.max(r, T - f - r);
96
+ }
97
+ u < r && (u = r), e.style.left = `${Math.round(m)}px`, e.style.top = `${Math.round(u)}px`, e.style.visibility = "visible";
98
+ }, h = () => {
99
+ y();
100
+ }, C = (c) => {
101
+ const i = c.target;
102
+ i && (e.contains(i) || n.contains(i) || t());
103
+ }, b = (c) => {
104
+ c.key === "Escape" && t();
105
+ }, R = () => Array.from(e.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(
106
+ (c) => !c.disabled && c.tabIndex >= 0 && c.getClientRects().length > 0
107
+ ), A = (c) => {
108
+ if (c.key !== "Tab" || c.defaultPrevented) return;
109
+ const i = R();
110
+ if (i.length === 0) return;
111
+ const d = i.indexOf(document.activeElement), f = c.shiftKey ? -1 : 1, w = d === -1 ? c.shiftKey ? i[i.length - 1] : i[0] : i[(d + f + i.length) % i.length];
112
+ c.preventDefault(), w.focus();
113
+ };
114
+ (a !== void 0 || s) && (s && (e.getAttribute("role") || e.setAttribute("role", "dialog"), e.getAttribute("aria-label") || e.setAttribute("aria-label", s)), e.addEventListener("keydown", A)), window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), document.addEventListener("keydown", b);
115
+ const L = window.requestAnimationFrame(() => {
116
+ document.addEventListener("mousedown", C, !0);
117
+ });
118
+ y();
119
+ let g;
120
+ const v = (c) => {
121
+ var d;
122
+ if (!e.isConnected) return;
123
+ const i = (d = a ? e.querySelector(a) : null) != null ? d : R()[0];
124
+ i == null || i.focus({ preventScroll: !0 }), i && !e.contains(document.activeElement) && c < 4 && (g = window.setTimeout(() => v(c + 1), 40));
125
+ };
126
+ return a !== void 0 && (g = window.setTimeout(() => v(0), 0)), { reposition: y, destroy: () => {
127
+ window.clearTimeout(g), e.removeEventListener("keydown", A), window.cancelAnimationFrame(L), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0), document.removeEventListener("keydown", b), document.removeEventListener("mousedown", C, !0);
128
+ } };
129
+ }
130
+ export {
131
+ _ as a,
132
+ B as b
133
+ };
134
+ //# sourceMappingURL=anchoredPopover-QN4jNbW1.mjs.map
@@ -0,0 +1,112 @@
1
+ import { e as f } from "./escapeHtml-CX8RelZ1.mjs";
2
+ import { i as $ } from "./dialogHelpers-Dzn8DHoF.mjs";
3
+ const h = "rte-confirm-styles", w = '[data-theme="dark"], .dark, .editora-theme-dark';
4
+ let C = 0;
5
+ function L() {
6
+ if (document.getElementById(h)) return;
7
+ const o = document.createElement("style");
8
+ o.id = h, o.textContent = `
9
+ .rte-confirm-overlay {
10
+ position: fixed; inset: 0; z-index: 100002; display: flex; align-items: center; justify-content: center;
11
+ padding: 16px; background: rgba(15, 23, 36, 0.56);
12
+ --rte-confirm-bg: #ffffff; --rte-confirm-text: #101828; --rte-confirm-muted: #5f6b7d; --rte-confirm-border: #d6dbe4;
13
+ --rte-confirm-accent: #1f75fe; --rte-confirm-danger: #c62828;
14
+ }
15
+ .rte-confirm-overlay.rte-confirm-dark {
16
+ --rte-confirm-bg: #1f2937; --rte-confirm-text: #e5e7eb; --rte-confirm-muted: #9ca3af; --rte-confirm-border: #3b4657;
17
+ --rte-confirm-accent: #3b82f6; --rte-confirm-danger: #ef4444;
18
+ }
19
+ .rte-confirm-dialog {
20
+ box-sizing: border-box; width: min(100%, 420px); padding: 20px; border-radius: 10px;
21
+ background: var(--rte-confirm-bg); color: var(--rte-confirm-text); border: 1px solid var(--rte-confirm-border);
22
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35); font-size: 14px; line-height: 1.45;
23
+ }
24
+ .rte-confirm-title { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
25
+ .rte-confirm-message { margin: 0 0 14px; color: var(--rte-confirm-muted); }
26
+ .rte-confirm-field { display: block; margin: 0 0 6px; }
27
+ .rte-confirm-input {
28
+ box-sizing: border-box; width: 100%; padding: 8px 10px; border-radius: 6px; font: inherit;
29
+ border: 1px solid var(--rte-confirm-border); background: transparent; color: inherit;
30
+ }
31
+ .rte-confirm-input[aria-invalid="true"] { border-color: var(--rte-confirm-danger); }
32
+ .rte-confirm-error { margin: 6px 0 0; color: var(--rte-confirm-danger); font-size: 13px; }
33
+ .rte-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
34
+ .rte-confirm-button {
35
+ padding: 8px 14px; border-radius: 6px; font: inherit; cursor: pointer;
36
+ border: 1px solid var(--rte-confirm-border); background: transparent; color: inherit;
37
+ }
38
+ .rte-confirm-button.primary { background: var(--rte-confirm-accent); border-color: var(--rte-confirm-accent); color: #fff; }
39
+ .rte-confirm-button.danger { background: var(--rte-confirm-danger); border-color: var(--rte-confirm-danger); color: #fff; }
40
+ .rte-confirm-button:focus-visible, .rte-confirm-input:focus-visible { outline: 2px solid var(--rte-confirm-accent); outline-offset: 2px; }
41
+ `, document.head.appendChild(o);
42
+ }
43
+ function k(o, n, t) {
44
+ var m, u, b, p, x, g, v, y;
45
+ L();
46
+ const e = `rte-confirm-${++C}`, i = document.createElement("div");
47
+ $(i), i.className = "rte-confirm-overlay";
48
+ const a = (m = n.context) != null ? m : document.activeElement instanceof Element ? document.activeElement : null;
49
+ a != null && a.closest(w) && i.classList.add("rte-confirm-dark");
50
+ const s = (u = n.title) != null ? u : t ? "Enter a value" : "Please confirm", c = (b = n.confirmText) != null ? b : t ? "OK" : "Confirm", d = (p = n.cancelText) != null ? p : "Cancel", l = n.danger === !0, r = document.createElement("div");
51
+ return r.className = "rte-confirm-dialog", r.setAttribute("role", t ? "dialog" : "alertdialog"), r.setAttribute("aria-modal", "true"), r.setAttribute("aria-labelledby", `${e}-title`), r.setAttribute("aria-describedby", `${e}-message`), r.innerHTML = `
52
+ <h2 class="rte-confirm-title" id="${e}-title">${f(s)}</h2>
53
+ <p class="rte-confirm-message" id="${e}-message">${f(o)}</p>
54
+ ${t ? `<label class="rte-confirm-field" for="${e}-input">${f((x = t.label) != null ? x : o)}</label>
55
+ <input class="rte-confirm-input" id="${e}-input" type="text" inputmode="${(g = t.inputMode) != null ? g : "text"}"
56
+ autocomplete="off" value="${f((v = t.initialValue) != null ? v : "")}" placeholder="${f((y = t.placeholder) != null ? y : "")}"
57
+ aria-describedby="${e}-error">
58
+ <p class="rte-confirm-error" id="${e}-error" role="alert" hidden></p>` : ""}
59
+ <div class="rte-confirm-actions">
60
+ <button type="button" class="rte-confirm-button" data-action="cancel">${f(d)}</button>
61
+ <button type="button" class="rte-confirm-button ${l ? "danger" : "primary"}" data-action="confirm">${f(c)}</button>
62
+ </div>
63
+ `, i.appendChild(r), {
64
+ overlay: i,
65
+ confirmButton: r.querySelector('[data-action="confirm"]'),
66
+ cancelButton: r.querySelector('[data-action="cancel"]'),
67
+ input: r.querySelector("input"),
68
+ error: r.querySelector(".rte-confirm-error")
69
+ };
70
+ }
71
+ function E(o, n) {
72
+ return new Promise((t) => {
73
+ var l;
74
+ const { overlay: e, confirmButton: i, cancelButton: a } = o;
75
+ let s = !1;
76
+ const c = (r) => {
77
+ const m = n(r);
78
+ m !== void 0 && (s || (s = !0, window.removeEventListener("keydown", d, !0), e.remove(), t(m)));
79
+ }, d = (r) => {
80
+ r.key !== "Escape" || !e.isConnected || (r.preventDefault(), r.stopPropagation(), c(!1));
81
+ };
82
+ window.addEventListener("keydown", d, !0), a.addEventListener("click", () => c(!1)), i.addEventListener("click", () => c(!0)), e.addEventListener("click", (r) => {
83
+ r.target === e && c(!1);
84
+ }), (l = o.input) == null || l.addEventListener("keydown", (r) => {
85
+ r.key === "Enter" && (r.preventDefault(), c(!0));
86
+ }), document.body.appendChild(e);
87
+ });
88
+ }
89
+ function z(o, n = {}) {
90
+ const t = k(o, n, null);
91
+ return E(t, (e) => e);
92
+ }
93
+ function S(o, n = {}) {
94
+ const t = k(o, n, n), { input: e, error: i } = t, a = E(t, (s) => {
95
+ var l;
96
+ if (!s) return null;
97
+ const c = (l = e == null ? void 0 : e.value) != null ? l : "", d = n.validate ? n.validate(c) : null;
98
+ if (d) {
99
+ i && (i.textContent = d, i.hidden = !1), e == null || e.setAttribute("aria-invalid", "true"), e == null || e.focus(), e == null || e.select();
100
+ return;
101
+ }
102
+ return c;
103
+ });
104
+ return window.setTimeout(() => {
105
+ e != null && e.isConnected && (e.focus(), e.select());
106
+ }, 10), a;
107
+ }
108
+ export {
109
+ z as c,
110
+ S as p
111
+ };
112
+ //# sourceMappingURL=confirmDialog-BP8hZPpX.mjs.map
@@ -0,0 +1,194 @@
1
+ function I(t) {
2
+ let n = !1;
3
+ t.addEventListener(
4
+ "pointerdown",
5
+ (e) => {
6
+ n = e.target !== t;
7
+ },
8
+ !0
9
+ ), t.addEventListener(
10
+ "click",
11
+ (e) => {
12
+ e.target === t && n && e.stopImmediatePropagation(), n = !1;
13
+ },
14
+ !0
15
+ );
16
+ }
17
+ const w = "rte-dialog-base-styles";
18
+ function R() {
19
+ if (typeof document == "undefined" || document.getElementById(w)) return;
20
+ const t = document.createElement("style");
21
+ t.id = w, t.textContent = `
22
+ [data-rte-dialog] {
23
+ font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
24
+ }
25
+
26
+ /* Form controls ignore inherited fonts (browsers default them to Arial /
27
+ system-ui). :where() keeps this at zero specificity so any control a plugin
28
+ styles explicitly - e.g. a monospace formula field - keeps its own font. */
29
+ :where([data-rte-dialog]) :where(button, input, select, textarea) {
30
+ font-family: inherit;
31
+ }
32
+ `, document.head.appendChild(t);
33
+ }
34
+ function q(t) {
35
+ t.setAttribute("data-rte-dialog", ""), R(), I(t), $(t);
36
+ }
37
+ const D = 'a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';
38
+ function x(t, n) {
39
+ for (let e = t; e; e = e.parentElement) {
40
+ if (e.hidden || e.getAttribute("aria-hidden") === "true") return !1;
41
+ const i = window.getComputedStyle(e);
42
+ if (i.display === "none" || i.visibility === "hidden") return !1;
43
+ if (e === n) break;
44
+ }
45
+ return !0;
46
+ }
47
+ function A(t) {
48
+ return Array.from(t.querySelectorAll(D)).filter(
49
+ (n) => !n.disabled && n.getAttribute("tabindex") !== "-1" && x(n, t)
50
+ );
51
+ }
52
+ function M(t) {
53
+ const n = A(t);
54
+ return n.filter((e) => {
55
+ var a;
56
+ if (!(e instanceof HTMLInputElement) || e.type !== "radio" || !e.name) return !0;
57
+ const i = n.filter(
58
+ (r) => r instanceof HTMLInputElement && r.type === "radio" && r.name === e.name
59
+ ), o = (a = i.find((r) => r.checked)) != null ? a : i[0];
60
+ return e === o;
61
+ });
62
+ }
63
+ function L(t) {
64
+ var i, o, a, r;
65
+ const n = `${(i = t.getAttribute("aria-label")) != null ? i : ""} ${(a = (o = t.className) == null ? void 0 : o.toString()) != null ? a : ""}`.toLowerCase(), e = ((r = t.textContent) != null ? r : "").trim();
66
+ return /close|dismiss/.test(n) || /^[\u00d7\u2715\u2716x]$/i.test(e);
67
+ }
68
+ function T(t) {
69
+ var i;
70
+ if (!t || !t.isConnected) return;
71
+ const n = A(t), e = (i = n.find((o) => !L(o))) != null ? i : n[0];
72
+ if (e) {
73
+ e.focus({ preventScroll: !0 });
74
+ return;
75
+ }
76
+ t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
77
+ }
78
+ const k = ["id", "data-action", "data-comment-id", "data-id", "data-index", "data-suggestion", "data-value", "name"];
79
+ function B(t) {
80
+ let n = t.tagName.toLowerCase();
81
+ const e = t.classList[0];
82
+ e && /^[\w-]+$/.test(e) && (n += `.${e}`);
83
+ for (const i of k) {
84
+ const o = t.getAttribute(i);
85
+ o !== null && /^[\w:.-]*$/.test(o) && (n += `[${i}="${o}"]`);
86
+ }
87
+ return n;
88
+ }
89
+ function F(t, n) {
90
+ const e = t && N(t) ? document.activeElement : null;
91
+ let i = "", o = 0;
92
+ t && e && e !== t && (i = B(e), o = Array.from(t.querySelectorAll(i)).indexOf(e));
93
+ const a = !!t && document.activeElement === t;
94
+ if (n(), !t) return;
95
+ if (a) {
96
+ T(t);
97
+ return;
98
+ }
99
+ if (!e || e.isConnected) return;
100
+ const r = i ? Array.from(t.querySelectorAll(i)).filter((d) => x(d, t)) : [], u = r[Math.min(Math.max(o, 0), r.length - 1)];
101
+ u ? u.focus({ preventScroll: !0 }) : T(t);
102
+ }
103
+ function _(t, n) {
104
+ var r, u, d, m;
105
+ const e = (r = n == null ? void 0 : n.commonAncestorContainer) != null ? r : null, i = e && (d = (u = e instanceof HTMLElement ? e : e.parentElement) == null ? void 0 : u.closest('[contenteditable="true"]')) != null ? d : null, o = i != null ? i : t ? t.matches('[contenteditable="true"]') ? t : (m = t.querySelector('[contenteditable="true"]')) != null ? m : t.closest('[contenteditable="true"]') : null;
106
+ if (!o || !o.isConnected || (o.focus({ preventScroll: !0 }), !n || !n.startContainer.isConnected || !n.endContainer.isConnected || !o.contains(n.commonAncestorContainer))) return;
107
+ const a = window.getSelection();
108
+ a && (a.removeAllRanges(), a.addRange(n));
109
+ }
110
+ let H = 0;
111
+ function P(t, n, e) {
112
+ if (t) {
113
+ if (!n || !e || !e.id) {
114
+ t.removeAttribute("aria-activedescendant"), t.removeAttribute("aria-controls");
115
+ return;
116
+ }
117
+ n.id || (n.id = `rte-suggestions-${++H}`), t.setAttribute("aria-controls", n.id), t.setAttribute("aria-activedescendant", e.id);
118
+ }
119
+ }
120
+ function N(t) {
121
+ if (!t) return !1;
122
+ const n = document.activeElement;
123
+ return !!n && t.contains(n);
124
+ }
125
+ function O(t) {
126
+ var i;
127
+ const n = t.querySelector(
128
+ 'h1, h2, h3, h4, [class*="title"], [class*="header"], header, [role="heading"]'
129
+ );
130
+ if (!n) return "";
131
+ const e = n.cloneNode(!0);
132
+ return e.querySelectorAll('button, [role="button"], [aria-label*="lose"], [class*="close"]').forEach((o) => o.remove()), ((i = e.textContent) != null ? i : "").replace(/\s+/g, " ").trim();
133
+ }
134
+ function $(t) {
135
+ var m, h;
136
+ const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, e = window.getSelection(), i = e && e.rangeCount > 0 ? e.getRangeAt(0).cloneRange() : null, o = i && (h = (m = i.commonAncestorContainer instanceof HTMLElement ? i.commonAncestorContainer : i.commonAncestorContainer.parentElement) == null ? void 0 : m.closest('[contenteditable="true"]')) != null ? h : null, a = o ? o.innerHTML : null;
137
+ t.addEventListener("keydown", (c) => {
138
+ if (c.key !== "Tab" || c.defaultPrevented) return;
139
+ const l = M(t);
140
+ if (l.length === 0) {
141
+ c.preventDefault();
142
+ return;
143
+ }
144
+ const s = l.indexOf(document.activeElement), b = c.shiftKey ? -1 : 1, p = s === -1 ? c.shiftKey ? l[l.length - 1] : l[0] : l[(s + b + l.length) % l.length];
145
+ c.preventDefault(), p.focus();
146
+ });
147
+ let r = !1;
148
+ const u = (c) => {
149
+ var C, E, S, y;
150
+ if (!t.isConnected) {
151
+ c < 3 && window.setTimeout(() => u(c + 1), 50);
152
+ return;
153
+ }
154
+ r = !0;
155
+ const s = (S = (E = (C = ((f) => {
156
+ var g;
157
+ return ["dialog", "alertdialog"].includes((g = f.getAttribute("role")) != null ? g : "");
158
+ })(t) ? t : null) != null ? C : t.querySelector('[role="dialog"], [role="alertdialog"]')) != null ? E : t.firstElementChild instanceof HTMLElement ? t.firstElementChild : null) != null ? S : t;
159
+ s.getAttribute("role") || s.setAttribute("role", "dialog"), s.hasAttribute("aria-modal") || s.setAttribute("aria-modal", "true");
160
+ const b = s.getAttribute("aria-labelledby");
161
+ if (!(!!s.getAttribute("aria-label") || !!b && !!document.getElementById(b.split(/\s+/)[0]))) {
162
+ const f = O(s);
163
+ f && (s.removeAttribute("aria-labelledby"), s.setAttribute("aria-label", f));
164
+ }
165
+ if (!t.contains(document.activeElement)) {
166
+ const f = A(t), g = (y = f.find((v) => !L(v))) != null ? y : f[0];
167
+ g ? g.focus({ preventScroll: !0 }) : (s.setAttribute("tabindex", "-1"), s.focus({ preventScroll: !0 }));
168
+ }
169
+ };
170
+ window.setTimeout(() => u(0), 0);
171
+ const d = new MutationObserver(() => {
172
+ if (t.isConnected && (r = !0), t.isConnected || !r) return;
173
+ d.disconnect();
174
+ const c = document.activeElement;
175
+ if (!c || c === document.body || t.contains(c)) {
176
+ const s = o != null && o.isConnected ? o : n;
177
+ s && s.isConnected && s.focus({ preventScroll: !0 });
178
+ }
179
+ if (i && o && o.isConnected && o.innerHTML === a && e) {
180
+ const s = e.rangeCount > 0 ? e.getRangeAt(0) : null;
181
+ !(s && s.compareBoundaryPoints(Range.START_TO_START, i) === 0 && s.compareBoundaryPoints(Range.END_TO_END, i) === 0) && o.contains(i.startContainer) && o.contains(i.endContainer) && (e.removeAllRanges(), e.addRange(i));
182
+ }
183
+ });
184
+ d.observe(document.body, { childList: !0, subtree: !0 });
185
+ }
186
+ export {
187
+ P as a,
188
+ T as f,
189
+ q as i,
190
+ F as k,
191
+ N as p,
192
+ _ as r
193
+ };
194
+ //# sourceMappingURL=dialogHelpers-Dzn8DHoF.mjs.map