@editora/core 1.0.23 → 1.0.25
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.
- package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
- package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
- package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
- package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
- package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
- package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
- package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
- package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-CRpX2G93.mjs} +167 -113
- package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
- package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
- package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
- package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
- package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
- package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-CaBqCH-p.mjs} +21 -20
- package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
- package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
- package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
- package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
- package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
- package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
- package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
- package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
- package/dist/MediaManagerPlugin.native-0YFHZfsb.mjs +4823 -0
- package/dist/MediaManagerPlugin.native-mXWWARRX.mjs +4908 -0
- package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
- package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
- package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
- package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
- package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
- package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
- package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
- package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
- package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
- package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
- package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
- package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
- package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
- package/dist/confirmDialog-CNqPHT5x.mjs +92 -0
- package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
- package/dist/{documentManager-BWK_-KJp.mjs → documentManager-DHLCoWzw.mjs} +1963 -1969
- package/dist/editora.min.js +21 -21
- package/dist/editora.umd.js +10 -10
- package/dist/index-DHPPVQwx.js +12 -0
- package/dist/{index-DGMYWPLx.mjs → index-gI4djib2.mjs} +407 -327
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-DLIObQUm.mjs +11683 -0
- package/dist/katex.min--Ws3c9be.mjs +6 -0
- package/dist/notify-DCQGpmq-.mjs +60 -0
- package/dist/plugin-loader.js +54 -54
- package/dist/shared-config-DuA34Iii.mjs +26 -0
- package/dist/webcomponent-core.js +315 -235
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +153 -80
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +672 -592
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3099 -1532
- package/package.json +1 -1
- package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
- package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
- package/dist/MediaManagerPlugin.native-BT1NZIJS.mjs +0 -998
- package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
- package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
- package/dist/index-C1sO7DAC.js +0 -12
package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as fe } from "./dialogHelpers-
|
|
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
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
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
|
|
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 (
|
|
60
|
+
if (j(i)) return !0;
|
|
61
61
|
const t = i.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
62
|
-
return !!(
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
766
|
+
P += 1, Le(i), He();
|
|
767
767
|
},
|
|
768
768
|
destroy: () => {
|
|
769
|
-
|
|
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-
|
|
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,92 @@
|
|
|
1
|
+
import { e as s } from "./escapeHtml-CX8RelZ1.mjs";
|
|
2
|
+
import { i as x } from "./dialogHelpers-Dzn8DHoF.mjs";
|
|
3
|
+
const g = "rte-confirm-styles", v = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
4
|
+
let y = 0;
|
|
5
|
+
function h() {
|
|
6
|
+
if (document.getElementById(g)) return;
|
|
7
|
+
const t = document.createElement("style");
|
|
8
|
+
t.id = g, t.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(t);
|
|
42
|
+
}
|
|
43
|
+
function k(t, n, d) {
|
|
44
|
+
var a, u, p, b;
|
|
45
|
+
h();
|
|
46
|
+
const r = `rte-confirm-${++y}`, o = document.createElement("div");
|
|
47
|
+
x(o), o.className = "rte-confirm-overlay";
|
|
48
|
+
const c = (a = n.context) != null ? a : document.activeElement instanceof Element ? document.activeElement : null;
|
|
49
|
+
c != null && c.closest(v) && o.classList.add("rte-confirm-dark");
|
|
50
|
+
const f = (u = n.title) != null ? u : "Please confirm", i = (p = n.confirmText) != null ? p : "Confirm", m = (b = n.cancelText) != null ? b : "Cancel", l = n.danger === !0, e = document.createElement("div");
|
|
51
|
+
return e.className = "rte-confirm-dialog", e.setAttribute("role", "alertdialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", `${r}-title`), e.setAttribute("aria-describedby", `${r}-message`), e.innerHTML = `
|
|
52
|
+
<h2 class="rte-confirm-title" id="${r}-title">${s(f)}</h2>
|
|
53
|
+
<p class="rte-confirm-message" id="${r}-message">${s(t)}</p>
|
|
54
|
+
|
|
55
|
+
<div class="rte-confirm-actions">
|
|
56
|
+
<button type="button" class="rte-confirm-button" data-action="cancel">${s(m)}</button>
|
|
57
|
+
<button type="button" class="rte-confirm-button ${l ? "danger" : "primary"}" data-action="confirm">${s(i)}</button>
|
|
58
|
+
</div>
|
|
59
|
+
`, o.appendChild(e), {
|
|
60
|
+
overlay: o,
|
|
61
|
+
confirmButton: e.querySelector('[data-action="confirm"]'),
|
|
62
|
+
cancelButton: e.querySelector('[data-action="cancel"]'),
|
|
63
|
+
input: e.querySelector("input"),
|
|
64
|
+
error: e.querySelector(".rte-confirm-error")
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function E(t, n) {
|
|
68
|
+
return new Promise((d) => {
|
|
69
|
+
var l;
|
|
70
|
+
const { overlay: r, confirmButton: o, cancelButton: c } = t;
|
|
71
|
+
let f = !1;
|
|
72
|
+
const i = (e) => {
|
|
73
|
+
const a = n(e);
|
|
74
|
+
a !== void 0 && (f || (f = !0, window.removeEventListener("keydown", m, !0), r.remove(), d(a)));
|
|
75
|
+
}, m = (e) => {
|
|
76
|
+
e.key !== "Escape" || !r.isConnected || (e.preventDefault(), e.stopPropagation(), i(!1));
|
|
77
|
+
};
|
|
78
|
+
window.addEventListener("keydown", m, !0), c.addEventListener("click", () => i(!1)), o.addEventListener("click", () => i(!0)), r.addEventListener("click", (e) => {
|
|
79
|
+
e.target === r && i(!1);
|
|
80
|
+
}), (l = t.input) == null || l.addEventListener("keydown", (e) => {
|
|
81
|
+
e.key === "Enter" && (e.preventDefault(), i(!0));
|
|
82
|
+
}), document.body.appendChild(r);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function L(t, n = {}) {
|
|
86
|
+
const d = k(t, n);
|
|
87
|
+
return E(d, (r) => r);
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
L as c
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=confirmDialog-CNqPHT5x.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
|