@editora/core 1.0.15 → 1.0.17
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-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-XsYC_KdJ.mjs +3923 -0
- package/dist/index-_eKRBZPq.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2055 -476
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2223 -643
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { i as Ie } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
2
|
+
const w = ".rte-content, .editora-content", A = '.rte-conditional-block[data-conditional-content="true"]', f = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', b = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', p = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", g = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Te = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", T = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
|
|
3
|
+
let de = null, me = 0, Y = null, J = null, Q = null, ee = null, te = null, oe = null, O = null, y = null, ne = null;
|
|
4
|
+
const je = {
|
|
4
5
|
dialogTitleInsert: "Insert Conditional Content",
|
|
5
6
|
dialogTitleEdit: "Edit Conditional Content",
|
|
6
7
|
conditionLabel: "Condition",
|
|
@@ -20,18 +21,18 @@ const ze = {
|
|
|
20
21
|
function $(e) {
|
|
21
22
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function P(e) {
|
|
24
25
|
return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : [];
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function Se(e) {
|
|
27
28
|
return !e || e.length === 0 ? "" : e.join(", ");
|
|
28
29
|
}
|
|
29
30
|
function ie(e) {
|
|
30
31
|
return e ? e.map((t) => t.trim()).filter(Boolean) : [];
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function Ve(e) {
|
|
33
34
|
return {
|
|
34
|
-
...
|
|
35
|
+
...je,
|
|
35
36
|
...e || {}
|
|
36
37
|
};
|
|
37
38
|
}
|
|
@@ -46,7 +47,7 @@ function pe(e) {
|
|
|
46
47
|
const t = e.getAttribute("data-theme") || e.getAttribute("theme");
|
|
47
48
|
return t && t.toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark");
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function We(e) {
|
|
50
51
|
const t = se(e);
|
|
51
52
|
if (pe(t)) return !0;
|
|
52
53
|
const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
@@ -57,41 +58,41 @@ function he(e) {
|
|
|
57
58
|
const t = e.getAttribute("data-theme") || e.getAttribute("theme");
|
|
58
59
|
return t && t.toLowerCase() === "acme" ? !0 : e.classList.contains("editora-theme-acme") || e.classList.contains("rte-theme-acme");
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function Ze(e) {
|
|
61
62
|
const t = se(e);
|
|
62
63
|
if (he(t)) return !0;
|
|
63
64
|
const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
|
|
64
65
|
return he(o) ? !0 : he(document.documentElement) || he(document.body);
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
67
|
+
function Ge(e) {
|
|
68
|
+
return We(e) ? "dark" : Ze(e) ? "acme" : "light";
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
const o =
|
|
70
|
+
function Ee(e, t) {
|
|
71
|
+
const o = Ge(t);
|
|
71
72
|
e.classList.remove("rte-conditional-theme-dark", "rte-conditional-theme-acme"), o === "dark" ? e.classList.add("rte-conditional-theme-dark") : o === "acme" && e.classList.add("rte-conditional-theme-acme");
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function k(e, t = !0) {
|
|
74
75
|
if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
|
|
75
76
|
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
76
77
|
const n = e.editorElement;
|
|
77
|
-
if (n.matches(
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
78
|
+
if (n.matches(w)) return n;
|
|
79
|
+
const r = n.querySelector(w);
|
|
80
|
+
if (r instanceof HTMLElement) return r;
|
|
80
81
|
}
|
|
81
82
|
const o = window.getSelection();
|
|
82
83
|
if (o && o.rangeCount > 0) {
|
|
83
|
-
const n = o.getRangeAt(0).startContainer,
|
|
84
|
-
if (
|
|
84
|
+
const n = o.getRangeAt(0).startContainer, r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, a = r == null ? void 0 : r.closest(w);
|
|
85
|
+
if (a) return a;
|
|
85
86
|
}
|
|
86
87
|
const i = document.activeElement;
|
|
87
88
|
if (i) {
|
|
88
|
-
if (i.matches(
|
|
89
|
-
const n = i.closest(
|
|
89
|
+
if (i.matches(w)) return i;
|
|
90
|
+
const n = i.closest(w);
|
|
90
91
|
if (n) return n;
|
|
91
92
|
}
|
|
92
|
-
return y && y.isConnected ? y : t ? document.querySelector(
|
|
93
|
+
return y && y.isConnected ? y : t ? document.querySelector(w) : null;
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function Me(e) {
|
|
95
96
|
const t = window.getSelection();
|
|
96
97
|
if (!t || t.rangeCount === 0) return null;
|
|
97
98
|
const o = t.getRangeAt(0);
|
|
@@ -104,7 +105,7 @@ function Le(e, t) {
|
|
|
104
105
|
function De(e) {
|
|
105
106
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function Oe(e, t) {
|
|
108
109
|
if (t === e.innerHTML) return;
|
|
109
110
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
110
111
|
if (typeof o == "function")
|
|
@@ -117,14 +118,14 @@ function $e(e, t) {
|
|
|
117
118
|
const o = document.createRange();
|
|
118
119
|
o.selectNodeContents(t), o.collapse(!1), Le(e, o);
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function Ce(e, t) {
|
|
121
122
|
if (t)
|
|
122
123
|
return t.split(".").filter(Boolean).reduce((o, i) => {
|
|
123
124
|
if (o != null && typeof o == "object")
|
|
124
125
|
return o[i];
|
|
125
126
|
}, e);
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function Ue(e) {
|
|
128
129
|
const t = e.trim();
|
|
129
130
|
if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'"))
|
|
130
131
|
return t.slice(1, -1);
|
|
@@ -141,18 +142,18 @@ function We(e) {
|
|
|
141
142
|
}
|
|
142
143
|
return t;
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function Xe(e, t) {
|
|
145
146
|
const o = e.trim();
|
|
146
147
|
if (!o) return !0;
|
|
147
148
|
if (o.startsWith("!")) {
|
|
148
|
-
const
|
|
149
|
-
return !
|
|
149
|
+
const E = o.slice(1).trim();
|
|
150
|
+
return !Ce(t, E);
|
|
150
151
|
}
|
|
151
152
|
const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
|
|
152
153
|
if (!i)
|
|
153
|
-
return !!
|
|
154
|
-
const [, n,
|
|
155
|
-
switch (
|
|
154
|
+
return !!Ce(t, o);
|
|
155
|
+
const [, n, r, a] = i, l = Ce(t, n), d = Ue(a);
|
|
156
|
+
switch (r) {
|
|
156
157
|
case "==":
|
|
157
158
|
return l == d;
|
|
158
159
|
case "!=":
|
|
@@ -166,18 +167,18 @@ function Ze(e, t) {
|
|
|
166
167
|
case "<=":
|
|
167
168
|
return Number(l) <= Number(d);
|
|
168
169
|
case "in":
|
|
169
|
-
return Array.isArray(d) ? d.some((
|
|
170
|
+
return Array.isArray(d) ? d.some((E) => E == l) : typeof d == "string" ? d.split(",").map((E) => E.trim()).includes(String(l)) : !1;
|
|
170
171
|
case "contains":
|
|
171
172
|
case "~=":
|
|
172
|
-
return Array.isArray(l) ? l.some((
|
|
173
|
+
return Array.isArray(l) ? l.some((E) => String(E).toLowerCase() === String(d).toLowerCase()) : typeof l == "string" ? l.toLowerCase().includes(String(d).toLowerCase()) : !1;
|
|
173
174
|
default:
|
|
174
175
|
return !1;
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
-
if (typeof document == "undefined" || document.getElementById(
|
|
178
|
+
function Ye() {
|
|
179
|
+
if (typeof document == "undefined" || document.getElementById(Te)) return;
|
|
179
180
|
const e = document.createElement("style");
|
|
180
|
-
e.id =
|
|
181
|
+
e.id = Te, e.textContent = `
|
|
181
182
|
.rte-conditional-block {
|
|
182
183
|
border: 1px solid #dbe3ec;
|
|
183
184
|
border-radius: 8px;
|
|
@@ -458,106 +459,113 @@ function Ge() {
|
|
|
458
459
|
background: #fff5f5;
|
|
459
460
|
}
|
|
460
461
|
|
|
461
|
-
.rte-conditional-preview-on ${
|
|
462
|
+
.rte-conditional-preview-on ${A} {
|
|
462
463
|
border-width: 2px;
|
|
463
464
|
}
|
|
464
465
|
|
|
465
|
-
.rte-conditional-preview-on ${
|
|
466
|
+
.rte-conditional-preview-on ${A} .rte-conditional-header {
|
|
466
467
|
background: #ecfeff;
|
|
467
468
|
border-color: #bae6fd;
|
|
468
469
|
}
|
|
469
470
|
|
|
470
|
-
${
|
|
471
|
-
${
|
|
471
|
+
${f} .rte-conditional-preview-on ${A} .rte-conditional-header,
|
|
472
|
+
${p} .rte-conditional-preview-on ${A} .rte-conditional-header,
|
|
473
|
+
.${c}.rte-conditional-theme-dark .rte-conditional-preview-on ${A} .rte-conditional-header {
|
|
474
|
+
background: #0c2b36;
|
|
475
|
+
border-color: #155e75;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
${f} .rte-conditional-block,
|
|
479
|
+
${p} .rte-conditional-block,
|
|
472
480
|
.${c}.rte-conditional-theme-dark .rte-conditional-block {
|
|
473
481
|
background: #111827;
|
|
474
482
|
border-color: #334155;
|
|
475
483
|
}
|
|
476
484
|
|
|
477
|
-
${
|
|
478
|
-
${
|
|
479
|
-
${
|
|
480
|
-
${
|
|
485
|
+
${f} .rte-conditional-header,
|
|
486
|
+
${f} .rte-conditional-else-label,
|
|
487
|
+
${p} .rte-conditional-header,
|
|
488
|
+
${p} .rte-conditional-else-label,
|
|
481
489
|
.${c}.rte-conditional-theme-dark .rte-conditional-header,
|
|
482
490
|
.${c}.rte-conditional-theme-dark .rte-conditional-else-label {
|
|
483
491
|
background: #0f172a;
|
|
484
492
|
border-color: #334155;
|
|
485
493
|
}
|
|
486
494
|
|
|
487
|
-
${
|
|
488
|
-
${
|
|
495
|
+
${f} .rte-conditional-summary,
|
|
496
|
+
${p} .rte-conditional-summary,
|
|
489
497
|
.${c}.rte-conditional-theme-dark .rte-conditional-summary {
|
|
490
498
|
color: #e2e8f0;
|
|
491
499
|
}
|
|
492
500
|
|
|
493
|
-
${
|
|
494
|
-
${
|
|
501
|
+
${f} .rte-conditional-meta,
|
|
502
|
+
${p} .rte-conditional-meta,
|
|
495
503
|
.${c}.rte-conditional-theme-dark .rte-conditional-meta {
|
|
496
504
|
color: #94a3b8;
|
|
497
505
|
}
|
|
498
506
|
|
|
499
|
-
${
|
|
500
|
-
${
|
|
507
|
+
${f} .rte-conditional-chip,
|
|
508
|
+
${p} .rte-conditional-chip,
|
|
501
509
|
.${c}.rte-conditional-theme-dark .rte-conditional-chip {
|
|
502
510
|
background: #1e3a8a;
|
|
503
511
|
border-color: #3b82f6;
|
|
504
512
|
color: #dbeafe;
|
|
505
513
|
}
|
|
506
514
|
|
|
507
|
-
${
|
|
508
|
-
${
|
|
515
|
+
${f} .rte-conditional-chip-else,
|
|
516
|
+
${p} .rte-conditional-chip-else,
|
|
509
517
|
.${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
|
|
510
518
|
background: #7f1d1d;
|
|
511
519
|
border-color: #ef4444;
|
|
512
520
|
color: #fee2e2;
|
|
513
521
|
}
|
|
514
522
|
|
|
515
|
-
${
|
|
516
|
-
${
|
|
523
|
+
${f} .rte-conditional-body,
|
|
524
|
+
${p} .rte-conditional-body,
|
|
517
525
|
.${c}.rte-conditional-theme-dark .rte-conditional-body {
|
|
518
526
|
background: #1f2937;
|
|
519
527
|
color: #e2e8f0;
|
|
520
528
|
}
|
|
521
529
|
|
|
522
|
-
${
|
|
523
|
-
${
|
|
530
|
+
${f} .rte-conditional-dialog,
|
|
531
|
+
${p} .rte-conditional-dialog,
|
|
524
532
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog {
|
|
525
533
|
background: #1f2937;
|
|
526
534
|
border-color: #334155;
|
|
527
535
|
}
|
|
528
536
|
|
|
529
|
-
${
|
|
530
|
-
${
|
|
531
|
-
${
|
|
532
|
-
${
|
|
537
|
+
${f} .rte-conditional-dialog-header,
|
|
538
|
+
${f} .rte-conditional-dialog-footer,
|
|
539
|
+
${p} .rte-conditional-dialog-header,
|
|
540
|
+
${p} .rte-conditional-dialog-footer,
|
|
533
541
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
|
|
534
542
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
|
|
535
543
|
background: #111827;
|
|
536
544
|
border-color: #334155;
|
|
537
545
|
}
|
|
538
546
|
|
|
539
|
-
${
|
|
540
|
-
${
|
|
541
|
-
${
|
|
542
|
-
${
|
|
543
|
-
${
|
|
544
|
-
${
|
|
547
|
+
${f} .rte-conditional-dialog-title,
|
|
548
|
+
${f} .rte-conditional-field label,
|
|
549
|
+
${f} .rte-conditional-checkbox,
|
|
550
|
+
${p} .rte-conditional-dialog-title,
|
|
551
|
+
${p} .rte-conditional-field label,
|
|
552
|
+
${p} .rte-conditional-checkbox,
|
|
545
553
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
|
|
546
554
|
.${c}.rte-conditional-theme-dark .rte-conditional-field label,
|
|
547
555
|
.${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
|
|
548
556
|
color: #e2e8f0;
|
|
549
557
|
}
|
|
550
558
|
|
|
551
|
-
${
|
|
552
|
-
${
|
|
559
|
+
${f} .rte-conditional-help,
|
|
560
|
+
${p} .rte-conditional-help,
|
|
553
561
|
.${c}.rte-conditional-theme-dark .rte-conditional-help {
|
|
554
562
|
color: #94a3b8;
|
|
555
563
|
}
|
|
556
564
|
|
|
557
|
-
${
|
|
558
|
-
${
|
|
559
|
-
${
|
|
560
|
-
${
|
|
565
|
+
${f} .rte-conditional-field input[type="text"],
|
|
566
|
+
${f} .rte-conditional-btn,
|
|
567
|
+
${p} .rte-conditional-field input[type="text"],
|
|
568
|
+
${p} .rte-conditional-btn,
|
|
561
569
|
.${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
|
|
562
570
|
.${c}.rte-conditional-theme-dark .rte-conditional-btn {
|
|
563
571
|
background: #0f172a;
|
|
@@ -565,28 +573,28 @@ function Ge() {
|
|
|
565
573
|
color: #e2e8f0;
|
|
566
574
|
}
|
|
567
575
|
|
|
568
|
-
${
|
|
569
|
-
${
|
|
576
|
+
${f} .rte-conditional-btn-primary,
|
|
577
|
+
${p} .rte-conditional-btn-primary,
|
|
570
578
|
.${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
|
|
571
579
|
border-color: #3b82f6;
|
|
572
580
|
background: #2563eb;
|
|
573
581
|
color: #ffffff;
|
|
574
582
|
}
|
|
575
583
|
|
|
576
|
-
${
|
|
584
|
+
${f} .rte-toolbar-group-items.conditional-content,
|
|
577
585
|
.${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
|
|
578
|
-
${
|
|
579
|
-
${
|
|
586
|
+
${p} .rte-toolbar-group-items.conditional-content,
|
|
587
|
+
${f} .editora-toolbar-group-items.conditional-content {
|
|
580
588
|
border-color: #566275;
|
|
581
589
|
}
|
|
582
590
|
|
|
583
|
-
${
|
|
584
|
-
${
|
|
585
|
-
${
|
|
591
|
+
${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
592
|
+
${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
593
|
+
${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
|
|
586
594
|
border-right-color: #566275;
|
|
587
595
|
}
|
|
588
596
|
|
|
589
|
-
${
|
|
597
|
+
${f} .${u},
|
|
590
598
|
.${c}.rte-conditional-theme-dark .${u},
|
|
591
599
|
.${u}.rte-conditional-theme-dark {
|
|
592
600
|
background: rgba(17, 24, 39, 0.98);
|
|
@@ -594,7 +602,7 @@ function Ge() {
|
|
|
594
602
|
box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
|
|
595
603
|
}
|
|
596
604
|
|
|
597
|
-
${
|
|
605
|
+
${f} .${u} .rte-conditional-float-btn,
|
|
598
606
|
.${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
|
|
599
607
|
.${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
|
|
600
608
|
background: #0f172a;
|
|
@@ -602,7 +610,7 @@ function Ge() {
|
|
|
602
610
|
color: #e2e8f0;
|
|
603
611
|
}
|
|
604
612
|
|
|
605
|
-
${
|
|
613
|
+
${f} .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
606
614
|
.${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
607
615
|
.${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
|
|
608
616
|
border-color: #ef4444;
|
|
@@ -610,15 +618,15 @@ function Ge() {
|
|
|
610
618
|
background: rgba(127, 29, 29, 0.45);
|
|
611
619
|
}
|
|
612
620
|
|
|
613
|
-
${
|
|
621
|
+
${b} .rte-conditional-block,
|
|
614
622
|
${g} .rte-conditional-block,
|
|
615
623
|
.${c}.rte-conditional-theme-acme .rte-conditional-block {
|
|
616
624
|
background: #f8fbff;
|
|
617
625
|
border-color: #cbd8e8;
|
|
618
626
|
}
|
|
619
627
|
|
|
620
|
-
${
|
|
621
|
-
${
|
|
628
|
+
${b} .rte-conditional-header,
|
|
629
|
+
${b} .rte-conditional-else-label,
|
|
622
630
|
${g} .rte-conditional-header,
|
|
623
631
|
${g} .rte-conditional-else-label,
|
|
624
632
|
.${c}.rte-conditional-theme-acme .rte-conditional-header,
|
|
@@ -627,19 +635,19 @@ function Ge() {
|
|
|
627
635
|
border-color: #cbd8e8;
|
|
628
636
|
}
|
|
629
637
|
|
|
630
|
-
${
|
|
638
|
+
${b} .rte-conditional-summary,
|
|
631
639
|
${g} .rte-conditional-summary,
|
|
632
640
|
.${c}.rte-conditional-theme-acme .rte-conditional-summary {
|
|
633
641
|
color: #0f172a;
|
|
634
642
|
}
|
|
635
643
|
|
|
636
|
-
${
|
|
644
|
+
${b} .rte-conditional-meta,
|
|
637
645
|
${g} .rte-conditional-meta,
|
|
638
646
|
.${c}.rte-conditional-theme-acme .rte-conditional-meta {
|
|
639
647
|
color: #587089;
|
|
640
648
|
}
|
|
641
649
|
|
|
642
|
-
${
|
|
650
|
+
${b} .rte-conditional-chip,
|
|
643
651
|
${g} .rte-conditional-chip,
|
|
644
652
|
.${c}.rte-conditional-theme-acme .rte-conditional-chip {
|
|
645
653
|
background: #d9f5ee;
|
|
@@ -647,7 +655,7 @@ function Ge() {
|
|
|
647
655
|
color: #0f4f4a;
|
|
648
656
|
}
|
|
649
657
|
|
|
650
|
-
${
|
|
658
|
+
${b} .rte-conditional-chip-else,
|
|
651
659
|
${g} .rte-conditional-chip-else,
|
|
652
660
|
.${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
|
|
653
661
|
background: #fde8ea;
|
|
@@ -655,14 +663,14 @@ function Ge() {
|
|
|
655
663
|
color: #8b1f2f;
|
|
656
664
|
}
|
|
657
665
|
|
|
658
|
-
${
|
|
666
|
+
${b} .rte-conditional-body,
|
|
659
667
|
${g} .rte-conditional-body,
|
|
660
668
|
.${c}.rte-conditional-theme-acme .rte-conditional-body {
|
|
661
669
|
background: #fcfeff;
|
|
662
670
|
color: #0f172a;
|
|
663
671
|
}
|
|
664
672
|
|
|
665
|
-
${
|
|
673
|
+
${b} .rte-conditional-dialog,
|
|
666
674
|
${g} .rte-conditional-dialog,
|
|
667
675
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog {
|
|
668
676
|
background: #ffffff;
|
|
@@ -670,8 +678,8 @@ function Ge() {
|
|
|
670
678
|
box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
|
|
671
679
|
}
|
|
672
680
|
|
|
673
|
-
${
|
|
674
|
-
${
|
|
681
|
+
${b} .rte-conditional-dialog-header,
|
|
682
|
+
${b} .rte-conditional-dialog-footer,
|
|
675
683
|
${g} .rte-conditional-dialog-header,
|
|
676
684
|
${g} .rte-conditional-dialog-footer,
|
|
677
685
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
|
|
@@ -680,9 +688,9 @@ function Ge() {
|
|
|
680
688
|
border-color: #d8e4f1;
|
|
681
689
|
}
|
|
682
690
|
|
|
683
|
-
${
|
|
684
|
-
${
|
|
685
|
-
${
|
|
691
|
+
${b} .rte-conditional-dialog-title,
|
|
692
|
+
${b} .rte-conditional-field label,
|
|
693
|
+
${b} .rte-conditional-checkbox,
|
|
686
694
|
${g} .rte-conditional-dialog-title,
|
|
687
695
|
${g} .rte-conditional-field label,
|
|
688
696
|
${g} .rte-conditional-checkbox,
|
|
@@ -692,14 +700,14 @@ function Ge() {
|
|
|
692
700
|
color: #1f334a;
|
|
693
701
|
}
|
|
694
702
|
|
|
695
|
-
${
|
|
703
|
+
${b} .rte-conditional-help,
|
|
696
704
|
${g} .rte-conditional-help,
|
|
697
705
|
.${c}.rte-conditional-theme-acme .rte-conditional-help {
|
|
698
706
|
color: #5f738d;
|
|
699
707
|
}
|
|
700
708
|
|
|
701
|
-
${
|
|
702
|
-
${
|
|
709
|
+
${b} .rte-conditional-field input[type="text"],
|
|
710
|
+
${b} .rte-conditional-btn,
|
|
703
711
|
${g} .rte-conditional-field input[type="text"],
|
|
704
712
|
${g} .rte-conditional-btn,
|
|
705
713
|
.${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
|
|
@@ -709,7 +717,7 @@ function Ge() {
|
|
|
709
717
|
color: #0f172a;
|
|
710
718
|
}
|
|
711
719
|
|
|
712
|
-
${
|
|
720
|
+
${b} .rte-conditional-btn-primary,
|
|
713
721
|
${g} .rte-conditional-btn-primary,
|
|
714
722
|
.${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
|
|
715
723
|
border-color: #0f766e;
|
|
@@ -717,20 +725,20 @@ function Ge() {
|
|
|
717
725
|
color: #ffffff;
|
|
718
726
|
}
|
|
719
727
|
|
|
720
|
-
${
|
|
728
|
+
${b} .rte-toolbar-group-items.conditional-content,
|
|
721
729
|
.${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
|
|
722
730
|
${g} .rte-toolbar-group-items.conditional-content,
|
|
723
|
-
${
|
|
731
|
+
${b} .editora-toolbar-group-items.conditional-content {
|
|
724
732
|
border-color: #bfd0e2;
|
|
725
733
|
}
|
|
726
734
|
|
|
727
|
-
${
|
|
735
|
+
${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
728
736
|
${g} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
729
|
-
${
|
|
737
|
+
${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
|
|
730
738
|
border-right-color: #bfd0e2;
|
|
731
739
|
}
|
|
732
740
|
|
|
733
|
-
${
|
|
741
|
+
${b} .${u},
|
|
734
742
|
.${c}.rte-conditional-theme-acme .${u},
|
|
735
743
|
.${u}.rte-conditional-theme-acme {
|
|
736
744
|
background: rgba(255, 255, 255, 0.98);
|
|
@@ -738,7 +746,7 @@ function Ge() {
|
|
|
738
746
|
box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
|
|
739
747
|
}
|
|
740
748
|
|
|
741
|
-
${
|
|
749
|
+
${b} .${u} .rte-conditional-float-btn,
|
|
742
750
|
.${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
|
|
743
751
|
.${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
|
|
744
752
|
background: #ffffff;
|
|
@@ -746,14 +754,14 @@ function Ge() {
|
|
|
746
754
|
color: #1f334a;
|
|
747
755
|
}
|
|
748
756
|
|
|
749
|
-
${
|
|
757
|
+
${b} .${u} .rte-conditional-float-btn:hover,
|
|
750
758
|
.${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
|
|
751
759
|
.${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
|
|
752
760
|
background: #eef7f5;
|
|
753
761
|
color: #0f4f4a;
|
|
754
762
|
}
|
|
755
763
|
|
|
756
|
-
${
|
|
764
|
+
${b} .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
757
765
|
.${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
758
766
|
.${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
|
|
759
767
|
border-color: #f1a7b2;
|
|
@@ -762,38 +770,38 @@ function Ge() {
|
|
|
762
770
|
}
|
|
763
771
|
`, document.head.appendChild(e);
|
|
764
772
|
}
|
|
765
|
-
function
|
|
773
|
+
function Je(e) {
|
|
766
774
|
return {
|
|
767
775
|
defaultCondition: e.defaultCondition || "",
|
|
768
776
|
defaultAudience: ie(e.defaultAudience || []),
|
|
769
777
|
defaultLocale: ie(e.defaultLocale || []),
|
|
770
778
|
enableElseByDefault: e.enableElseByDefault === !0,
|
|
771
|
-
labels:
|
|
779
|
+
labels: Ve(e.labels),
|
|
772
780
|
context: e.context,
|
|
773
781
|
getContext: e.getContext,
|
|
774
782
|
currentAudience: e.currentAudience,
|
|
775
783
|
currentLocale: e.currentLocale,
|
|
776
|
-
evaluateCondition: e.evaluateCondition ||
|
|
784
|
+
evaluateCondition: e.evaluateCondition || Xe
|
|
777
785
|
};
|
|
778
786
|
}
|
|
779
|
-
function
|
|
787
|
+
function Re() {
|
|
780
788
|
de && (de.cleanup(), de = null);
|
|
781
789
|
}
|
|
782
|
-
function
|
|
790
|
+
function Qe(e) {
|
|
783
791
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
784
792
|
}
|
|
785
|
-
function
|
|
793
|
+
function re(e, t) {
|
|
786
794
|
e.setAttribute("contenteditable", "false"), e.setAttribute("spellcheck", "false");
|
|
787
795
|
const o = e.querySelector(".rte-conditional-header");
|
|
788
796
|
o && (o.setAttribute("contenteditable", "false"), o.setAttribute("tabindex", "0"), o.setAttribute("role", "button"), o.setAttribute("aria-label", "Edit conditional rule"));
|
|
789
797
|
const i = e.querySelector(".rte-conditional-else-label");
|
|
790
|
-
i && i.setAttribute("contenteditable", "false"),
|
|
798
|
+
i && i.setAttribute("contenteditable", "false"), ot(e, !t);
|
|
791
799
|
}
|
|
792
|
-
function
|
|
800
|
+
function et(e) {
|
|
793
801
|
const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
794
802
|
if (!t) return;
|
|
795
|
-
const o = /* @__PURE__ */ new Set(), i = e.querySelector(".rte-conditional-header"), n = e.querySelector(".rte-conditional-else-label"),
|
|
796
|
-
i && o.add(i), o.add(t), n && o.add(n),
|
|
803
|
+
const o = /* @__PURE__ */ new Set(), i = e.querySelector(".rte-conditional-header"), n = e.querySelector(".rte-conditional-else-label"), r = e.querySelector('.rte-conditional-body[data-slot="else"]');
|
|
804
|
+
i && o.add(i), o.add(t), n && o.add(n), r && o.add(r), Array.from(e.childNodes).forEach((l) => {
|
|
797
805
|
if (!(l instanceof HTMLElement && o.has(l))) {
|
|
798
806
|
if (l.nodeType === Node.TEXT_NODE && !(l.textContent || "").trim()) {
|
|
799
807
|
l.remove();
|
|
@@ -806,44 +814,44 @@ function Je(e) {
|
|
|
806
814
|
function U(e) {
|
|
807
815
|
const t = window.getSelection();
|
|
808
816
|
if (t && t.rangeCount > 0) {
|
|
809
|
-
const n = t.getRangeAt(0).startContainer,
|
|
810
|
-
if (
|
|
817
|
+
const n = t.getRangeAt(0).startContainer, r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, a = r == null ? void 0 : r.closest(A);
|
|
818
|
+
if (a && e.contains(a)) return a;
|
|
811
819
|
}
|
|
812
|
-
const o = document.activeElement, i = o == null ? void 0 : o.closest(
|
|
820
|
+
const o = document.activeElement, i = o == null ? void 0 : o.closest(A);
|
|
813
821
|
return i && e.contains(i) ? i : null;
|
|
814
822
|
}
|
|
815
|
-
function
|
|
823
|
+
function we(e, t) {
|
|
816
824
|
let o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
|
|
817
825
|
o || (o = document.createElement("div"), o.className = "rte-conditional-else-label", o.setAttribute("contenteditable", "false"), o.innerHTML = `
|
|
818
826
|
<span class="rte-conditional-chip rte-conditional-chip-else">${$(t.blockElseLabel)}</span>
|
|
819
827
|
<span class="rte-conditional-summary">Else branch</span>
|
|
820
828
|
`, e.appendChild(o)), i || (i = document.createElement("div"), i.className = "rte-conditional-body rte-conditional-else-body", i.setAttribute("data-slot", "else"), i.innerHTML = "<p><br></p>", e.appendChild(i));
|
|
821
829
|
}
|
|
822
|
-
function
|
|
830
|
+
function tt(e, t) {
|
|
823
831
|
e.setAttribute("data-has-else", t ? "true" : "false");
|
|
824
832
|
const o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
|
|
825
833
|
o && o.classList.toggle("rte-conditional-hidden", !t), i && i.classList.toggle("rte-conditional-hidden", !t);
|
|
826
834
|
}
|
|
827
|
-
function
|
|
835
|
+
function ot(e, t) {
|
|
828
836
|
Array.from(e.querySelectorAll(".rte-conditional-body")).forEach((i) => {
|
|
829
837
|
i.setAttribute("contenteditable", t ? "true" : "false");
|
|
830
838
|
}), e.setAttribute("contenteditable", "false");
|
|
831
839
|
}
|
|
832
|
-
function
|
|
833
|
-
const o = e.getAttribute("data-condition") || "", i =
|
|
834
|
-
let
|
|
835
|
-
|
|
836
|
-
const
|
|
837
|
-
if (
|
|
840
|
+
function Ae(e, t) {
|
|
841
|
+
const o = e.getAttribute("data-condition") || "", i = P(e.getAttribute("data-audience")), n = P(e.getAttribute("data-locale"));
|
|
842
|
+
let r = e.querySelector(".rte-conditional-header");
|
|
843
|
+
r || (r = document.createElement("div"), r.className = "rte-conditional-header", e.prepend(r)), r.setAttribute("contenteditable", "false"), r.setAttribute("tabindex", "0"), r.setAttribute("role", "button"), r.setAttribute("aria-label", "Edit conditional rule");
|
|
844
|
+
const a = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
|
|
845
|
+
if (r.innerHTML = `
|
|
838
846
|
<span class="rte-conditional-chip">${$(t.blockIfLabel)}</span>
|
|
839
|
-
<span class="rte-conditional-summary">${$(
|
|
847
|
+
<span class="rte-conditional-summary">${$(a)}</span>
|
|
840
848
|
<span class="rte-conditional-meta">${$(l)} · ${$(d)}</span>
|
|
841
849
|
`, !e.querySelector('.rte-conditional-body[data-slot="if"]')) {
|
|
842
850
|
const m = document.createElement("div");
|
|
843
851
|
m.className = "rte-conditional-body", m.setAttribute("data-slot", "if"), m.innerHTML = "<p><br></p>", e.insertBefore(m, e.children[1] || null);
|
|
844
852
|
}
|
|
845
|
-
const
|
|
846
|
-
|
|
853
|
+
const C = e.getAttribute("data-has-else") === "true";
|
|
854
|
+
C && we(e, t), et(e), tt(e, C);
|
|
847
855
|
}
|
|
848
856
|
function Pe(e, t) {
|
|
849
857
|
const o = document.createElement("section");
|
|
@@ -851,9 +859,9 @@ function Pe(e, t) {
|
|
|
851
859
|
const i = document.createElement("div");
|
|
852
860
|
i.className = "rte-conditional-header", i.setAttribute("contenteditable", "false");
|
|
853
861
|
const n = document.createElement("div");
|
|
854
|
-
return n.className = "rte-conditional-body", n.setAttribute("data-slot", "if"), n.innerHTML = "<p><br></p>", o.appendChild(i), o.appendChild(n), e.hasElse &&
|
|
862
|
+
return n.className = "rte-conditional-body", n.setAttribute("data-slot", "if"), n.innerHTML = "<p><br></p>", o.appendChild(i), o.appendChild(n), e.hasElse && we(o, t), Ae(o, t), re(o, !1), o;
|
|
855
863
|
}
|
|
856
|
-
function
|
|
864
|
+
function nt(e, t) {
|
|
857
865
|
if (t)
|
|
858
866
|
try {
|
|
859
867
|
if (!e.isConnected) return;
|
|
@@ -863,37 +871,79 @@ function et(e, t) {
|
|
|
863
871
|
} catch (o) {
|
|
864
872
|
}
|
|
865
873
|
}
|
|
866
|
-
function
|
|
874
|
+
function it(e) {
|
|
867
875
|
return (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !0 : e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol") !== null;
|
|
868
876
|
}
|
|
869
|
-
|
|
877
|
+
const qe = /* @__PURE__ */ new Set([
|
|
878
|
+
"P",
|
|
879
|
+
"DIV",
|
|
880
|
+
"UL",
|
|
881
|
+
"OL",
|
|
882
|
+
"LI",
|
|
883
|
+
"BLOCKQUOTE",
|
|
884
|
+
"H1",
|
|
885
|
+
"H2",
|
|
886
|
+
"H3",
|
|
887
|
+
"H4",
|
|
888
|
+
"H5",
|
|
889
|
+
"H6",
|
|
890
|
+
"TABLE",
|
|
891
|
+
"PRE",
|
|
892
|
+
"FIGURE",
|
|
893
|
+
"SECTION",
|
|
894
|
+
"ARTICLE",
|
|
895
|
+
"HEADER",
|
|
896
|
+
"FOOTER"
|
|
897
|
+
]);
|
|
898
|
+
function Be(e, t) {
|
|
899
|
+
let o = e;
|
|
900
|
+
for (; o && o !== t; ) {
|
|
901
|
+
if (o.nodeType === Node.ELEMENT_NODE && qe.has(o.tagName))
|
|
902
|
+
return o;
|
|
903
|
+
o = o.parentNode;
|
|
904
|
+
}
|
|
905
|
+
return null;
|
|
906
|
+
}
|
|
907
|
+
function rt(e) {
|
|
908
|
+
let t = null;
|
|
909
|
+
Array.from(e.childNodes).forEach((o) => {
|
|
910
|
+
if (o.nodeType === Node.ELEMENT_NODE && qe.has(o.tagName)) {
|
|
911
|
+
t = null;
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
o.nodeType === Node.TEXT_NODE && !(o.textContent || "").trim() || (t || (t = document.createElement("p"), e.insertBefore(t, o)), t.appendChild(o));
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
function Ke(e, t, o) {
|
|
870
918
|
let i = null;
|
|
871
|
-
i || (i =
|
|
919
|
+
i || (i = Me(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
|
|
872
920
|
let n = null;
|
|
873
|
-
i.collapsed || (n = i.extractContents())
|
|
921
|
+
i.collapsed || (n = i.extractContents());
|
|
922
|
+
const r = Be(i.endContainer, e) || Be(i.startContainer, e);
|
|
923
|
+
r && r.parentNode ? r.parentNode.insertBefore(t, r.nextSibling) : i.insertNode(t);
|
|
874
924
|
const a = t.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
875
|
-
a && n &&
|
|
925
|
+
a && n && it(n) && (a.innerHTML = "", a.appendChild(n)), rt(e), a ? $e(e, a) : $e(e, t), e.normalize();
|
|
876
926
|
}
|
|
877
|
-
function
|
|
927
|
+
function at(e) {
|
|
878
928
|
return {
|
|
879
929
|
condition: e.getAttribute("data-condition") || "",
|
|
880
|
-
audience:
|
|
881
|
-
locale:
|
|
930
|
+
audience: P(e.getAttribute("data-audience")),
|
|
931
|
+
locale: P(e.getAttribute("data-locale")),
|
|
882
932
|
hasElse: e.getAttribute("data-has-else") === "true"
|
|
883
933
|
};
|
|
884
934
|
}
|
|
885
|
-
function
|
|
886
|
-
e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", ie(t.audience).join(",")), e.setAttribute("data-locale", ie(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse &&
|
|
935
|
+
function lt(e, t, o) {
|
|
936
|
+
e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", ie(t.audience).join(",")), e.setAttribute("data-locale", ie(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && we(e, o), Ae(e, o), re(e, e.classList.contains("rte-conditional-preview"));
|
|
887
937
|
}
|
|
888
|
-
function
|
|
889
|
-
|
|
890
|
-
const o = Array.from(e.querySelectorAll(
|
|
938
|
+
function ae(e, t) {
|
|
939
|
+
Ee(e, e);
|
|
940
|
+
const o = Array.from(e.querySelectorAll(A)), i = T.get(e) === !0;
|
|
891
941
|
return o.forEach((n) => {
|
|
892
|
-
n.classList.add("rte-conditional-block"), n.setAttribute("data-conditional-content", "true"), n.hasAttribute("data-condition") || n.setAttribute("data-condition", ""), n.hasAttribute("data-audience") || n.setAttribute("data-audience", ""), n.hasAttribute("data-locale") || n.setAttribute("data-locale", ""), n.hasAttribute("data-has-else") || n.setAttribute("data-has-else", "false"), n.setAttribute("role", "group"), n.setAttribute("aria-label", "Conditional content block"), n.setAttribute("contenteditable", "false"), n.setAttribute("spellcheck", "false"),
|
|
942
|
+
n.classList.add("rte-conditional-block"), n.setAttribute("data-conditional-content", "true"), n.hasAttribute("data-condition") || n.setAttribute("data-condition", ""), n.hasAttribute("data-audience") || n.setAttribute("data-audience", ""), n.hasAttribute("data-locale") || n.setAttribute("data-locale", ""), n.hasAttribute("data-has-else") || n.setAttribute("data-has-else", "false"), n.setAttribute("role", "group"), n.setAttribute("aria-label", "Conditional content block"), n.setAttribute("contenteditable", "false"), n.setAttribute("spellcheck", "false"), Ae(n, t), re(n, i);
|
|
893
943
|
}), o;
|
|
894
944
|
}
|
|
895
|
-
async function
|
|
896
|
-
const o =
|
|
945
|
+
async function ct(e, t) {
|
|
946
|
+
const o = ve.get(e);
|
|
897
947
|
if (o)
|
|
898
948
|
return o;
|
|
899
949
|
if (typeof t.getContext == "function")
|
|
@@ -917,38 +967,38 @@ async function it(e, t) {
|
|
|
917
967
|
function ge(e) {
|
|
918
968
|
return Array.isArray(e) ? e.map((t) => t.trim().toLowerCase()).filter(Boolean) : typeof e == "string" ? e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : [];
|
|
919
969
|
}
|
|
920
|
-
function
|
|
970
|
+
function Ne(e, t) {
|
|
921
971
|
return e.length === 0 || e.includes("all") ? !0 : t.length === 0 ? !1 : e.some((o) => t.includes(o));
|
|
922
972
|
}
|
|
923
|
-
async function
|
|
924
|
-
var
|
|
925
|
-
const i = t.labels, n =
|
|
926
|
-
if (
|
|
927
|
-
n.forEach((
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
|
|
973
|
+
async function X(e, t, o) {
|
|
974
|
+
var B, ue, N, V;
|
|
975
|
+
const i = t.labels, n = ae(e, i);
|
|
976
|
+
if (T.set(e, o), _e(e, o), se(e).classList.toggle("rte-conditional-preview-on", o), !o) {
|
|
977
|
+
n.forEach((h) => {
|
|
978
|
+
h.classList.remove("rte-conditional-preview"), re(h, !1);
|
|
979
|
+
const H = h.querySelector('.rte-conditional-body[data-slot="if"]'), v = h.querySelector('.rte-conditional-body[data-slot="else"]'), q = h.querySelector(".rte-conditional-else-label"), M = h.getAttribute("data-has-else") === "true";
|
|
980
|
+
H && (H.classList.remove("rte-conditional-hidden"), H.removeAttribute("aria-hidden")), v && (v.classList.toggle("rte-conditional-hidden", !M), v.setAttribute("aria-hidden", M ? "false" : "true")), q && q.classList.toggle("rte-conditional-hidden", !M);
|
|
931
981
|
});
|
|
932
982
|
return;
|
|
933
983
|
}
|
|
934
|
-
const
|
|
935
|
-
(ue =
|
|
936
|
-
),
|
|
937
|
-
(V =
|
|
938
|
-
), m = l.length > 0 ? l :
|
|
939
|
-
n.forEach((
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
942
|
-
const s =
|
|
984
|
+
const a = await ct(e, t), l = ge(t.currentAudience), d = ge(t.currentLocale), E = ge(
|
|
985
|
+
(ue = a.audience) != null ? ue : (B = a.user) == null ? void 0 : B.audience
|
|
986
|
+
), C = ge(
|
|
987
|
+
(V = a.locale) != null ? V : (N = a.user) == null ? void 0 : N.locale
|
|
988
|
+
), m = l.length > 0 ? l : E, S = d.length > 0 ? d : C;
|
|
989
|
+
n.forEach((h) => {
|
|
990
|
+
const H = h.getAttribute("data-condition") || "", v = P(h.getAttribute("data-audience")).map((s) => s.toLowerCase()), q = P(h.getAttribute("data-locale")).map((s) => s.toLowerCase()), M = h.getAttribute("data-has-else") === "true", xe = t.evaluateCondition(H, a), fe = Ne(v, m), be = Ne(q, S), K = xe && fe && be, W = h.querySelector('.rte-conditional-body[data-slot="if"]'), Z = h.querySelector('.rte-conditional-body[data-slot="else"]'), le = h.querySelector(".rte-conditional-else-label");
|
|
991
|
+
if (h.classList.add("rte-conditional-preview"), re(h, !0), W && (W.classList.toggle("rte-conditional-hidden", !K), W.setAttribute("aria-hidden", K ? "false" : "true")), Z) {
|
|
992
|
+
const s = M && !K;
|
|
943
993
|
Z.classList.toggle("rte-conditional-hidden", !s), Z.setAttribute("aria-hidden", s ? "false" : "true");
|
|
944
994
|
}
|
|
945
995
|
if (le) {
|
|
946
|
-
const s =
|
|
996
|
+
const s = M && !K;
|
|
947
997
|
le.classList.toggle("rte-conditional-hidden", !s);
|
|
948
998
|
}
|
|
949
999
|
});
|
|
950
1000
|
}
|
|
951
|
-
function
|
|
1001
|
+
function _e(e, t) {
|
|
952
1002
|
const o = se(e);
|
|
953
1003
|
Array.from(
|
|
954
1004
|
o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
|
|
@@ -956,8 +1006,8 @@ function qe(e, t) {
|
|
|
956
1006
|
n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
|
|
957
1007
|
});
|
|
958
1008
|
}
|
|
959
|
-
function
|
|
960
|
-
const t =
|
|
1009
|
+
function dt(e) {
|
|
1010
|
+
const t = I.get(e);
|
|
961
1011
|
if (t && t.isConnected) return t;
|
|
962
1012
|
const o = document.createElement("div");
|
|
963
1013
|
return o.className = u, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
|
|
@@ -971,246 +1021,246 @@ function at(e) {
|
|
|
971
1021
|
i.preventDefault();
|
|
972
1022
|
}), o.addEventListener("click", (i) => {
|
|
973
1023
|
var d;
|
|
974
|
-
const n = i.target,
|
|
975
|
-
if (!a) return;
|
|
976
|
-
const r = E.get(e) || ne;
|
|
1024
|
+
const n = i.target, r = (d = n == null ? void 0 : n.closest("[data-action]")) == null ? void 0 : d.getAttribute("data-action");
|
|
977
1025
|
if (!r) return;
|
|
978
|
-
const
|
|
1026
|
+
const a = x.get(e) || ne;
|
|
1027
|
+
if (!a) return;
|
|
1028
|
+
const l = j.get(e);
|
|
979
1029
|
if (!(!l || !e.contains(l))) {
|
|
980
|
-
if (
|
|
981
|
-
L(e,
|
|
1030
|
+
if (r === "edit") {
|
|
1031
|
+
L(e, a, "edit", void 0, l);
|
|
982
1032
|
return;
|
|
983
1033
|
}
|
|
984
|
-
|
|
1034
|
+
r === "delete" && (ze(e, l), j.set(e, null), z(e));
|
|
985
1035
|
}
|
|
986
|
-
}), document.body.appendChild(o),
|
|
1036
|
+
}), document.body.appendChild(o), I.set(e, o), o;
|
|
987
1037
|
}
|
|
988
|
-
function
|
|
989
|
-
const t =
|
|
1038
|
+
function z(e) {
|
|
1039
|
+
const t = I.get(e);
|
|
990
1040
|
t && t.classList.remove("show");
|
|
991
1041
|
}
|
|
992
|
-
function
|
|
1042
|
+
function Fe(e, t) {
|
|
993
1043
|
const o = t.getBoundingClientRect();
|
|
994
1044
|
e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
|
|
995
|
-
const i = e.getBoundingClientRect(), n = 8,
|
|
1045
|
+
const i = e.getBoundingClientRect(), n = 8, r = window.innerWidth, a = window.innerHeight;
|
|
996
1046
|
let l = o.top - i.height - n;
|
|
997
|
-
l < n && (l = o.bottom + n), l = Math.min(l,
|
|
1047
|
+
l < n && (l = o.bottom + n), l = Math.min(l, a - i.height - n);
|
|
998
1048
|
let d = o.right - i.width;
|
|
999
|
-
d = Math.max(n, Math.min(d,
|
|
1049
|
+
d = Math.max(n, Math.min(d, r - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
|
|
1000
1050
|
}
|
|
1001
1051
|
function ye(e, t) {
|
|
1002
|
-
const o =
|
|
1003
|
-
|
|
1052
|
+
const o = dt(e);
|
|
1053
|
+
Ee(o, e), j.set(e, t), Fe(o, t);
|
|
1004
1054
|
}
|
|
1005
|
-
function
|
|
1006
|
-
const t =
|
|
1055
|
+
function R(e) {
|
|
1056
|
+
const t = x.get(e) || ne;
|
|
1007
1057
|
if (!t) return;
|
|
1008
1058
|
const o = U(e);
|
|
1009
1059
|
if (!o || !e.contains(o) || D(e)) {
|
|
1010
|
-
|
|
1060
|
+
j.set(e, null), z(e);
|
|
1011
1061
|
return;
|
|
1012
1062
|
}
|
|
1013
|
-
|
|
1063
|
+
ae(e, t.labels), ye(e, o);
|
|
1014
1064
|
}
|
|
1015
|
-
function
|
|
1016
|
-
|
|
1065
|
+
function st() {
|
|
1066
|
+
I.forEach((e, t) => {
|
|
1017
1067
|
if (!t.isConnected || !e.isConnected) {
|
|
1018
|
-
e.remove(),
|
|
1068
|
+
e.remove(), I.delete(t), j.delete(t);
|
|
1019
1069
|
return;
|
|
1020
1070
|
}
|
|
1021
1071
|
if (!e.classList.contains("show")) return;
|
|
1022
|
-
|
|
1023
|
-
const o =
|
|
1072
|
+
Ee(e, t);
|
|
1073
|
+
const o = j.get(t);
|
|
1024
1074
|
if (!o || !t.contains(o)) {
|
|
1025
|
-
|
|
1075
|
+
z(t);
|
|
1026
1076
|
return;
|
|
1027
1077
|
}
|
|
1028
|
-
|
|
1078
|
+
Fe(e, o);
|
|
1029
1079
|
});
|
|
1030
1080
|
}
|
|
1031
|
-
function
|
|
1081
|
+
function ze(e, t) {
|
|
1032
1082
|
if (!e.contains(t)) return !1;
|
|
1033
1083
|
const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
|
|
1034
1084
|
t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
|
|
1035
|
-
const
|
|
1036
|
-
return n && e.contains(n) ?
|
|
1085
|
+
const r = document.createRange();
|
|
1086
|
+
return n && e.contains(n) ? r.setStartBefore(n) : (r.selectNodeContents(e), r.collapse(!1)), r.collapse(!0), Le(e, r), De(e), Oe(e, o), !0;
|
|
1037
1087
|
}
|
|
1038
|
-
function
|
|
1088
|
+
function He(e, t, o) {
|
|
1039
1089
|
const i = e.cloneRange(), n = document.createRange();
|
|
1040
1090
|
return n.selectNodeContents(t), n.collapse(o === "start"), i.startContainer === n.startContainer && i.startOffset === n.startOffset && i.endContainer === n.endContainer && i.endOffset === n.endOffset;
|
|
1041
1091
|
}
|
|
1042
1092
|
function L(e, t, o, i, n) {
|
|
1043
1093
|
var K, W, Z, le;
|
|
1044
|
-
|
|
1045
|
-
const
|
|
1046
|
-
l.className = c,
|
|
1094
|
+
Re();
|
|
1095
|
+
const r = t.labels, a = o === "insert" ? Me(e) : null, l = document.createElement("div");
|
|
1096
|
+
Ie(l), l.className = c, Ee(l, e);
|
|
1047
1097
|
const d = document.createElement("section");
|
|
1048
1098
|
d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
|
|
1049
|
-
const
|
|
1099
|
+
const E = n ? at(n) : void 0, C = i || E || {}, m = (K = C.condition) != null ? K : t.defaultCondition, S = (W = C.audience) != null ? W : t.defaultAudience, B = (Z = C.locale) != null ? Z : t.defaultLocale, ue = (le = C.hasElse) != null ? le : t.enableElseByDefault;
|
|
1050
1100
|
d.innerHTML = `
|
|
1051
1101
|
<header class="rte-conditional-dialog-header">
|
|
1052
1102
|
<h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${$(
|
|
1053
|
-
o === "edit" ?
|
|
1103
|
+
o === "edit" ? r.dialogTitleEdit : r.dialogTitleInsert
|
|
1054
1104
|
)}</h2>
|
|
1055
|
-
<button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(
|
|
1105
|
+
<button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(r.cancelText)}">✕</button>
|
|
1056
1106
|
</header>
|
|
1057
1107
|
<div class="rte-conditional-dialog-body">
|
|
1058
1108
|
<div class="rte-conditional-field">
|
|
1059
|
-
<label for="rte-conditional-condition">${$(
|
|
1109
|
+
<label for="rte-conditional-condition">${$(r.conditionLabel)}</label>
|
|
1060
1110
|
<input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${$(
|
|
1061
1111
|
m || ""
|
|
1062
|
-
)}" placeholder="${$(
|
|
1112
|
+
)}" placeholder="${$(r.conditionPlaceholder)}" />
|
|
1063
1113
|
</div>
|
|
1064
1114
|
<div class="rte-conditional-field">
|
|
1065
|
-
<label for="rte-conditional-audience">${$(
|
|
1115
|
+
<label for="rte-conditional-audience">${$(r.audienceLabel)}</label>
|
|
1066
1116
|
<input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${$(
|
|
1067
|
-
|
|
1068
|
-
)}" placeholder="${$(
|
|
1117
|
+
Se(S)
|
|
1118
|
+
)}" placeholder="${$(r.audiencePlaceholder)}" />
|
|
1069
1119
|
</div>
|
|
1070
1120
|
<div class="rte-conditional-field">
|
|
1071
|
-
<label for="rte-conditional-locale">${$(
|
|
1121
|
+
<label for="rte-conditional-locale">${$(r.localeLabel)}</label>
|
|
1072
1122
|
<input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${$(
|
|
1073
|
-
|
|
1074
|
-
)}" placeholder="${$(
|
|
1123
|
+
Se(B)
|
|
1124
|
+
)}" placeholder="${$(r.localePlaceholder)}" />
|
|
1075
1125
|
</div>
|
|
1076
1126
|
<label class="rte-conditional-checkbox">
|
|
1077
1127
|
<input class="rte-conditional-input-else" type="checkbox" ${ue ? "checked" : ""} />
|
|
1078
|
-
<span>${$(
|
|
1128
|
+
<span>${$(r.elseLabel)}</span>
|
|
1079
1129
|
</label>
|
|
1080
1130
|
<p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
|
|
1081
1131
|
</div>
|
|
1082
1132
|
<footer class="rte-conditional-dialog-footer">
|
|
1083
|
-
<button type="button" class="rte-conditional-btn" data-action="cancel">${$(
|
|
1084
|
-
<button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(
|
|
1133
|
+
<button type="button" class="rte-conditional-btn" data-action="cancel">${$(r.cancelText)}</button>
|
|
1134
|
+
<button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(r.saveText)}</button>
|
|
1085
1135
|
</footer>
|
|
1086
1136
|
`, l.appendChild(d), document.body.appendChild(l);
|
|
1087
|
-
const
|
|
1088
|
-
l.removeEventListener("click",
|
|
1137
|
+
const N = d.querySelector(".rte-conditional-input-condition"), V = d.querySelector(".rte-conditional-input-audience"), h = d.querySelector(".rte-conditional-input-locale"), H = d.querySelector(".rte-conditional-input-else"), v = () => {
|
|
1138
|
+
l.removeEventListener("click", M), l.removeEventListener("keydown", be, !0), document.removeEventListener("keydown", q, !0), l.parentNode && l.parentNode.removeChild(l), de = null, e.focus({ preventScroll: !0 }), R(e);
|
|
1089
1139
|
}, q = (s) => {
|
|
1090
|
-
s.key === "Escape" && (s.preventDefault(), s.stopPropagation(),
|
|
1091
|
-
},
|
|
1092
|
-
s.target === l &&
|
|
1093
|
-
},
|
|
1140
|
+
s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), v());
|
|
1141
|
+
}, M = (s) => {
|
|
1142
|
+
s.target === l && v();
|
|
1143
|
+
}, xe = (s) => {
|
|
1094
1144
|
if (s.key !== "Tab") return;
|
|
1095
1145
|
const _ = Array.from(
|
|
1096
1146
|
d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
|
|
1097
1147
|
);
|
|
1098
1148
|
if (_.length === 0) return;
|
|
1099
|
-
const G = _[0], ce = _[_.length - 1],
|
|
1100
|
-
if (s.shiftKey &&
|
|
1149
|
+
const G = _[0], ce = _[_.length - 1], F = document.activeElement;
|
|
1150
|
+
if (s.shiftKey && F === G) {
|
|
1101
1151
|
s.preventDefault(), ce.focus();
|
|
1102
1152
|
return;
|
|
1103
1153
|
}
|
|
1104
|
-
!s.shiftKey &&
|
|
1154
|
+
!s.shiftKey && F === ce && (s.preventDefault(), G.focus());
|
|
1105
1155
|
}, fe = async () => {
|
|
1106
1156
|
var ce;
|
|
1107
1157
|
const s = {
|
|
1108
|
-
condition: ((ce =
|
|
1109
|
-
audience:
|
|
1110
|
-
locale:
|
|
1111
|
-
hasElse: (
|
|
1158
|
+
condition: ((ce = N == null ? void 0 : N.value) == null ? void 0 : ce.trim()) || "",
|
|
1159
|
+
audience: P(V == null ? void 0 : V.value),
|
|
1160
|
+
locale: P(h == null ? void 0 : h.value),
|
|
1161
|
+
hasElse: (H == null ? void 0 : H.checked) || !1
|
|
1112
1162
|
}, _ = e.innerHTML;
|
|
1113
1163
|
if (n)
|
|
1114
|
-
|
|
1164
|
+
lt(n, s, r), re(n, T.get(e) === !0);
|
|
1115
1165
|
else {
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1166
|
+
nt(e, a);
|
|
1167
|
+
const F = Pe(s, r);
|
|
1118
1168
|
try {
|
|
1119
|
-
|
|
1120
|
-
} catch (
|
|
1121
|
-
e.appendChild(
|
|
1122
|
-
const ke =
|
|
1123
|
-
ke ? $e(e, ke) : $e(e,
|
|
1169
|
+
Ke(e, F);
|
|
1170
|
+
} catch (pt) {
|
|
1171
|
+
e.appendChild(F);
|
|
1172
|
+
const ke = F.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
1173
|
+
ke ? $e(e, ke) : $e(e, F);
|
|
1124
1174
|
}
|
|
1125
1175
|
}
|
|
1126
|
-
|
|
1176
|
+
T.get(e) === !0 && await X(e, t, !0), De(e), Oe(e, _), R(e), v();
|
|
1127
1177
|
}, be = (s) => {
|
|
1128
1178
|
if (s.key === "Escape") {
|
|
1129
|
-
s.preventDefault(),
|
|
1179
|
+
s.preventDefault(), v();
|
|
1130
1180
|
return;
|
|
1131
1181
|
}
|
|
1132
|
-
|
|
1182
|
+
xe(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), fe());
|
|
1133
1183
|
};
|
|
1134
1184
|
d.addEventListener("click", (s) => {
|
|
1135
1185
|
const G = s.target.getAttribute("data-action");
|
|
1136
1186
|
if (G === "cancel") {
|
|
1137
|
-
|
|
1187
|
+
v();
|
|
1138
1188
|
return;
|
|
1139
1189
|
}
|
|
1140
1190
|
G === "save" && fe();
|
|
1141
|
-
}), l.addEventListener("click",
|
|
1191
|
+
}), l.addEventListener("click", M), l.addEventListener("keydown", be, !0), document.addEventListener("keydown", q, !0), de = { cleanup: v }, N == null || N.focus();
|
|
1142
1192
|
}
|
|
1143
|
-
function
|
|
1144
|
-
const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "",
|
|
1145
|
-
return
|
|
1193
|
+
function ut(e) {
|
|
1194
|
+
const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", r = t && e.altKey && e.shiftKey && (i === "c" || n === "keyc"), a = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f9" || n === "f9");
|
|
1195
|
+
return r || a;
|
|
1146
1196
|
}
|
|
1147
|
-
function
|
|
1148
|
-
const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "",
|
|
1149
|
-
return
|
|
1197
|
+
function ft(e) {
|
|
1198
|
+
const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", r = t && e.altKey && e.shiftKey && (i === "p" || n === "keyp"), a = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f10" || n === "f10");
|
|
1199
|
+
return r || a;
|
|
1150
1200
|
}
|
|
1151
|
-
function
|
|
1152
|
-
ne = e,
|
|
1153
|
-
const o = t.target, i = o == null ? void 0 : o.closest(
|
|
1201
|
+
function bt(e) {
|
|
1202
|
+
ne = e, J || (J = (t) => {
|
|
1203
|
+
const o = t.target, i = o == null ? void 0 : o.closest(w);
|
|
1154
1204
|
if (!i) return;
|
|
1155
|
-
y = i,
|
|
1156
|
-
const n =
|
|
1157
|
-
|
|
1158
|
-
}, document.addEventListener("focusin",
|
|
1159
|
-
var
|
|
1205
|
+
y = i, x.has(i) || x.set(i, e);
|
|
1206
|
+
const n = x.get(i) || e;
|
|
1207
|
+
ae(i, n.labels), _e(i, T.get(i) === !0), R(i);
|
|
1208
|
+
}, document.addEventListener("focusin", J, !0)), Y || (Y = (t) => {
|
|
1209
|
+
var C;
|
|
1160
1210
|
if (document.querySelector(`.${c}`)) return;
|
|
1161
1211
|
const i = t.target;
|
|
1162
1212
|
if (!!(i != null && i.closest("input, textarea, select"))) return;
|
|
1163
|
-
const
|
|
1164
|
-
if (!
|
|
1165
|
-
const l =
|
|
1166
|
-
if (
|
|
1167
|
-
const m =
|
|
1168
|
-
if (m &&
|
|
1169
|
-
t.preventDefault(), t.stopPropagation(), L(
|
|
1213
|
+
const a = (i == null ? void 0 : i.closest(w)) || k(void 0, !1) || y;
|
|
1214
|
+
if (!a || D(a)) return;
|
|
1215
|
+
const l = x.get(a) || ne || e, d = document.activeElement, E = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
|
|
1216
|
+
if (E && (t.key === "Enter" || t.key === " ")) {
|
|
1217
|
+
const m = E.closest(A);
|
|
1218
|
+
if (m && a.contains(m)) {
|
|
1219
|
+
t.preventDefault(), t.stopPropagation(), L(a, l, "edit", void 0, m);
|
|
1170
1220
|
return;
|
|
1171
1221
|
}
|
|
1172
1222
|
}
|
|
1173
|
-
if (
|
|
1223
|
+
if (ut(t)) {
|
|
1174
1224
|
t.preventDefault(), t.stopPropagation();
|
|
1175
|
-
const m = U(
|
|
1176
|
-
m ? L(
|
|
1225
|
+
const m = U(a);
|
|
1226
|
+
m ? L(a, l, "edit", void 0, m) : L(a, l, "insert");
|
|
1177
1227
|
return;
|
|
1178
1228
|
}
|
|
1179
|
-
if (
|
|
1229
|
+
if (ft(t)) {
|
|
1180
1230
|
t.preventDefault(), t.stopPropagation();
|
|
1181
|
-
const m =
|
|
1182
|
-
|
|
1231
|
+
const m = T.get(a) !== !0;
|
|
1232
|
+
X(a, l, m), R(a);
|
|
1183
1233
|
return;
|
|
1184
1234
|
}
|
|
1185
1235
|
if ((t.key === "Backspace" || t.key === "Delete") && !t.altKey && !t.ctrlKey && !t.metaKey) {
|
|
1186
1236
|
const m = window.getSelection();
|
|
1187
1237
|
if (!m || m.rangeCount === 0) return;
|
|
1188
1238
|
const S = m.getRangeAt(0);
|
|
1189
|
-
if (!S.collapsed || !
|
|
1190
|
-
const
|
|
1191
|
-
if (!
|
|
1192
|
-
if (t.key === "Backspace" &&
|
|
1239
|
+
if (!S.collapsed || !a.contains(S.commonAncestorContainer)) return;
|
|
1240
|
+
const B = (C = Qe(S.startContainer)) == null ? void 0 : C.closest(".rte-conditional-body");
|
|
1241
|
+
if (!B || !a.contains(B)) return;
|
|
1242
|
+
if (t.key === "Backspace" && He(S, B, "start")) {
|
|
1193
1243
|
t.preventDefault();
|
|
1194
1244
|
return;
|
|
1195
1245
|
}
|
|
1196
|
-
if (t.key === "Delete" &&
|
|
1246
|
+
if (t.key === "Delete" && He(S, B, "end")) {
|
|
1197
1247
|
t.preventDefault();
|
|
1198
1248
|
return;
|
|
1199
1249
|
}
|
|
1200
1250
|
}
|
|
1201
|
-
}, document.addEventListener("keydown",
|
|
1251
|
+
}, document.addEventListener("keydown", Y, !0)), ee || (ee = (t) => {
|
|
1202
1252
|
const o = t.target;
|
|
1203
1253
|
if (!o || o.closest(`.${u}`)) return;
|
|
1204
|
-
const i = o.closest(
|
|
1254
|
+
const i = o.closest(w);
|
|
1205
1255
|
if (!i) {
|
|
1206
|
-
y &&
|
|
1256
|
+
y && z(y);
|
|
1207
1257
|
return;
|
|
1208
1258
|
}
|
|
1209
1259
|
if (D(i)) return;
|
|
1210
|
-
y = i,
|
|
1211
|
-
const n = o.closest(
|
|
1260
|
+
y = i, x.has(i) || x.set(i, e);
|
|
1261
|
+
const n = o.closest(A);
|
|
1212
1262
|
if (!n) {
|
|
1213
|
-
|
|
1263
|
+
z(i);
|
|
1214
1264
|
return;
|
|
1215
1265
|
}
|
|
1216
1266
|
requestAnimationFrame(() => {
|
|
@@ -1219,39 +1269,39 @@ function dt(e) {
|
|
|
1219
1269
|
}, document.addEventListener("mousedown", ee, !0)), Q || (Q = (t) => {
|
|
1220
1270
|
const o = t.target;
|
|
1221
1271
|
if (!o || o.closest(`.${u}`)) return;
|
|
1222
|
-
const i = o.closest(
|
|
1272
|
+
const i = o.closest(w);
|
|
1223
1273
|
if (!i) {
|
|
1224
|
-
y &&
|
|
1274
|
+
y && z(y);
|
|
1225
1275
|
return;
|
|
1226
1276
|
}
|
|
1227
1277
|
if (D(i)) return;
|
|
1228
|
-
y = i,
|
|
1229
|
-
const n =
|
|
1230
|
-
if (
|
|
1231
|
-
t.preventDefault(), t.stopPropagation(), L(i, n, "edit", void 0,
|
|
1278
|
+
y = i, x.has(i) || x.set(i, e);
|
|
1279
|
+
const n = x.get(i) || e, r = o.closest(A), a = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
|
|
1280
|
+
if (r && a) {
|
|
1281
|
+
t.preventDefault(), t.stopPropagation(), L(i, n, "edit", void 0, r), ye(i, r);
|
|
1232
1282
|
return;
|
|
1233
1283
|
}
|
|
1234
|
-
|
|
1284
|
+
r ? ye(i, r) : z(i);
|
|
1235
1285
|
}, document.addEventListener("click", Q, !0)), te || (te = () => {
|
|
1236
|
-
const t =
|
|
1237
|
-
t && t.isConnected &&
|
|
1286
|
+
const t = k(void 0, !1) || y;
|
|
1287
|
+
t && t.isConnected && R(t);
|
|
1238
1288
|
}, document.addEventListener("selectionchange", te)), oe || (oe = (t) => {
|
|
1239
|
-
const o = t.target, i = o == null ? void 0 : o.closest(
|
|
1289
|
+
const o = t.target, i = o == null ? void 0 : o.closest(w);
|
|
1240
1290
|
if (!i) return;
|
|
1241
|
-
const n =
|
|
1242
|
-
|
|
1243
|
-
}, document.addEventListener("input", oe, !0)),
|
|
1244
|
-
|
|
1245
|
-
}, window.addEventListener("scroll",
|
|
1291
|
+
const n = x.get(i) || ne || e;
|
|
1292
|
+
ae(i, n.labels), R(i);
|
|
1293
|
+
}, document.addEventListener("input", oe, !0)), O || (O = () => {
|
|
1294
|
+
st();
|
|
1295
|
+
}, window.addEventListener("scroll", O, !0), window.addEventListener("resize", O));
|
|
1246
1296
|
}
|
|
1247
|
-
function
|
|
1248
|
-
|
|
1297
|
+
function mt() {
|
|
1298
|
+
J && (document.removeEventListener("focusin", J, !0), J = null), Y && (document.removeEventListener("keydown", Y, !0), Y = null), Q && (document.removeEventListener("click", Q, !0), Q = null), ee && (document.removeEventListener("mousedown", ee, !0), ee = null), te && (document.removeEventListener("selectionchange", te), te = null), oe && (document.removeEventListener("input", oe, !0), oe = null), O && (window.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O), O = null), I.forEach((e) => {
|
|
1249
1299
|
e.remove();
|
|
1250
|
-
}),
|
|
1300
|
+
}), I.clear(), j.clear(), ne = null, y = null;
|
|
1251
1301
|
}
|
|
1252
|
-
const
|
|
1253
|
-
const t =
|
|
1254
|
-
return
|
|
1302
|
+
const gt = (e = {}) => {
|
|
1303
|
+
const t = Je(e);
|
|
1304
|
+
return Ye(), {
|
|
1255
1305
|
name: "conditionalContent",
|
|
1256
1306
|
toolbar: [
|
|
1257
1307
|
{
|
|
@@ -1279,70 +1329,70 @@ const ft = (e = {}) => {
|
|
|
1279
1329
|
],
|
|
1280
1330
|
commands: {
|
|
1281
1331
|
conditionalContent: (o, i) => {
|
|
1282
|
-
const n =
|
|
1332
|
+
const n = k(i);
|
|
1283
1333
|
if (!n || D(n)) return !1;
|
|
1284
|
-
y = n,
|
|
1285
|
-
const
|
|
1286
|
-
if (
|
|
1334
|
+
y = n, x.set(n, t), ae(n, t.labels);
|
|
1335
|
+
const r = o == null ? void 0 : o.target;
|
|
1336
|
+
if (r === "insert")
|
|
1287
1337
|
return L(n, t, "insert", o), !0;
|
|
1288
|
-
const
|
|
1289
|
-
return
|
|
1338
|
+
const a = U(n);
|
|
1339
|
+
return r === "edit" || a ? !a && r === "edit" ? !1 : (L(n, t, "edit", o, a || void 0), !0) : (L(n, t, "insert", o), !0);
|
|
1290
1340
|
},
|
|
1291
1341
|
openConditionalDialog: (o, i) => {
|
|
1292
|
-
const n =
|
|
1342
|
+
const n = k(i);
|
|
1293
1343
|
if (!n || D(n)) return !1;
|
|
1294
|
-
y = n,
|
|
1295
|
-
const
|
|
1296
|
-
if (
|
|
1344
|
+
y = n, x.set(n, t), ae(n, t.labels);
|
|
1345
|
+
const r = o == null ? void 0 : o.target;
|
|
1346
|
+
if (r === "insert")
|
|
1297
1347
|
return L(n, t, "insert", o), !0;
|
|
1298
|
-
const
|
|
1299
|
-
return
|
|
1348
|
+
const a = U(n);
|
|
1349
|
+
return r === "edit" || a ? !a && r === "edit" ? !1 : (L(n, t, "edit", o, a || void 0), !0) : (L(n, t, "insert", o), !0);
|
|
1300
1350
|
},
|
|
1301
1351
|
conditionalPreview: async (o, i) => {
|
|
1302
|
-
const n =
|
|
1352
|
+
const n = k(i);
|
|
1303
1353
|
if (!n) return !1;
|
|
1304
|
-
y = n,
|
|
1305
|
-
const
|
|
1306
|
-
return await
|
|
1354
|
+
y = n, x.set(n, t);
|
|
1355
|
+
const r = typeof o == "boolean" ? o : T.get(n) !== !0;
|
|
1356
|
+
return await X(n, t, r), R(n), !0;
|
|
1307
1357
|
},
|
|
1308
1358
|
editConditionalBlock: (o, i) => {
|
|
1309
|
-
const n =
|
|
1359
|
+
const n = k(i);
|
|
1310
1360
|
if (!n || D(n)) return !1;
|
|
1311
|
-
y = n,
|
|
1312
|
-
const
|
|
1313
|
-
return
|
|
1361
|
+
y = n, x.set(n, t);
|
|
1362
|
+
const r = U(n);
|
|
1363
|
+
return r ? (L(n, t, "edit", o, r), !0) : !1;
|
|
1314
1364
|
},
|
|
1315
1365
|
deleteConditionalBlock: (o, i) => {
|
|
1316
|
-
const n =
|
|
1366
|
+
const n = k(i);
|
|
1317
1367
|
if (!n || D(n)) return !1;
|
|
1318
|
-
const
|
|
1319
|
-
if (!
|
|
1320
|
-
const
|
|
1321
|
-
return
|
|
1368
|
+
const r = U(n);
|
|
1369
|
+
if (!r) return !1;
|
|
1370
|
+
const a = ze(n, r);
|
|
1371
|
+
return a && R(n), a;
|
|
1322
1372
|
},
|
|
1323
1373
|
insertConditionalBlock: (o, i) => {
|
|
1324
|
-
var d,
|
|
1325
|
-
const n =
|
|
1374
|
+
var d, E, C, m;
|
|
1375
|
+
const n = k(i);
|
|
1326
1376
|
if (!n || D(n)) return !1;
|
|
1327
|
-
y = n,
|
|
1328
|
-
const
|
|
1377
|
+
y = n, x.set(n, t);
|
|
1378
|
+
const r = {
|
|
1329
1379
|
condition: (d = o == null ? void 0 : o.condition) != null ? d : t.defaultCondition,
|
|
1330
|
-
audience: (
|
|
1331
|
-
locale: (
|
|
1380
|
+
audience: (E = o == null ? void 0 : o.audience) != null ? E : t.defaultAudience,
|
|
1381
|
+
locale: (C = o == null ? void 0 : o.locale) != null ? C : t.defaultLocale,
|
|
1332
1382
|
hasElse: (m = o == null ? void 0 : o.hasElse) != null ? m : t.enableElseByDefault
|
|
1333
|
-
},
|
|
1334
|
-
return
|
|
1383
|
+
}, a = Pe(r, t.labels);
|
|
1384
|
+
return Ke(n, a), T.get(n) === !0 && X(n, t, !0), !0;
|
|
1335
1385
|
},
|
|
1336
1386
|
toggleConditionalPreview: async (o, i) => {
|
|
1337
|
-
const n =
|
|
1387
|
+
const n = k(i);
|
|
1338
1388
|
if (!n) return !1;
|
|
1339
|
-
y = n,
|
|
1340
|
-
const
|
|
1341
|
-
return await
|
|
1389
|
+
y = n, x.set(n, t);
|
|
1390
|
+
const r = typeof o == "boolean" ? o : T.get(n) !== !0;
|
|
1391
|
+
return await X(n, t, r), !0;
|
|
1342
1392
|
},
|
|
1343
1393
|
setConditionalContext: (o, i) => {
|
|
1344
|
-
const n =
|
|
1345
|
-
return n ? (y = n, !o || typeof o != "object" ?
|
|
1394
|
+
const n = k(i);
|
|
1395
|
+
return n ? (y = n, !o || typeof o != "object" ? ve.delete(n) : ve.set(n, o), T.get(n) === !0 && X(n, t, !0), !0) : !1;
|
|
1346
1396
|
}
|
|
1347
1397
|
},
|
|
1348
1398
|
keymap: {
|
|
@@ -1354,14 +1404,14 @@ const ft = (e = {}) => {
|
|
|
1354
1404
|
F10: "toggleConditionalPreview"
|
|
1355
1405
|
},
|
|
1356
1406
|
init: () => {
|
|
1357
|
-
me += 1,
|
|
1407
|
+
me += 1, bt(t);
|
|
1358
1408
|
},
|
|
1359
1409
|
destroy: () => {
|
|
1360
|
-
me = Math.max(0, me - 1), me === 0 && (
|
|
1410
|
+
me = Math.max(0, me - 1), me === 0 && (Re(), mt());
|
|
1361
1411
|
}
|
|
1362
1412
|
};
|
|
1363
1413
|
};
|
|
1364
1414
|
export {
|
|
1365
|
-
|
|
1415
|
+
gt as ConditionalContentPlugin
|
|
1366
1416
|
};
|
|
1367
|
-
//# sourceMappingURL=ConditionalContentPlugin.native-
|
|
1417
|
+
//# sourceMappingURL=ConditionalContentPlugin.native-Bf7XgRSW.mjs.map
|