@editora/plugins 1.0.22 → 1.1.0
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/README.md +1 -1
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
- package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
- package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
- package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-D3S8BhIM.js +42 -0
- package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +12 -12
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +90 -83
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +1 -619
- package/dist/media-manager.esm.js +30 -1017
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/index.d.ts +183 -2
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const R = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", se = "__editoraCommandEditorRoot", le = "rte-content-rules-styles", f = "rte-content-rules-panel", q = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',
|
|
1
|
+
const R = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", se = "__editoraCommandEditorRoot", le = "rte-content-rules-styles", f = "rte-content-rules-panel", q = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', xe = {
|
|
2
2
|
panelTitle: "Content Rules",
|
|
3
3
|
panelAriaLabel: "Content rules panel",
|
|
4
4
|
runAuditText: "Run Audit",
|
|
@@ -12,18 +12,18 @@ const R = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
|
|
|
12
12
|
requiredHeadingMessage: "Missing required heading",
|
|
13
13
|
sentenceLengthMessage: "Sentence is too long",
|
|
14
14
|
readabilityMessage: "Readability score is below threshold"
|
|
15
|
-
}, d = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(),
|
|
16
|
-
let N = 0,
|
|
15
|
+
}, d = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Set();
|
|
16
|
+
let N = 0, ye = 0, E = null, g = null, L = null, I = null, H = null, S = null;
|
|
17
17
|
function k(e) {
|
|
18
18
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function we(e) {
|
|
21
21
|
return {
|
|
22
|
-
...
|
|
22
|
+
...xe,
|
|
23
23
|
...e || {}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ke(e) {
|
|
27
27
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
28
28
|
}
|
|
29
29
|
function ie(e) {
|
|
@@ -43,8 +43,8 @@ function j(e = {}) {
|
|
|
43
43
|
maxIssues: Math.max(1, Number(e.maxIssues ?? 100)),
|
|
44
44
|
debounceMs: Math.max(50, Number(e.debounceMs ?? 220)),
|
|
45
45
|
enableRealtime: e.enableRealtime !== !1,
|
|
46
|
-
labels:
|
|
47
|
-
normalizeText: e.normalizeText ||
|
|
46
|
+
labels: we(e.labels),
|
|
47
|
+
normalizeText: e.normalizeText || ke,
|
|
48
48
|
customRules: Array.isArray(e.customRules) ? e.customRules : []
|
|
49
49
|
};
|
|
50
50
|
}
|
|
@@ -57,7 +57,7 @@ function F(e) {
|
|
|
57
57
|
const t = e.querySelector(R);
|
|
58
58
|
return t instanceof HTMLElement ? t : null;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Re() {
|
|
61
61
|
if (typeof window > "u") return null;
|
|
62
62
|
const e = window[se];
|
|
63
63
|
if (!(e instanceof HTMLElement)) return null;
|
|
@@ -71,7 +71,7 @@ function ke() {
|
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function Ee(e) {
|
|
75
75
|
const t = e.closest("[data-editora-editor]");
|
|
76
76
|
if (t && F(t) === e)
|
|
77
77
|
return t;
|
|
@@ -86,16 +86,16 @@ function Re(e) {
|
|
|
86
86
|
function K(e) {
|
|
87
87
|
return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function ve(e) {
|
|
90
90
|
const t = X(e);
|
|
91
91
|
if (K(t)) return !0;
|
|
92
92
|
const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
93
93
|
return K(n) ? !0 : K(document.documentElement) || K(document.body);
|
|
94
94
|
}
|
|
95
95
|
function G(e, t) {
|
|
96
|
-
e.classList.remove("rte-content-rules-theme-dark"),
|
|
96
|
+
e.classList.remove("rte-content-rules-theme-dark"), ve(t) && e.classList.add("rte-content-rules-theme-dark");
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Ce(e) {
|
|
99
99
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
100
100
|
}
|
|
101
101
|
function M(e, t = !0) {
|
|
@@ -106,11 +106,11 @@ function M(e, t = !0) {
|
|
|
106
106
|
const i = s.querySelector(R);
|
|
107
107
|
if (i instanceof HTMLElement) return i;
|
|
108
108
|
}
|
|
109
|
-
const n =
|
|
109
|
+
const n = Re();
|
|
110
110
|
if (n) return n;
|
|
111
111
|
const o = window.getSelection();
|
|
112
112
|
if (o && o.rangeCount > 0) {
|
|
113
|
-
const s = o.getRangeAt(0).startContainer, l =
|
|
113
|
+
const s = o.getRangeAt(0).startContainer, l = Ce(s)?.closest(R);
|
|
114
114
|
if (l) return l;
|
|
115
115
|
}
|
|
116
116
|
const r = document.activeElement;
|
|
@@ -124,11 +124,11 @@ function M(e, t = !0) {
|
|
|
124
124
|
function Z(e) {
|
|
125
125
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function $e(e, t) {
|
|
128
128
|
const n = e.innerText || e.textContent || "";
|
|
129
129
|
return t(n);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Me(e) {
|
|
132
132
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
133
133
|
}
|
|
134
134
|
function ce(e) {
|
|
@@ -141,11 +141,11 @@ function ue(e) {
|
|
|
141
141
|
const t = e.match(/\b[\w'-]+\b/g);
|
|
142
142
|
return t ? t.length : 0;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function me(e) {
|
|
145
145
|
const t = e.match(/[^.!?]+[.!?]*/g);
|
|
146
146
|
return t ? t.map((n) => n.trim()).filter(Boolean).length : 0;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Se(e) {
|
|
149
149
|
const t = e.toLowerCase().replace(/[^a-z]/g, "");
|
|
150
150
|
if (!t) return 0;
|
|
151
151
|
if (t.length <= 3) return 1;
|
|
@@ -153,10 +153,10 @@ function Me(e) {
|
|
|
153
153
|
let o = n ? n.length : 1;
|
|
154
154
|
return t.endsWith("e") && (o -= 1), Math.max(1, o);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function Te(e) {
|
|
157
157
|
const t = e.match(/\b[\w'-]+\b/g) || [], n = t.length;
|
|
158
158
|
if (n === 0) return 100;
|
|
159
|
-
const o = Math.max(1,
|
|
159
|
+
const o = Math.max(1, me(e)), r = t.reduce((i, l) => i + Se(l), 0), s = 206.835 - 1.015 * (n / o) - 84.6 * (r / Math.max(1, n));
|
|
160
160
|
return Number.isFinite(s) ? Math.max(0, Math.min(120, s)) : 0;
|
|
161
161
|
}
|
|
162
162
|
function z(e, t) {
|
|
@@ -168,43 +168,43 @@ function x(e, t) {
|
|
|
168
168
|
function P(e, t, n) {
|
|
169
169
|
x(e, n) || e.push(t);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function be(e, t = 140) {
|
|
172
172
|
return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Ae(e, t, n, o) {
|
|
175
175
|
return {
|
|
176
176
|
id: e.id || z(t, o),
|
|
177
177
|
ruleId: e.ruleId || t,
|
|
178
178
|
severity: e.severity || n,
|
|
179
179
|
message: e.message || t,
|
|
180
|
-
excerpt: e.excerpt ?
|
|
180
|
+
excerpt: e.excerpt ? be(e.excerpt, 220) : void 0,
|
|
181
181
|
suggestion: e.suggestion,
|
|
182
182
|
locateText: e.locateText,
|
|
183
183
|
selector: e.selector
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Le(e, t) {
|
|
187
187
|
const n = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), o = /* @__PURE__ */ new Set();
|
|
188
188
|
return n.forEach((r) => {
|
|
189
189
|
const s = t(r.textContent || "").toLowerCase();
|
|
190
190
|
s && o.add(s);
|
|
191
191
|
}), o;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Ie(e) {
|
|
194
194
|
const t = e.match(/[^.!?\n]+[.!?]?/g);
|
|
195
195
|
return t ? t.map((n) => n.trim()).filter(Boolean) : [];
|
|
196
196
|
}
|
|
197
197
|
async function v(e, t, n = !1) {
|
|
198
|
-
const o =
|
|
198
|
+
const o = $e(e, t.normalizeText), r = e.innerHTML, s = `${o.length}:${ce(o)}:${r.length}:${ce(r)}`;
|
|
199
199
|
if (!n && ae.get(e) === s)
|
|
200
200
|
return C.get(e) || [];
|
|
201
201
|
const i = (Y.get(e) || 0) + 1;
|
|
202
202
|
Y.set(e, i);
|
|
203
|
-
const l = ue(o), c =
|
|
203
|
+
const l = ue(o), c = me(o), u = Te(o), a = [], y = t.labels;
|
|
204
204
|
if (t.bannedWords.length > 0) {
|
|
205
205
|
let w = 0;
|
|
206
206
|
for (const p of t.bannedWords) {
|
|
207
|
-
const m = new RegExp(`\\b${
|
|
207
|
+
const m = new RegExp(`\\b${Me(p)}\\b`, "gi");
|
|
208
208
|
let b = m.exec(o);
|
|
209
209
|
for (; b && !x(a, t.maxIssues); ) {
|
|
210
210
|
const oe = b[0];
|
|
@@ -225,7 +225,7 @@ async function v(e, t, n = !1) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
if (!x(a, t.maxIssues) && t.requiredHeadings.length > 0) {
|
|
228
|
-
const w =
|
|
228
|
+
const w = Le(e, t.normalizeText);
|
|
229
229
|
let p = 0;
|
|
230
230
|
t.requiredHeadings.forEach((m) => {
|
|
231
231
|
if (x(a, t.maxIssues)) return;
|
|
@@ -244,7 +244,7 @@ async function v(e, t, n = !1) {
|
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
if (!x(a, t.maxIssues)) {
|
|
247
|
-
const w =
|
|
247
|
+
const w = Ie(o);
|
|
248
248
|
let p = 0;
|
|
249
249
|
for (const m of w) {
|
|
250
250
|
if (x(a, t.maxIssues)) break;
|
|
@@ -256,7 +256,7 @@ async function v(e, t, n = !1) {
|
|
|
256
256
|
ruleId: "sentence-length",
|
|
257
257
|
severity: "warning",
|
|
258
258
|
message: `${y.sentenceLengthMessage} (${b}/${t.maxSentenceWords} words)`,
|
|
259
|
-
excerpt:
|
|
259
|
+
excerpt: be(m, 200),
|
|
260
260
|
locateText: m.slice(0, 64),
|
|
261
261
|
suggestion: "Split into shorter sentences for readability."
|
|
262
262
|
},
|
|
@@ -292,7 +292,7 @@ async function v(e, t, n = !1) {
|
|
|
292
292
|
for (let b = 0; b < m.length && !x(a, t.maxIssues); b += 1)
|
|
293
293
|
P(
|
|
294
294
|
a,
|
|
295
|
-
|
|
295
|
+
Ae(m[b], p.id, p.severity || "warning", b),
|
|
296
296
|
t.maxIssues
|
|
297
297
|
);
|
|
298
298
|
} catch {
|
|
@@ -306,7 +306,7 @@ async function v(e, t, n = !1) {
|
|
|
306
306
|
wordCount: l,
|
|
307
307
|
sentenceCount: c
|
|
308
308
|
};
|
|
309
|
-
return ae.set(e, s), C.set(e, a),
|
|
309
|
+
return ae.set(e, s), C.set(e, a), ge.set(e, D), te(e), e.dispatchEvent(
|
|
310
310
|
new CustomEvent("editora:content-rules-audit", {
|
|
311
311
|
bubbles: !0,
|
|
312
312
|
detail: {
|
|
@@ -316,17 +316,17 @@ async function v(e, t, n = !1) {
|
|
|
316
316
|
})
|
|
317
317
|
), a;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function He(e) {
|
|
320
320
|
return e.reduce(
|
|
321
321
|
(t, n) => (t[n.severity] += 1, t),
|
|
322
322
|
{ error: 0, warning: 0, info: 0 }
|
|
323
323
|
);
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function de(e) {
|
|
326
326
|
return e === "error" ? "Error" : e === "warning" ? "Warning" : "Info";
|
|
327
327
|
}
|
|
328
328
|
function $(e, t, n) {
|
|
329
|
-
const o =
|
|
329
|
+
const o = Ee(e);
|
|
330
330
|
Array.from(
|
|
331
331
|
o.querySelectorAll(
|
|
332
332
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -345,7 +345,7 @@ function J(e, t) {
|
|
|
345
345
|
const s = Math.max(10, o.right - r), i = Math.max(10, window.innerWidth - r - 10), l = Math.min(s, i), c = Math.max(10, Math.min(window.innerHeight - 10 - 240, o.top + 10));
|
|
346
346
|
t.style.left = `${l}px`, t.style.top = `${c}px`;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function fe(e, t) {
|
|
349
349
|
const n = t.trim().toLowerCase();
|
|
350
350
|
if (!n) return !1;
|
|
351
351
|
const o = window.getSelection();
|
|
@@ -370,7 +370,7 @@ function We(e, t) {
|
|
|
370
370
|
if (n)
|
|
371
371
|
return n.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), n.focus({ preventScroll: !0 }), !0;
|
|
372
372
|
}
|
|
373
|
-
return !!(t.locateText &&
|
|
373
|
+
return !!(t.locateText && fe(e, t.locateText) || t.excerpt && fe(e, t.excerpt.slice(0, 64)));
|
|
374
374
|
}
|
|
375
375
|
function Oe(e, t) {
|
|
376
376
|
return (C.get(e) || []).find((o) => o.id === t);
|
|
@@ -390,17 +390,17 @@ function te(e) {
|
|
|
390
390
|
if (!t) return;
|
|
391
391
|
const n = d.get(e) || E;
|
|
392
392
|
if (!n) return;
|
|
393
|
-
const o = C.get(e) || [], r =
|
|
393
|
+
const o = C.get(e) || [], r = ge.get(e) || {
|
|
394
394
|
readabilityScore: 100
|
|
395
395
|
}, s = t.querySelector(".rte-content-rules-count"), i = t.querySelector(".rte-content-rules-summary"), l = t.querySelector(".rte-content-rules-list"), c = t.querySelector(".rte-content-rules-live");
|
|
396
396
|
if (!s || !i || !l || !c) return;
|
|
397
|
-
const u =
|
|
397
|
+
const u = He(o);
|
|
398
398
|
if (s.textContent = String(o.length), i.textContent = `${n.labels.summaryPrefix}: ${o.length} | Error ${u.error} | Warning ${u.warning} | Info ${u.info} | Readability ${r.readabilityScore.toFixed(1)}`, c.textContent = `${o.length} issues. ${u.error} errors, ${u.warning} warnings, ${u.info} info.`, o.length === 0) {
|
|
399
399
|
l.innerHTML = `<li class="rte-content-rules-empty">${k(n.labels.noIssuesText)}</li>`;
|
|
400
400
|
return;
|
|
401
401
|
}
|
|
402
402
|
l.innerHTML = o.map((a) => {
|
|
403
|
-
const y = a.excerpt ? `<p class="rte-content-rules-excerpt">${k(a.excerpt)}</p>` : "", D = a.suggestion ? `<p class="rte-content-rules-suggestion">${k(a.suggestion)}</p>` : "", w = `${
|
|
403
|
+
const y = a.excerpt ? `<p class="rte-content-rules-excerpt">${k(a.excerpt)}</p>` : "", D = a.suggestion ? `<p class="rte-content-rules-suggestion">${k(a.suggestion)}</p>` : "", w = `${de(a.severity)} ${a.message}. ${n.labels.locateText}`;
|
|
404
404
|
return `
|
|
405
405
|
<li class="rte-content-rules-item rte-content-rules-item-${a.severity}">
|
|
406
406
|
<button
|
|
@@ -411,7 +411,7 @@ function te(e) {
|
|
|
411
411
|
data-role="issue-button"
|
|
412
412
|
aria-label="${k(w)}"
|
|
413
413
|
>
|
|
414
|
-
<span class="rte-content-rules-badge">${k(
|
|
414
|
+
<span class="rte-content-rules-badge">${k(de(a.severity))}</span>
|
|
415
415
|
<span class="rte-content-rules-message">${k(a.message)}</span>
|
|
416
416
|
</button>
|
|
417
417
|
${y}
|
|
@@ -432,7 +432,7 @@ function qe(e) {
|
|
|
432
432
|
function Pe(e) {
|
|
433
433
|
const t = h.get(e);
|
|
434
434
|
if (t) return t;
|
|
435
|
-
const n = d.get(e) || E || j(), o = `rte-content-rules-panel-${
|
|
435
|
+
const n = d.get(e) || E || j(), o = `rte-content-rules-panel-${ye++}`, r = document.createElement("section");
|
|
436
436
|
return r.className = f, r.id = o, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "false"), r.setAttribute("aria-label", n.labels.panelAriaLabel), r.innerHTML = `
|
|
437
437
|
<header class="rte-content-rules-header">
|
|
438
438
|
<h2 class="rte-content-rules-title">${k(n.labels.panelTitle)}</h2>
|
|
@@ -502,14 +502,14 @@ function Q(e, t) {
|
|
|
502
502
|
const n = U(e);
|
|
503
503
|
return (typeof t == "boolean" ? t : !n) ? ne(e) : W(e, !1), !0;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function he(e) {
|
|
506
506
|
const t = V.get(e);
|
|
507
507
|
typeof t == "number" && (window.clearTimeout(t), _.delete(t), V.delete(e));
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function pe(e) {
|
|
510
510
|
const t = d.get(e) || E;
|
|
511
511
|
if (!t || !A(e, t)) return;
|
|
512
|
-
|
|
512
|
+
he(e);
|
|
513
513
|
const n = window.setTimeout(() => {
|
|
514
514
|
_.delete(n), V.delete(e), v(e, t, !1);
|
|
515
515
|
}, t.debounceMs);
|
|
@@ -737,7 +737,7 @@ function De() {
|
|
|
737
737
|
.rte-content-rules-btn-primary:hover,
|
|
738
738
|
.rte-content-rules-btn-primary:focus-visible {
|
|
739
739
|
border-color: #0369a1;
|
|
740
|
-
background: #
|
|
740
|
+
background: #0369a1;
|
|
741
741
|
color: #ffffff;
|
|
742
742
|
}
|
|
743
743
|
|
|
@@ -917,7 +917,7 @@ function Ne(e) {
|
|
|
917
917
|
r && (G(r, o), J(o, r), O(o, r, d.get(o) || e)), $(o, "toggleContentRulesPanel", U(o)), $(o, "toggleContentRulesRealtime", A(o, e));
|
|
918
918
|
}, document.addEventListener("focusin", L, !0)), I || (I = (t) => {
|
|
919
919
|
const o = t.target?.closest(R);
|
|
920
|
-
o && (g = o,
|
|
920
|
+
o && (g = o, pe(o));
|
|
921
921
|
}, document.addEventListener("input", I, !0)), H || (H = (t) => {
|
|
922
922
|
if (t.defaultPrevented || t.target?.closest("input, textarea, select")) return;
|
|
923
923
|
const o = t.key === "Escape", r = ze(t), s = _e(t), i = Be(t);
|
|
@@ -948,7 +948,7 @@ function Ne(e) {
|
|
|
948
948
|
}, document.addEventListener("keydown", H, !0)), S || (S = () => {
|
|
949
949
|
h.forEach((t, n) => {
|
|
950
950
|
if (!n.isConnected || !t.isConnected) {
|
|
951
|
-
|
|
951
|
+
he(n), t.remove(), h.delete(n), B.delete(n);
|
|
952
952
|
return;
|
|
953
953
|
}
|
|
954
954
|
G(t, n), J(n, t);
|
|
@@ -1082,7 +1082,7 @@ const je = (e = {}) => {
|
|
|
1082
1082
|
o && o.editorElement ? { editorElement: o.editorElement } : void 0,
|
|
1083
1083
|
!1
|
|
1084
1084
|
);
|
|
1085
|
-
s && (g = s, d.set(s, r), T.set(s, r.enableRealtime), C.set(s, []), $(s, "toggleContentRulesPanel", !1), $(s, "toggleContentRulesRealtime", r.enableRealtime), r.enableRealtime &&
|
|
1085
|
+
s && (g = s, d.set(s, r), T.set(s, r.enableRealtime), C.set(s, []), $(s, "toggleContentRulesPanel", !1), $(s, "toggleContentRulesRealtime", r.enableRealtime), r.enableRealtime && pe(s));
|
|
1086
1086
|
},
|
|
1087
1087
|
destroy: () => {
|
|
1088
1088
|
N = Math.max(0, N - 1), !(N > 0) && (_.forEach((n) => {
|
package/dist/data-binding.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const yt=require("./dialogHelpers-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const yt=require("./dialogHelpers-BxSQ7A6M.js"),A=".rte-content, .editora-content",C='.rte-data-binding[data-binding="true"]',it="rte-data-binding-styles",g="rte-data-binding-dialog-overlay",f=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',ht={dialogTitleInsert:"Insert Data Binding",dialogTitleEdit:"Edit Data Binding",keyLabel:"Data Key",keyPlaceholder:"user.firstName",fallbackLabel:"Fallback Text",fallbackPlaceholder:"Guest",formatLabel:"Format",currencyLabel:"Currency",currencyPlaceholder:"USD",saveText:"Save",cancelText:"Cancel",previewOnText:"Preview On",previewOffText:"Preview Off",tokenAriaPrefix:"Data binding token"},v=new WeakMap,W=new WeakMap,b=new WeakMap,K=new WeakMap,G=new WeakMap;let N=null,h=null,q=0,P=null,O=null,M=null,_=null;function kt(t){return{...ht,...t||{}}}function ot(t={}){const n=(t.locale||(typeof navigator<"u"?navigator.language:"en-US")).trim()||"en-US";return{data:t.data,getData:t.getData,api:t.api,cacheTtlMs:Math.max(0,Number(t.cacheTtlMs??3e4)),labels:kt(t.labels),defaultFormat:t.defaultFormat||"text",defaultFallback:t.defaultFallback||"",locale:n,numberFormatOptions:t.numberFormatOptions||{},dateFormatOptions:t.dateFormatOptions||{year:"numeric",month:"short",day:"2-digit"}}}function y(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dt(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function j(t){return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||t}function U(t){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}function vt(t){const n=j(t);if(U(n))return!0;const a=n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return U(a)?!0:U(document.documentElement)||U(document.body)}function D(t,n=!0){if(t?.contentElement instanceof HTMLElement)return t.contentElement;if(t?.editorElement instanceof HTMLElement){const e=t.editorElement;if(e.matches(A))return e;const i=e.querySelector(A);if(i instanceof HTMLElement)return i}const a=window.getSelection();if(a&&a.rangeCount>0){const e=a.getRangeAt(0).startContainer,o=dt(e)?.closest(A);if(o)return o}const r=document.activeElement;if(r){if(r.matches(A))return r;const e=r.closest(A);if(e)return e}return h&&h.isConnected?h:n?document.querySelector(A):null}function R(t){return t.getAttribute("contenteditable")==="false"||t.getAttribute("data-readonly")==="true"}function lt(t){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const a=n.getRangeAt(0);return t.contains(a.commonAncestorContainer)?a.cloneRange():null}function st(t,n){const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(n),t.focus({preventScroll:!0}))}function xt(t,n){const a=(n||"").trim();if(a)return a.split(".").filter(Boolean).reduce((r,e)=>{if(!(r==null||typeof r!="object"))return r[e]},t)}function wt(){if(typeof document>"u"||document.getElementById(it))return;const t=document.createElement("style");t.id=it,t.textContent=`
|
|
2
2
|
.rte-data-binding {
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
align-items: center;
|
|
@@ -318,4 +318,4 @@
|
|
|
318
318
|
<button type="button" class="rte-data-binding-btn" data-action="cancel">${y(o.cancelText)}</button>
|
|
319
319
|
<button type="button" class="rte-data-binding-btn rte-data-binding-btn-primary" data-action="save">${y(o.saveText)}</button>
|
|
320
320
|
</footer>
|
|
321
|
-
`,d.appendChild(c),document.body.appendChild(d);const u=c.querySelector(".rte-data-binding-key"),p=c.querySelector(".rte-data-binding-fallback"),m=c.querySelector(".rte-data-binding-format"),$=c.querySelector(".rte-data-binding-currency"),B=()=>{const s=m?.value==="currency",k=$?.closest(".rte-data-binding-field");k&&(k.style.display=s?"grid":"none")};B(),m?.addEventListener("change",B);const L=()=>{d.removeEventListener("click",nt),d.removeEventListener("keydown",rt,!0),document.removeEventListener("keydown",et,!0),d.parentNode&&d.parentNode.removeChild(d),N=null,t.focus({preventScroll:!0})},et=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),L())},nt=s=>{s.target===d&&L()},mt=s=>{if(s.key!=="Tab")return;const k=Array.from(c.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(k.length===0)return;const w=k[0],E=k[k.length-1],F=document.activeElement;if(s.shiftKey&&F===w){s.preventDefault(),E.focus();return}!s.shiftKey&&F===E&&(s.preventDefault(),w.focus())},at=async()=>{const s=(u?.value||"").trim();if(!s){u?.focus();return}const k=H({key:s,fallback:(p?.value||"").trim(),format:m?.value||n.defaultFormat,currency:($?.value||"USD").trim().toUpperCase()},n),w=t.innerHTML;if(e){X(e,k,o);const E=v.get(t)===!0,F=E?await I(t,n):void 0;T(e,n,E,F)}else{if(i)try{st(t,i)}catch{}const E=ut(k,o);if(bt(t,E),v.get(t)===!0){const pt=await I(t,n);T(E,n,!0,pt)}}J(t),Y(t,w),L()},rt=s=>{if(s.key==="Escape"){s.preventDefault(),L();return}mt(s),s.key==="Enter"&&!s.shiftKey&&s.target instanceof HTMLInputElement&&(s.preventDefault(),at())};c.addEventListener("click",s=>{const w=s.target?.getAttribute("data-action");if(w){if(w==="cancel"){L();return}w==="save"&&at()}}),d.addEventListener("click",nt),d.addEventListener("keydown",rt,!0),document.addEventListener("keydown",et,!0),N={cleanup:L},u?.focus()}function Lt(t){_=t,O||(O=n=>{const r=n.target?.closest(A);if(!r)return;h=r,b.has(r)||b.set(r,t);const e=b.get(r)||t;V(r,e);const i=v.get(r)===!0;tt(r,i,e),i||Array.from(r.querySelectorAll(C)).forEach(l=>T(l,e,!1))},document.addEventListener("focusin",O,!0)),P||(P=n=>{if(document.querySelector(`.${g}`))return;const a=n.target;if(a?.closest("input, textarea, select"))return;const r=D(void 0,!1);if(!r||R(r))return;const e=b.get(r)||_||t,i=a?.closest(C);if(i&&(n.key==="Enter"||n.key===" ")){n.preventDefault(),n.stopPropagation(),h=r,S(r,e,"edit",void 0,i);return}if(Tt(n)){n.preventDefault(),n.stopPropagation();const o=Q(r);o?S(r,e,"edit",void 0,o):S(r,e,"insert");return}if($t(n)){n.preventDefault(),n.stopPropagation();const o=v.get(r)!==!0;z(r,e,o)}},document.addEventListener("keydown",P,!0)),M||(M=n=>{if(document.querySelector(`.${g}`)||n.defaultPrevented||n.button!==0||n.metaKey||n.ctrlKey||n.altKey||n.shiftKey)return;const r=n.target?.closest(C);if(!r)return;const e=r.closest(A);if(!e||R(e))return;const i=b.get(e)||_||t;b.set(e,i),h=e,n.preventDefault(),n.stopPropagation(),r.focus({preventScroll:!0}),S(e,i,"edit",void 0,r)},document.addEventListener("click",M,!0))}function Ct(){O&&(document.removeEventListener("focusin",O,!0),O=null),P&&(document.removeEventListener("keydown",P,!0),P=null),M&&(document.removeEventListener("click",M,!0),M=null),_=null,h=null}const Pt=(t={})=>{const n=ot(t);return wt(),{name:"dataBinding",toolbar:[{id:"dataBindingTools",label:"Data Binding",type:"group",command:"openDataBindingDialog",items:[{id:"dataBinding",label:"Data Binding",command:"openDataBindingDialog",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 4a3 3 0 0 0-3 3v3h2V7a1 1 0 0 1 1-1h3V4H7Zm10 0h-3v2h3a1 1 0 0 1 1 1v3h2V7a3 3 0 0 0-3-3ZM4 14v3a3 3 0 0 0 3 3h3v-2H7a1 1 0 0 1-1-1v-3H4Zm14 0v3a1 1 0 0 1-1 1h-3v2h3a3 3 0 0 0 3-3v-3h-2ZM8.5 12a1.5 1.5 0 1 1 0-3h7a1.5 1.5 0 0 1 0 3h-7Zm0 4a1.5 1.5 0 1 1 0-3h4a1.5 1.5 0 0 1 0 3h-4Z" fill="currentColor"></path></svg>'},{id:"dataBindingPreview",label:"Data Preview",command:"toggleDataBindingPreview",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3c-4.4 0-8 1.3-8 3v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6c0-1.7-3.6-3-8-3Zm0 2c3.9 0 6 .9 6 1s-2.1 1-6 1-6-.9-6-1 2.1-1 6-1Zm0 4c3 0 5.6-.5 7-1.3V11c0 .9-2.7 2-7 2s-7-1.1-7-2V7.7C6.4 8.5 9 9 12 9Zm0 6c-4.3 0-7-1.1-7-2v3c0 .9 2.7 2 7 2s7-1.1 7-2v-3c0 .9-2.7 2-7 2Z" fill="currentColor"></path><path d="M16.5 9.4a1 1 0 0 1 1.4 0l1.1 1.1 1.8-1.8a1 1 0 1 1 1.4 1.4l-2.5 2.5a1 1 0 0 1-1.4 0l-1.8-1.8a1 1 0 0 1 0-1.4Z" fill="currentColor"></path></svg>'}]}],commands:{openDataBindingDialog:(a,r)=>{const e=D(r);if(!e||R(e))return!1;h=e;const i=b.get(e)||n;b.set(e,i),V(e,i);const o=a?.target;if(o==="insert")return S(e,i,"insert",a),!0;const l=Q(e);return o==="edit"||l?!l&&o==="edit"?!1:(S(e,i,"edit",a,l||void 0),!0):(S(e,i,"insert",a),!0)},insertDataBindingToken:async(a,r)=>{const e=D(r);if(!e||R(e))return!1;h=e;const i=b.get(e)||n;b.set(e,i);const o=H(a||{},i);if(!o.key)return!1;const l=e.innerHTML,d=ut(o,i.labels);if(bt(e,d),v.get(e)===!0){const u=await I(e,i);T(d,i,!0,u)}return J(e),Y(e,l),!0},editDataBindingToken:async(a,r)=>{const e=D(r);if(!e||R(e))return!1;h=e;const i=b.get(e)||n;b.set(e,i);const o=Q(e);if(!o)return!1;const l=Z(o,i),d=H({...l,...a||{}},i);if(!d.key)return!1;const c=e.innerHTML;X(o,d,i.labels);const u=v.get(e)===!0,p=u?await I(e,i):void 0;return T(o,i,u,p),J(e),Y(e,c),!0},toggleDataBindingPreview:async(a,r)=>{const e=D(r);if(!e)return!1;h=e;const i=b.get(e)||n;b.set(e,i);const o=typeof a=="boolean"?a:v.get(e)!==!0;return await z(e,i,o),!0},setDataBindingData:async(a,r)=>{const e=D(r);if(!e)return!1;if(h=e,a&&typeof a=="object"?(W.set(e,a),K.set(e,{timestamp:Date.now(),data:a})):(W.delete(e),K.delete(e)),v.get(e)===!0){const i=b.get(e)||n;await z(e,i,!0)}return!0},refreshDataBindings:async(a,r)=>{const e=D(r);if(!e)return!1;h=e,K.delete(e);const i=b.get(e)||n;b.set(e,i);const o=v.get(e)===!0;return await z(e,i,o),!0}},keymap:{"Mod-Alt-Shift-d":"openDataBindingDialog","Mod-Alt-Shift-D":"openDataBindingDialog","Mod-Alt-Shift-b":"toggleDataBindingPreview","Mod-Alt-Shift-B":"toggleDataBindingPreview",F7:"openDataBindingDialog",F8:"toggleDataBindingPreview"},init:function(r){q+=1;const e=this&&typeof this.__pluginConfig=="object"?ot({...n,...this.__pluginConfig}):n;Lt(e);const i=D(r&&r.editorElement?{editorElement:r.editorElement}:void 0,!1);if(i){h=i,b.set(i,e),V(i,e);const o=v.get(i)===!0;tt(i,o,e)}},destroy:()=>{q=Math.max(0,q-1),q===0&&(ft(),Ct())}}};exports.DataBindingPlugin=Pt;
|
|
321
|
+
`,d.appendChild(c),document.body.appendChild(d);const u=c.querySelector(".rte-data-binding-key"),p=c.querySelector(".rte-data-binding-fallback"),m=c.querySelector(".rte-data-binding-format"),$=c.querySelector(".rte-data-binding-currency"),B=()=>{const s=m?.value==="currency",k=$?.closest(".rte-data-binding-field");k&&(k.style.display=s?"grid":"none")};B(),m?.addEventListener("change",B);const L=()=>{d.removeEventListener("click",nt),d.removeEventListener("keydown",rt,!0),document.removeEventListener("keydown",et,!0),d.parentNode&&d.parentNode.removeChild(d),N=null,t.focus({preventScroll:!0})},et=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),L())},nt=s=>{s.target===d&&L()},mt=s=>{if(s.key!=="Tab"||s.defaultPrevented)return;const k=Array.from(c.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(k.length===0)return;const w=k[0],E=k[k.length-1],F=document.activeElement;if(s.shiftKey&&F===w){s.preventDefault(),E.focus();return}!s.shiftKey&&F===E&&(s.preventDefault(),w.focus())},at=async()=>{const s=(u?.value||"").trim();if(!s){u?.focus();return}const k=H({key:s,fallback:(p?.value||"").trim(),format:m?.value||n.defaultFormat,currency:($?.value||"USD").trim().toUpperCase()},n),w=t.innerHTML;if(e){X(e,k,o);const E=v.get(t)===!0,F=E?await I(t,n):void 0;T(e,n,E,F)}else{if(i)try{st(t,i)}catch{}const E=ut(k,o);if(bt(t,E),v.get(t)===!0){const pt=await I(t,n);T(E,n,!0,pt)}}J(t),Y(t,w),L()},rt=s=>{if(s.key==="Escape"){s.preventDefault(),L();return}mt(s),s.key==="Enter"&&!s.shiftKey&&s.target instanceof HTMLInputElement&&(s.preventDefault(),at())};c.addEventListener("click",s=>{const w=s.target?.getAttribute("data-action");if(w){if(w==="cancel"){L();return}w==="save"&&at()}}),d.addEventListener("click",nt),d.addEventListener("keydown",rt,!0),document.addEventListener("keydown",et,!0),N={cleanup:L},u?.focus()}function Lt(t){_=t,O||(O=n=>{const r=n.target?.closest(A);if(!r)return;h=r,b.has(r)||b.set(r,t);const e=b.get(r)||t;V(r,e);const i=v.get(r)===!0;tt(r,i,e),i||Array.from(r.querySelectorAll(C)).forEach(l=>T(l,e,!1))},document.addEventListener("focusin",O,!0)),P||(P=n=>{if(document.querySelector(`.${g}`))return;const a=n.target;if(a?.closest("input, textarea, select"))return;const r=D(void 0,!1);if(!r||R(r))return;const e=b.get(r)||_||t,i=a?.closest(C);if(i&&(n.key==="Enter"||n.key===" ")){n.preventDefault(),n.stopPropagation(),h=r,S(r,e,"edit",void 0,i);return}if(Tt(n)){n.preventDefault(),n.stopPropagation();const o=Q(r);o?S(r,e,"edit",void 0,o):S(r,e,"insert");return}if($t(n)){n.preventDefault(),n.stopPropagation();const o=v.get(r)!==!0;z(r,e,o)}},document.addEventListener("keydown",P,!0)),M||(M=n=>{if(document.querySelector(`.${g}`)||n.defaultPrevented||n.button!==0||n.metaKey||n.ctrlKey||n.altKey||n.shiftKey)return;const r=n.target?.closest(C);if(!r)return;const e=r.closest(A);if(!e||R(e))return;const i=b.get(e)||_||t;b.set(e,i),h=e,n.preventDefault(),n.stopPropagation(),r.focus({preventScroll:!0}),S(e,i,"edit",void 0,r)},document.addEventListener("click",M,!0))}function Ct(){O&&(document.removeEventListener("focusin",O,!0),O=null),P&&(document.removeEventListener("keydown",P,!0),P=null),M&&(document.removeEventListener("click",M,!0),M=null),_=null,h=null}const Pt=(t={})=>{const n=ot(t);return wt(),{name:"dataBinding",toolbar:[{id:"dataBindingTools",label:"Data Binding",type:"group",command:"openDataBindingDialog",items:[{id:"dataBinding",label:"Data Binding",command:"openDataBindingDialog",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 4a3 3 0 0 0-3 3v3h2V7a1 1 0 0 1 1-1h3V4H7Zm10 0h-3v2h3a1 1 0 0 1 1 1v3h2V7a3 3 0 0 0-3-3ZM4 14v3a3 3 0 0 0 3 3h3v-2H7a1 1 0 0 1-1-1v-3H4Zm14 0v3a1 1 0 0 1-1 1h-3v2h3a3 3 0 0 0 3-3v-3h-2ZM8.5 12a1.5 1.5 0 1 1 0-3h7a1.5 1.5 0 0 1 0 3h-7Zm0 4a1.5 1.5 0 1 1 0-3h4a1.5 1.5 0 0 1 0 3h-4Z" fill="currentColor"></path></svg>'},{id:"dataBindingPreview",label:"Data Preview",command:"toggleDataBindingPreview",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3c-4.4 0-8 1.3-8 3v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6c0-1.7-3.6-3-8-3Zm0 2c3.9 0 6 .9 6 1s-2.1 1-6 1-6-.9-6-1 2.1-1 6-1Zm0 4c3 0 5.6-.5 7-1.3V11c0 .9-2.7 2-7 2s-7-1.1-7-2V7.7C6.4 8.5 9 9 12 9Zm0 6c-4.3 0-7-1.1-7-2v3c0 .9 2.7 2 7 2s7-1.1 7-2v-3c0 .9-2.7 2-7 2Z" fill="currentColor"></path><path d="M16.5 9.4a1 1 0 0 1 1.4 0l1.1 1.1 1.8-1.8a1 1 0 1 1 1.4 1.4l-2.5 2.5a1 1 0 0 1-1.4 0l-1.8-1.8a1 1 0 0 1 0-1.4Z" fill="currentColor"></path></svg>'}]}],commands:{openDataBindingDialog:(a,r)=>{const e=D(r);if(!e||R(e))return!1;h=e;const i=b.get(e)||n;b.set(e,i),V(e,i);const o=a?.target;if(o==="insert")return S(e,i,"insert",a),!0;const l=Q(e);return o==="edit"||l?!l&&o==="edit"?!1:(S(e,i,"edit",a,l||void 0),!0):(S(e,i,"insert",a),!0)},insertDataBindingToken:async(a,r)=>{const e=D(r);if(!e||R(e))return!1;h=e;const i=b.get(e)||n;b.set(e,i);const o=H(a||{},i);if(!o.key)return!1;const l=e.innerHTML,d=ut(o,i.labels);if(bt(e,d),v.get(e)===!0){const u=await I(e,i);T(d,i,!0,u)}return J(e),Y(e,l),!0},editDataBindingToken:async(a,r)=>{const e=D(r);if(!e||R(e))return!1;h=e;const i=b.get(e)||n;b.set(e,i);const o=Q(e);if(!o)return!1;const l=Z(o,i),d=H({...l,...a||{}},i);if(!d.key)return!1;const c=e.innerHTML;X(o,d,i.labels);const u=v.get(e)===!0,p=u?await I(e,i):void 0;return T(o,i,u,p),J(e),Y(e,c),!0},toggleDataBindingPreview:async(a,r)=>{const e=D(r);if(!e)return!1;h=e;const i=b.get(e)||n;b.set(e,i);const o=typeof a=="boolean"?a:v.get(e)!==!0;return await z(e,i,o),!0},setDataBindingData:async(a,r)=>{const e=D(r);if(!e)return!1;if(h=e,a&&typeof a=="object"?(W.set(e,a),K.set(e,{timestamp:Date.now(),data:a})):(W.delete(e),K.delete(e)),v.get(e)===!0){const i=b.get(e)||n;await z(e,i,!0)}return!0},refreshDataBindings:async(a,r)=>{const e=D(r);if(!e)return!1;h=e,K.delete(e);const i=b.get(e)||n;b.set(e,i);const o=v.get(e)===!0;return await z(e,i,o),!0}},keymap:{"Mod-Alt-Shift-d":"openDataBindingDialog","Mod-Alt-Shift-D":"openDataBindingDialog","Mod-Alt-Shift-b":"toggleDataBindingPreview","Mod-Alt-Shift-B":"toggleDataBindingPreview",F7:"openDataBindingDialog",F8:"toggleDataBindingPreview"},init:function(r){q+=1;const e=this&&typeof this.__pluginConfig=="object"?ot({...n,...this.__pluginConfig}):n;Lt(e);const i=D(r&&r.editorElement?{editorElement:r.editorElement}:void 0,!1);if(i){h=i,b.set(i,e),V(i,e);const o=v.get(i)===!0;tt(i,o,e)}},destroy:()=>{q=Math.max(0,q-1),q===0&&(ft(),Ct())}}};exports.DataBindingPlugin=Pt;
|
package/dist/data-binding.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as yt } from "./dialogHelpers-
|
|
1
|
+
import { i as yt } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
2
2
|
const A = ".rte-content, .editora-content", C = '.rte-data-binding[data-binding="true"]', it = "rte-data-binding-styles", g = "rte-data-binding-dialog-overlay", f = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ht = {
|
|
3
3
|
dialogTitleInsert: "Insert Data Binding",
|
|
4
4
|
dialogTitleEdit: "Edit Data Binding",
|
|
@@ -683,7 +683,7 @@ function S(t, n, a, r, e) {
|
|
|
683
683
|
}, nt = (s) => {
|
|
684
684
|
s.target === d && L();
|
|
685
685
|
}, mt = (s) => {
|
|
686
|
-
if (s.key !== "Tab") return;
|
|
686
|
+
if (s.key !== "Tab" || s.defaultPrevented) return;
|
|
687
687
|
const k = Array.from(
|
|
688
688
|
c.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
|
|
689
689
|
);
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
function y(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 h = "rte-dialog-base-styles";
|
|
18
|
+
function w() {
|
|
19
|
+
if (typeof document > "u" || document.getElementById(h)) return;
|
|
20
|
+
const t = document.createElement("style");
|
|
21
|
+
t.id = h, 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 M(t) {
|
|
35
|
+
t.setAttribute("data-rte-dialog", ""), w(), y(t), H(t);
|
|
36
|
+
}
|
|
37
|
+
const T = 'a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';
|
|
38
|
+
function C(t, n) {
|
|
39
|
+
for (let e = t; e; e = e.parentElement) {
|
|
40
|
+
if (e.hidden || e.getAttribute("aria-hidden") === "true") return !1;
|
|
41
|
+
const o = window.getComputedStyle(e);
|
|
42
|
+
if (o.display === "none" || o.visibility === "hidden") return !1;
|
|
43
|
+
if (e === n) break;
|
|
44
|
+
}
|
|
45
|
+
return !0;
|
|
46
|
+
}
|
|
47
|
+
function g(t) {
|
|
48
|
+
return Array.from(t.querySelectorAll(T)).filter(
|
|
49
|
+
(n) => !n.disabled && n.getAttribute("tabindex") !== "-1" && C(n, t)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function x(t) {
|
|
53
|
+
const n = g(t);
|
|
54
|
+
return n.filter((e) => {
|
|
55
|
+
if (!(e instanceof HTMLInputElement) || e.type !== "radio" || !e.name) return !0;
|
|
56
|
+
const o = n.filter(
|
|
57
|
+
(r) => r instanceof HTMLInputElement && r.type === "radio" && r.name === e.name
|
|
58
|
+
), i = o.find((r) => r.checked) ?? o[0];
|
|
59
|
+
return e === i;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function E(t) {
|
|
63
|
+
const n = `${t.getAttribute("aria-label") ?? ""} ${t.className?.toString() ?? ""}`.toLowerCase(), e = (t.textContent ?? "").trim();
|
|
64
|
+
return /close|dismiss/.test(n) || /^[\u00d7\u2715\u2716x]$/i.test(e);
|
|
65
|
+
}
|
|
66
|
+
function p(t) {
|
|
67
|
+
if (!t || !t.isConnected) return;
|
|
68
|
+
const n = g(t), e = n.find((o) => !E(o)) ?? n[0];
|
|
69
|
+
if (e) {
|
|
70
|
+
e.focus({ preventScroll: !0 });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
|
|
74
|
+
}
|
|
75
|
+
const v = ["id", "data-action", "data-comment-id", "data-id", "data-index", "data-suggestion", "data-value", "name"];
|
|
76
|
+
function L(t) {
|
|
77
|
+
let n = t.tagName.toLowerCase();
|
|
78
|
+
const e = t.classList[0];
|
|
79
|
+
e && /^[\w-]+$/.test(e) && (n += `.${e}`);
|
|
80
|
+
for (const o of v) {
|
|
81
|
+
const i = t.getAttribute(o);
|
|
82
|
+
i !== null && /^[\w:.-]*$/.test(i) && (n += `[${o}="${i}"]`);
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
}
|
|
86
|
+
function k(t, n) {
|
|
87
|
+
const e = t && I(t) ? document.activeElement : null;
|
|
88
|
+
let o = "", i = 0;
|
|
89
|
+
t && e && e !== t && (o = L(e), i = Array.from(t.querySelectorAll(o)).indexOf(e));
|
|
90
|
+
const r = !!t && document.activeElement === t;
|
|
91
|
+
if (n(), !t) return;
|
|
92
|
+
if (r) {
|
|
93
|
+
p(t);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (!e || e.isConnected) return;
|
|
97
|
+
const u = o ? Array.from(t.querySelectorAll(o)).filter((m) => C(m, t)) : [], d = u[Math.min(Math.max(i, 0), u.length - 1)];
|
|
98
|
+
d ? d.focus({ preventScroll: !0 }) : p(t);
|
|
99
|
+
}
|
|
100
|
+
function B(t, n) {
|
|
101
|
+
const e = n?.commonAncestorContainer ?? null, i = (e ? (e instanceof HTMLElement ? e : e.parentElement)?.closest('[contenteditable="true"]') ?? null : null) ?? (t ? t.matches('[contenteditable="true"]') ? t : t.querySelector('[contenteditable="true"]') ?? t.closest('[contenteditable="true"]') : null);
|
|
102
|
+
if (!i || !i.isConnected || (i.focus({ preventScroll: !0 }), !n || !n.startContainer.isConnected || !n.endContainer.isConnected || !i.contains(n.commonAncestorContainer))) return;
|
|
103
|
+
const r = window.getSelection();
|
|
104
|
+
r && (r.removeAllRanges(), r.addRange(n));
|
|
105
|
+
}
|
|
106
|
+
let R = 0;
|
|
107
|
+
function N(t, n, e) {
|
|
108
|
+
if (t) {
|
|
109
|
+
if (!n || !e || !e.id) {
|
|
110
|
+
t.removeAttribute("aria-activedescendant"), t.removeAttribute("aria-controls");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
n.id || (n.id = `rte-suggestions-${++R}`), t.setAttribute("aria-controls", n.id), t.setAttribute("aria-activedescendant", e.id);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function I(t) {
|
|
117
|
+
if (!t) return !1;
|
|
118
|
+
const n = document.activeElement;
|
|
119
|
+
return !!n && t.contains(n);
|
|
120
|
+
}
|
|
121
|
+
function D(t) {
|
|
122
|
+
const n = t.querySelector(
|
|
123
|
+
'h1, h2, h3, h4, [class*="title"], [class*="header"], header, [role="heading"]'
|
|
124
|
+
);
|
|
125
|
+
if (!n) return "";
|
|
126
|
+
const e = n.cloneNode(!0);
|
|
127
|
+
return e.querySelectorAll('button, [role="button"], [aria-label*="lose"], [class*="close"]').forEach((o) => o.remove()), (e.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
128
|
+
}
|
|
129
|
+
function H(t) {
|
|
130
|
+
const n = document.activeElement instanceof HTMLElement ? document.activeElement : null, e = window.getSelection(), o = e && e.rangeCount > 0 ? e.getRangeAt(0).cloneRange() : null, i = o ? (o.commonAncestorContainer instanceof HTMLElement ? o.commonAncestorContainer : o.commonAncestorContainer.parentElement)?.closest('[contenteditable="true"]') ?? null : null, r = i ? i.innerHTML : null;
|
|
131
|
+
t.addEventListener("keydown", (a) => {
|
|
132
|
+
if (a.key !== "Tab" || a.defaultPrevented) return;
|
|
133
|
+
const c = x(t);
|
|
134
|
+
if (c.length === 0) {
|
|
135
|
+
a.preventDefault();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const s = c.indexOf(document.activeElement), f = a.shiftKey ? -1 : 1, b = s === -1 ? a.shiftKey ? c[c.length - 1] : c[0] : c[(s + f + c.length) % c.length];
|
|
139
|
+
a.preventDefault(), b.focus();
|
|
140
|
+
});
|
|
141
|
+
let u = !1;
|
|
142
|
+
const d = (a) => {
|
|
143
|
+
if (!t.isConnected) {
|
|
144
|
+
a < 3 && window.setTimeout(() => d(a + 1), 50);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
u = !0;
|
|
148
|
+
const s = (((l) => ["dialog", "alertdialog"].includes(l.getAttribute("role") ?? ""))(t) ? t : null) ?? t.querySelector('[role="dialog"], [role="alertdialog"]') ?? (t.firstElementChild instanceof HTMLElement ? t.firstElementChild : null) ?? t;
|
|
149
|
+
s.getAttribute("role") || s.setAttribute("role", "dialog"), s.hasAttribute("aria-modal") || s.setAttribute("aria-modal", "true");
|
|
150
|
+
const f = s.getAttribute("aria-labelledby");
|
|
151
|
+
if (!(!!s.getAttribute("aria-label") || !!f && !!document.getElementById(f.split(/\s+/)[0]))) {
|
|
152
|
+
const l = D(s);
|
|
153
|
+
l && (s.removeAttribute("aria-labelledby"), s.setAttribute("aria-label", l));
|
|
154
|
+
}
|
|
155
|
+
if (!t.contains(document.activeElement)) {
|
|
156
|
+
const l = g(t), A = l.find((S) => !E(S)) ?? l[0];
|
|
157
|
+
A ? A.focus({ preventScroll: !0 }) : (s.setAttribute("tabindex", "-1"), s.focus({ preventScroll: !0 }));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
window.setTimeout(() => d(0), 0);
|
|
161
|
+
const m = new MutationObserver(() => {
|
|
162
|
+
if (t.isConnected && (u = !0), t.isConnected || !u) return;
|
|
163
|
+
m.disconnect();
|
|
164
|
+
const a = document.activeElement;
|
|
165
|
+
if (!a || a === document.body || t.contains(a)) {
|
|
166
|
+
const s = i?.isConnected ? i : n;
|
|
167
|
+
s && s.isConnected && s.focus({ preventScroll: !0 });
|
|
168
|
+
}
|
|
169
|
+
if (o && i && i.isConnected && i.innerHTML === r && e) {
|
|
170
|
+
const s = e.rangeCount > 0 ? e.getRangeAt(0) : null;
|
|
171
|
+
!(s && s.compareBoundaryPoints(Range.START_TO_START, o) === 0 && s.compareBoundaryPoints(Range.END_TO_END, o) === 0) && i.contains(o.startContainer) && i.contains(o.endContainer) && (e.removeAllRanges(), e.addRange(o));
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
m.observe(document.body, { childList: !0, subtree: !0 });
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
N as a,
|
|
178
|
+
p as f,
|
|
179
|
+
M as i,
|
|
180
|
+
k,
|
|
181
|
+
I as p,
|
|
182
|
+
B as r
|
|
183
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";function T(e){let n=!1;e.addEventListener("pointerdown",t=>{n=t.target!==e},!0),e.addEventListener("click",t=>{t.target===e&&n&&t.stopImmediatePropagation(),n=!1},!0)}const p="rte-dialog-base-styles";function w(){if(typeof document>"u"||document.getElementById(p))return;const e=document.createElement("style");e.id=p,e.textContent=`
|
|
2
|
+
[data-rte-dialog] {
|
|
3
|
+
font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* Form controls ignore inherited fonts (browsers default them to Arial /
|
|
7
|
+
system-ui). :where() keeps this at zero specificity so any control a plugin
|
|
8
|
+
styles explicitly - e.g. a monospace formula field - keeps its own font. */
|
|
9
|
+
:where([data-rte-dialog]) :where(button, input, select, textarea) {
|
|
10
|
+
font-family: inherit;
|
|
11
|
+
}
|
|
12
|
+
`,document.head.appendChild(e)}function x(e){e.setAttribute("data-rte-dialog",""),w(),T(e),F(e)}const v='a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';function C(e,n){for(let t=e;t;t=t.parentElement){if(t.hidden||t.getAttribute("aria-hidden")==="true")return!1;const o=window.getComputedStyle(t);if(o.display==="none"||o.visibility==="hidden")return!1;if(t===n)break}return!0}function b(e){return Array.from(e.querySelectorAll(v)).filter(n=>!n.disabled&&n.getAttribute("tabindex")!=="-1"&&C(n,e))}function L(e){const n=b(e);return n.filter(t=>{if(!(t instanceof HTMLInputElement)||t.type!=="radio"||!t.name)return!0;const o=n.filter(r=>r instanceof HTMLInputElement&&r.type==="radio"&&r.name===t.name),i=o.find(r=>r.checked)??o[0];return t===i})}function E(e){const n=`${e.getAttribute("aria-label")??""} ${e.className?.toString()??""}`.toLowerCase(),t=(e.textContent??"").trim();return/close|dismiss/.test(n)||/^[\u00d7\u2715\u2716x]$/i.test(t)}function g(e){if(!e||!e.isConnected)return;const n=b(e),t=n.find(o=>!E(o))??n[0];if(t){t.focus({preventScroll:!0});return}e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0})}const R=["id","data-action","data-comment-id","data-id","data-index","data-suggestion","data-value","name"];function I(e){let n=e.tagName.toLowerCase();const t=e.classList[0];t&&/^[\w-]+$/.test(t)&&(n+=`.${t}`);for(const o of R){const i=e.getAttribute(o);i!==null&&/^[\w:.-]*$/.test(i)&&(n+=`[${o}="${i}"]`)}return n}function D(e,n){const t=e&&S(e)?document.activeElement:null;let o="",i=0;e&&t&&t!==e&&(o=I(t),i=Array.from(e.querySelectorAll(o)).indexOf(t));const r=!!e&&document.activeElement===e;if(n(),!e)return;if(r){g(e);return}if(!t||t.isConnected)return;const u=o?Array.from(e.querySelectorAll(o)).filter(m=>C(m,e)):[],d=u[Math.min(Math.max(i,0),u.length-1)];d?d.focus({preventScroll:!0}):g(e)}function H(e,n){const t=n?.commonAncestorContainer??null,i=(t?(t instanceof HTMLElement?t:t.parentElement)?.closest('[contenteditable="true"]')??null:null)??(e?e.matches('[contenteditable="true"]')?e:e.querySelector('[contenteditable="true"]')??e.closest('[contenteditable="true"]'):null);if(!i||!i.isConnected||(i.focus({preventScroll:!0}),!n||!n.startContainer.isConnected||!n.endContainer.isConnected||!i.contains(n.commonAncestorContainer)))return;const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}let M=0;function k(e,n,t){if(e){if(!n||!t||!t.id){e.removeAttribute("aria-activedescendant"),e.removeAttribute("aria-controls");return}n.id||(n.id=`rte-suggestions-${++M}`),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-activedescendant",t.id)}}function S(e){if(!e)return!1;const n=document.activeElement;return!!n&&e.contains(n)}function B(e){const n=e.querySelector('h1, h2, h3, h4, [class*="title"], [class*="header"], header, [role="heading"]');if(!n)return"";const t=n.cloneNode(!0);return t.querySelectorAll('button, [role="button"], [aria-label*="lose"], [class*="close"]').forEach(o=>o.remove()),(t.textContent??"").replace(/\s+/g," ").trim()}function F(e){const n=document.activeElement instanceof HTMLElement?document.activeElement:null,t=window.getSelection(),o=t&&t.rangeCount>0?t.getRangeAt(0).cloneRange():null,i=o?(o.commonAncestorContainer instanceof HTMLElement?o.commonAncestorContainer:o.commonAncestorContainer.parentElement)?.closest('[contenteditable="true"]')??null:null,r=i?i.innerHTML:null;e.addEventListener("keydown",a=>{if(a.key!=="Tab"||a.defaultPrevented)return;const c=L(e);if(c.length===0){a.preventDefault();return}const s=c.indexOf(document.activeElement),f=a.shiftKey?-1:1,A=s===-1?a.shiftKey?c[c.length-1]:c[0]:c[(s+f+c.length)%c.length];a.preventDefault(),A.focus()});let u=!1;const d=a=>{if(!e.isConnected){a<3&&window.setTimeout(()=>d(a+1),50);return}u=!0;const s=((l=>["dialog","alertdialog"].includes(l.getAttribute("role")??""))(e)?e:null)??e.querySelector('[role="dialog"], [role="alertdialog"]')??(e.firstElementChild instanceof HTMLElement?e.firstElementChild:null)??e;s.getAttribute("role")||s.setAttribute("role","dialog"),s.hasAttribute("aria-modal")||s.setAttribute("aria-modal","true");const f=s.getAttribute("aria-labelledby");if(!(!!s.getAttribute("aria-label")||!!f&&!!document.getElementById(f.split(/\s+/)[0]))){const l=B(s);l&&(s.removeAttribute("aria-labelledby"),s.setAttribute("aria-label",l))}if(!e.contains(document.activeElement)){const l=b(e),h=l.find(y=>!E(y))??l[0];h?h.focus({preventScroll:!0}):(s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}))}};window.setTimeout(()=>d(0),0);const m=new MutationObserver(()=>{if(e.isConnected&&(u=!0),e.isConnected||!u)return;m.disconnect();const a=document.activeElement;if(!a||a===document.body||e.contains(a)){const s=i?.isConnected?i:n;s&&s.isConnected&&s.focus({preventScroll:!0})}if(o&&i&&i.isConnected&&i.innerHTML===r&&t){const s=t.rangeCount>0?t.getRangeAt(0):null;!(s&&s.compareBoundaryPoints(Range.START_TO_START,o)===0&&s.compareBoundaryPoints(Range.END_TO_END,o)===0)&&i.contains(o.startContainer)&&i.contains(o.endContainer)&&(t.removeAllRanges(),t.addRange(o))}});m.observe(document.body,{childList:!0,subtree:!0})}exports.announceActiveOption=k;exports.focusPanel=g;exports.initDialogOverlay=x;exports.keepPanelFocus=D;exports.panelHasFocus=S;exports.returnFocusToText=H;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-CtR8olYy.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
|