@editora/plugins 1.0.10 → 1.0.11
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/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +80 -98
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +115 -128
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +208 -249
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +55 -68
- package/dist/blockquote.esm.js +1 -2
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +178 -245
- package/dist/capitalization.esm.js +1 -2
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +58 -82
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +439 -512
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +27 -33
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +82 -93
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +501 -506
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +116 -158
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +371 -432
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +105 -159
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +328 -368
- package/dist/direction.esm.js +9 -18
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +240 -308
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +4 -5
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +73 -81
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +65 -77
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +54 -56
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +39 -47
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +37 -53
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +76 -117
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +70 -92
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +12 -24
- package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-CE_A4QSm.js +5 -0
- package/dist/index.es-DQ78mYYo.mjs +6665 -0
- package/dist/index.esm.js +125 -128
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +8 -9
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +11 -24
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +24 -30
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +20 -25
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +59 -61
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +139 -146
- package/dist/media-manager.cjs.js +31 -31
- package/dist/media-manager.esm.js +285 -300
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +238 -286
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +177 -216
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +33 -49
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +393 -463
- package/dist/plugins.css +1 -0
- package/dist/preview.esm.js +5 -10
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +17 -20
- package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
- package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
- package/dist/slash-commands.cjs.js +2 -2
- package/dist/slash-commands.esm.js +39 -75
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +280 -336
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +61 -69
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +97 -123
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +14 -19
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +191 -225
- package/dist/template.cjs.js +21 -20
- package/dist/template.esm.js +715 -196
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +21 -27
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +70 -87
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +100 -162
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +602 -678
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +128 -157
- package/package.json +1 -1
- package/dist/_commonjsHelpers-6763f629.js +0 -1
- package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
- package/dist/anchoredPopover-33f1358d.mjs +0 -109
- package/dist/anchoredPopover-8151d535.js +0 -1
- package/dist/documentManager-25b6203c.mjs +0 -9122
- package/dist/documentManager-b69e7054.js +0 -17
- package/dist/html2canvas.esm-09133e29.js +0 -22
- package/dist/index-656d224b.js +0 -231
- package/dist/index-6a8c48bb.js +0 -1
- package/dist/index-d027b7e2.mjs +0 -16859
- package/dist/index.es-730f2d98.mjs +0 -5775
- package/dist/index.es-dd40173b.js +0 -18
- package/dist/jspdf.es.min-90db2c97.js +0 -243
- package/dist/style.css +0 -1
- /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
const
|
|
1
|
+
const L = ".rte-content, .editora-content", H = '.rte-conditional-block[data-conditional-content="true"]', b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', f = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', p = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", h = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Ce = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", w = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
|
|
2
|
+
let le = null, se = 0, G = null, U = null, Y = null, J = null, X = null, Q = null, N = null, g = null, ee = null;
|
|
3
|
+
const Pe = {
|
|
4
4
|
dialogTitleInsert: "Insert Conditional Content",
|
|
5
5
|
dialogTitleEdit: "Edit Conditional Content",
|
|
6
6
|
conditionLabel: "Condition",
|
|
@@ -17,94 +17,83 @@ const Re = {
|
|
|
17
17
|
allAudiencesText: "all audiences",
|
|
18
18
|
allLocalesText: "all locales"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function y(e) {
|
|
21
21
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function O(e) {
|
|
24
24
|
return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : [];
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Le(e) {
|
|
27
27
|
return !e || e.length === 0 ? "" : e.join(", ");
|
|
28
28
|
}
|
|
29
29
|
function te(e) {
|
|
30
30
|
return e ? e.map((t) => t.trim()).filter(Boolean) : [];
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Re(e) {
|
|
33
33
|
return {
|
|
34
|
-
...
|
|
34
|
+
...Pe,
|
|
35
35
|
...e || {}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function k(e) {
|
|
39
39
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function ce(e) {
|
|
42
42
|
return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || e;
|
|
43
43
|
}
|
|
44
44
|
function ue(e) {
|
|
45
|
-
if (!e)
|
|
46
|
-
return !1;
|
|
45
|
+
if (!e) return !1;
|
|
47
46
|
const t = e.getAttribute("data-theme") || e.getAttribute("theme");
|
|
48
47
|
return t && t.toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark");
|
|
49
48
|
}
|
|
50
|
-
function
|
|
51
|
-
const t =
|
|
52
|
-
if (ue(t))
|
|
53
|
-
return !0;
|
|
49
|
+
function qe(e) {
|
|
50
|
+
const t = ce(e);
|
|
51
|
+
if (ue(t)) return !0;
|
|
54
52
|
const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
55
53
|
return ue(o) ? !0 : ue(document.documentElement) || ue(document.body);
|
|
56
54
|
}
|
|
57
55
|
function fe(e) {
|
|
58
|
-
if (!e)
|
|
59
|
-
return !1;
|
|
56
|
+
if (!e) return !1;
|
|
60
57
|
const t = e.getAttribute("data-theme") || e.getAttribute("theme");
|
|
61
58
|
return t && t.toLowerCase() === "acme" ? !0 : e.classList.contains("editora-theme-acme") || e.classList.contains("rte-theme-acme");
|
|
62
59
|
}
|
|
63
|
-
function
|
|
64
|
-
const t =
|
|
65
|
-
if (fe(t))
|
|
66
|
-
return !0;
|
|
60
|
+
function Ke(e) {
|
|
61
|
+
const t = ce(e);
|
|
62
|
+
if (fe(t)) return !0;
|
|
67
63
|
const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
|
|
68
64
|
return fe(o) ? !0 : fe(document.documentElement) || fe(document.body);
|
|
69
65
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
66
|
+
function Ie(e) {
|
|
67
|
+
return qe(e) ? "dark" : Ke(e) ? "acme" : "light";
|
|
72
68
|
}
|
|
73
69
|
function he(e, t) {
|
|
74
|
-
const o =
|
|
70
|
+
const o = Ie(t);
|
|
75
71
|
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");
|
|
76
72
|
}
|
|
77
|
-
function
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
73
|
+
function A(e, t = !0) {
|
|
74
|
+
if (e?.contentElement instanceof HTMLElement) return e.contentElement;
|
|
75
|
+
if (e?.editorElement instanceof HTMLElement) {
|
|
81
76
|
const n = e.editorElement;
|
|
82
|
-
if (n.matches(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (a instanceof HTMLElement)
|
|
86
|
-
return a;
|
|
77
|
+
if (n.matches(L)) return n;
|
|
78
|
+
const a = n.querySelector(L);
|
|
79
|
+
if (a instanceof HTMLElement) return a;
|
|
87
80
|
}
|
|
88
81
|
const o = window.getSelection();
|
|
89
82
|
if (o && o.rangeCount > 0) {
|
|
90
|
-
const n = o.getRangeAt(0).startContainer,
|
|
91
|
-
if (r)
|
|
92
|
-
return r;
|
|
83
|
+
const n = o.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(L);
|
|
84
|
+
if (r) return r;
|
|
93
85
|
}
|
|
94
86
|
const i = document.activeElement;
|
|
95
87
|
if (i) {
|
|
96
|
-
if (i.matches(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (n)
|
|
100
|
-
return n;
|
|
88
|
+
if (i.matches(L)) return i;
|
|
89
|
+
const n = i.closest(L);
|
|
90
|
+
if (n) return n;
|
|
101
91
|
}
|
|
102
|
-
return
|
|
92
|
+
return g && g.isConnected ? g : t ? document.querySelector(L) : null;
|
|
103
93
|
}
|
|
104
|
-
function
|
|
94
|
+
function ke(e) {
|
|
105
95
|
const t = window.getSelection();
|
|
106
|
-
if (!t || t.rangeCount === 0)
|
|
107
|
-
return null;
|
|
96
|
+
if (!t || t.rangeCount === 0) return null;
|
|
108
97
|
const o = t.getRangeAt(0);
|
|
109
98
|
return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
|
|
110
99
|
}
|
|
@@ -112,12 +101,11 @@ function xe(e, t) {
|
|
|
112
101
|
const o = window.getSelection();
|
|
113
102
|
o && (o.removeAllRanges(), o.addRange(t), e.focus({ preventScroll: !0 }));
|
|
114
103
|
}
|
|
115
|
-
function
|
|
104
|
+
function Se(e) {
|
|
116
105
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
117
106
|
}
|
|
118
|
-
function
|
|
119
|
-
if (t === e.innerHTML)
|
|
120
|
-
return;
|
|
107
|
+
function Te(e, t) {
|
|
108
|
+
if (t === e.innerHTML) return;
|
|
121
109
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
122
110
|
if (typeof o == "function")
|
|
123
111
|
try {
|
|
@@ -136,19 +124,15 @@ function ye(e, t) {
|
|
|
136
124
|
return o[i];
|
|
137
125
|
}, e);
|
|
138
126
|
}
|
|
139
|
-
function
|
|
127
|
+
function _e(e) {
|
|
140
128
|
const t = e.trim();
|
|
141
129
|
if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'"))
|
|
142
130
|
return t.slice(1, -1);
|
|
143
|
-
if (t === "true")
|
|
144
|
-
|
|
145
|
-
if (t === "
|
|
146
|
-
return !1;
|
|
147
|
-
if (t === "null")
|
|
148
|
-
return null;
|
|
131
|
+
if (t === "true") return !0;
|
|
132
|
+
if (t === "false") return !1;
|
|
133
|
+
if (t === "null") return null;
|
|
149
134
|
const o = Number(t);
|
|
150
|
-
if (!Number.isNaN(o) && t !== "")
|
|
151
|
-
return o;
|
|
135
|
+
if (!Number.isNaN(o) && t !== "") return o;
|
|
152
136
|
if (t.startsWith("[") && t.endsWith("]") || t.startsWith("{") && t.endsWith("}"))
|
|
153
137
|
try {
|
|
154
138
|
return JSON.parse(t);
|
|
@@ -157,10 +141,9 @@ function Fe(e) {
|
|
|
157
141
|
}
|
|
158
142
|
return t;
|
|
159
143
|
}
|
|
160
|
-
function
|
|
144
|
+
function ze(e, t) {
|
|
161
145
|
const o = e.trim();
|
|
162
|
-
if (!o)
|
|
163
|
-
return !0;
|
|
146
|
+
if (!o) return !0;
|
|
164
147
|
if (o.startsWith("!")) {
|
|
165
148
|
const E = o.slice(1).trim();
|
|
166
149
|
return !ye(t, E);
|
|
@@ -168,7 +151,7 @@ function je(e, t) {
|
|
|
168
151
|
const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
|
|
169
152
|
if (!i)
|
|
170
153
|
return !!ye(t, o);
|
|
171
|
-
const [, n, a, r] = i, l = ye(t, n), d =
|
|
154
|
+
const [, n, a, r] = i, l = ye(t, n), d = _e(r);
|
|
172
155
|
switch (a) {
|
|
173
156
|
case "==":
|
|
174
157
|
return l == d;
|
|
@@ -191,11 +174,10 @@ function je(e, t) {
|
|
|
191
174
|
return !1;
|
|
192
175
|
}
|
|
193
176
|
}
|
|
194
|
-
function
|
|
195
|
-
if (typeof document > "u" || document.getElementById(
|
|
196
|
-
return;
|
|
177
|
+
function Fe() {
|
|
178
|
+
if (typeof document > "u" || document.getElementById(Ce)) return;
|
|
197
179
|
const e = document.createElement("style");
|
|
198
|
-
e.id =
|
|
180
|
+
e.id = Ce, e.textContent = `
|
|
199
181
|
.rte-conditional-block {
|
|
200
182
|
border: 1px solid #dbe3ec;
|
|
201
183
|
border-radius: 8px;
|
|
@@ -431,7 +413,7 @@ function Ie() {
|
|
|
431
413
|
background: #1d4ed8;
|
|
432
414
|
}
|
|
433
415
|
|
|
434
|
-
.${
|
|
416
|
+
.${u} {
|
|
435
417
|
position: fixed;
|
|
436
418
|
z-index: 2147483645;
|
|
437
419
|
display: none;
|
|
@@ -445,11 +427,11 @@ function Ie() {
|
|
|
445
427
|
backdrop-filter: blur(6px);
|
|
446
428
|
}
|
|
447
429
|
|
|
448
|
-
.${
|
|
430
|
+
.${u}.show {
|
|
449
431
|
display: inline-flex;
|
|
450
432
|
}
|
|
451
433
|
|
|
452
|
-
.${
|
|
434
|
+
.${u} .rte-conditional-float-btn {
|
|
453
435
|
border: 1px solid #cbd5e1;
|
|
454
436
|
border-radius: 6px;
|
|
455
437
|
min-height: 30px;
|
|
@@ -466,27 +448,27 @@ function Ie() {
|
|
|
466
448
|
line-height: 1;
|
|
467
449
|
}
|
|
468
450
|
|
|
469
|
-
.${
|
|
451
|
+
.${u} .rte-conditional-float-btn:hover {
|
|
470
452
|
background: #f8fafc;
|
|
471
453
|
}
|
|
472
454
|
|
|
473
|
-
.${
|
|
455
|
+
.${u} .rte-conditional-float-btn[data-action="delete"] {
|
|
474
456
|
border-color: #fecaca;
|
|
475
457
|
color: #991b1b;
|
|
476
458
|
background: #fff5f5;
|
|
477
459
|
}
|
|
478
460
|
|
|
479
|
-
.rte-conditional-preview-on ${
|
|
461
|
+
.rte-conditional-preview-on ${H} {
|
|
480
462
|
border-width: 2px;
|
|
481
463
|
}
|
|
482
464
|
|
|
483
|
-
.rte-conditional-preview-on ${
|
|
465
|
+
.rte-conditional-preview-on ${H} .rte-conditional-header {
|
|
484
466
|
background: #ecfeff;
|
|
485
467
|
border-color: #bae6fd;
|
|
486
468
|
}
|
|
487
469
|
|
|
488
470
|
${b} .rte-conditional-block,
|
|
489
|
-
${
|
|
471
|
+
${p} .rte-conditional-block,
|
|
490
472
|
.${c}.rte-conditional-theme-dark .rte-conditional-block {
|
|
491
473
|
background: #111827;
|
|
492
474
|
border-color: #334155;
|
|
@@ -494,8 +476,8 @@ function Ie() {
|
|
|
494
476
|
|
|
495
477
|
${b} .rte-conditional-header,
|
|
496
478
|
${b} .rte-conditional-else-label,
|
|
497
|
-
${
|
|
498
|
-
${
|
|
479
|
+
${p} .rte-conditional-header,
|
|
480
|
+
${p} .rte-conditional-else-label,
|
|
499
481
|
.${c}.rte-conditional-theme-dark .rte-conditional-header,
|
|
500
482
|
.${c}.rte-conditional-theme-dark .rte-conditional-else-label {
|
|
501
483
|
background: #0f172a;
|
|
@@ -503,19 +485,19 @@ function Ie() {
|
|
|
503
485
|
}
|
|
504
486
|
|
|
505
487
|
${b} .rte-conditional-summary,
|
|
506
|
-
${
|
|
488
|
+
${p} .rte-conditional-summary,
|
|
507
489
|
.${c}.rte-conditional-theme-dark .rte-conditional-summary {
|
|
508
490
|
color: #e2e8f0;
|
|
509
491
|
}
|
|
510
492
|
|
|
511
493
|
${b} .rte-conditional-meta,
|
|
512
|
-
${
|
|
494
|
+
${p} .rte-conditional-meta,
|
|
513
495
|
.${c}.rte-conditional-theme-dark .rte-conditional-meta {
|
|
514
496
|
color: #94a3b8;
|
|
515
497
|
}
|
|
516
498
|
|
|
517
499
|
${b} .rte-conditional-chip,
|
|
518
|
-
${
|
|
500
|
+
${p} .rte-conditional-chip,
|
|
519
501
|
.${c}.rte-conditional-theme-dark .rte-conditional-chip {
|
|
520
502
|
background: #1e3a8a;
|
|
521
503
|
border-color: #3b82f6;
|
|
@@ -523,7 +505,7 @@ function Ie() {
|
|
|
523
505
|
}
|
|
524
506
|
|
|
525
507
|
${b} .rte-conditional-chip-else,
|
|
526
|
-
${
|
|
508
|
+
${p} .rte-conditional-chip-else,
|
|
527
509
|
.${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
|
|
528
510
|
background: #7f1d1d;
|
|
529
511
|
border-color: #ef4444;
|
|
@@ -531,14 +513,14 @@ function Ie() {
|
|
|
531
513
|
}
|
|
532
514
|
|
|
533
515
|
${b} .rte-conditional-body,
|
|
534
|
-
${
|
|
516
|
+
${p} .rte-conditional-body,
|
|
535
517
|
.${c}.rte-conditional-theme-dark .rte-conditional-body {
|
|
536
518
|
background: #1f2937;
|
|
537
519
|
color: #e2e8f0;
|
|
538
520
|
}
|
|
539
521
|
|
|
540
522
|
${b} .rte-conditional-dialog,
|
|
541
|
-
${
|
|
523
|
+
${p} .rte-conditional-dialog,
|
|
542
524
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog {
|
|
543
525
|
background: #1f2937;
|
|
544
526
|
border-color: #334155;
|
|
@@ -546,8 +528,8 @@ function Ie() {
|
|
|
546
528
|
|
|
547
529
|
${b} .rte-conditional-dialog-header,
|
|
548
530
|
${b} .rte-conditional-dialog-footer,
|
|
549
|
-
${
|
|
550
|
-
${
|
|
531
|
+
${p} .rte-conditional-dialog-header,
|
|
532
|
+
${p} .rte-conditional-dialog-footer,
|
|
551
533
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
|
|
552
534
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
|
|
553
535
|
background: #111827;
|
|
@@ -557,9 +539,9 @@ function Ie() {
|
|
|
557
539
|
${b} .rte-conditional-dialog-title,
|
|
558
540
|
${b} .rte-conditional-field label,
|
|
559
541
|
${b} .rte-conditional-checkbox,
|
|
560
|
-
${
|
|
561
|
-
${
|
|
562
|
-
${
|
|
542
|
+
${p} .rte-conditional-dialog-title,
|
|
543
|
+
${p} .rte-conditional-field label,
|
|
544
|
+
${p} .rte-conditional-checkbox,
|
|
563
545
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
|
|
564
546
|
.${c}.rte-conditional-theme-dark .rte-conditional-field label,
|
|
565
547
|
.${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
|
|
@@ -567,15 +549,15 @@ function Ie() {
|
|
|
567
549
|
}
|
|
568
550
|
|
|
569
551
|
${b} .rte-conditional-help,
|
|
570
|
-
${
|
|
552
|
+
${p} .rte-conditional-help,
|
|
571
553
|
.${c}.rte-conditional-theme-dark .rte-conditional-help {
|
|
572
554
|
color: #94a3b8;
|
|
573
555
|
}
|
|
574
556
|
|
|
575
557
|
${b} .rte-conditional-field input[type="text"],
|
|
576
558
|
${b} .rte-conditional-btn,
|
|
577
|
-
${
|
|
578
|
-
${
|
|
559
|
+
${p} .rte-conditional-field input[type="text"],
|
|
560
|
+
${p} .rte-conditional-btn,
|
|
579
561
|
.${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
|
|
580
562
|
.${c}.rte-conditional-theme-dark .rte-conditional-btn {
|
|
581
563
|
background: #0f172a;
|
|
@@ -584,7 +566,7 @@ function Ie() {
|
|
|
584
566
|
}
|
|
585
567
|
|
|
586
568
|
${b} .rte-conditional-btn-primary,
|
|
587
|
-
${
|
|
569
|
+
${p} .rte-conditional-btn-primary,
|
|
588
570
|
.${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
|
|
589
571
|
border-color: #3b82f6;
|
|
590
572
|
background: #2563eb;
|
|
@@ -593,43 +575,43 @@ function Ie() {
|
|
|
593
575
|
|
|
594
576
|
${b} .rte-toolbar-group-items.conditional-content,
|
|
595
577
|
.${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
|
|
596
|
-
${
|
|
578
|
+
${p} .rte-toolbar-group-items.conditional-content,
|
|
597
579
|
${b} .editora-toolbar-group-items.conditional-content {
|
|
598
580
|
border-color: #566275;
|
|
599
581
|
}
|
|
600
582
|
|
|
601
583
|
${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
602
|
-
${
|
|
584
|
+
${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
603
585
|
${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
|
|
604
586
|
border-right-color: #566275;
|
|
605
587
|
}
|
|
606
588
|
|
|
607
|
-
${b} .${
|
|
608
|
-
.${c}.rte-conditional-theme-dark .${
|
|
609
|
-
.${
|
|
589
|
+
${b} .${u},
|
|
590
|
+
.${c}.rte-conditional-theme-dark .${u},
|
|
591
|
+
.${u}.rte-conditional-theme-dark {
|
|
610
592
|
background: rgba(17, 24, 39, 0.98);
|
|
611
593
|
border-color: #334155;
|
|
612
594
|
box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
|
|
613
595
|
}
|
|
614
596
|
|
|
615
|
-
${b} .${
|
|
616
|
-
.${c}.rte-conditional-theme-dark .${
|
|
617
|
-
.${
|
|
597
|
+
${b} .${u} .rte-conditional-float-btn,
|
|
598
|
+
.${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
|
|
599
|
+
.${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
|
|
618
600
|
background: #0f172a;
|
|
619
601
|
border-color: #475569;
|
|
620
602
|
color: #e2e8f0;
|
|
621
603
|
}
|
|
622
604
|
|
|
623
|
-
${b} .${
|
|
624
|
-
.${c}.rte-conditional-theme-dark .${
|
|
625
|
-
.${
|
|
605
|
+
${b} .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
606
|
+
.${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
607
|
+
.${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
|
|
626
608
|
border-color: #ef4444;
|
|
627
609
|
color: #fecaca;
|
|
628
610
|
background: rgba(127, 29, 29, 0.45);
|
|
629
611
|
}
|
|
630
612
|
|
|
631
613
|
${f} .rte-conditional-block,
|
|
632
|
-
${
|
|
614
|
+
${h} .rte-conditional-block,
|
|
633
615
|
.${c}.rte-conditional-theme-acme .rte-conditional-block {
|
|
634
616
|
background: #f8fbff;
|
|
635
617
|
border-color: #cbd8e8;
|
|
@@ -637,8 +619,8 @@ function Ie() {
|
|
|
637
619
|
|
|
638
620
|
${f} .rte-conditional-header,
|
|
639
621
|
${f} .rte-conditional-else-label,
|
|
640
|
-
${
|
|
641
|
-
${
|
|
622
|
+
${h} .rte-conditional-header,
|
|
623
|
+
${h} .rte-conditional-else-label,
|
|
642
624
|
.${c}.rte-conditional-theme-acme .rte-conditional-header,
|
|
643
625
|
.${c}.rte-conditional-theme-acme .rte-conditional-else-label {
|
|
644
626
|
background: linear-gradient(180deg, #eef4fb 0%, #e6eef8 100%);
|
|
@@ -646,19 +628,19 @@ function Ie() {
|
|
|
646
628
|
}
|
|
647
629
|
|
|
648
630
|
${f} .rte-conditional-summary,
|
|
649
|
-
${
|
|
631
|
+
${h} .rte-conditional-summary,
|
|
650
632
|
.${c}.rte-conditional-theme-acme .rte-conditional-summary {
|
|
651
633
|
color: #0f172a;
|
|
652
634
|
}
|
|
653
635
|
|
|
654
636
|
${f} .rte-conditional-meta,
|
|
655
|
-
${
|
|
637
|
+
${h} .rte-conditional-meta,
|
|
656
638
|
.${c}.rte-conditional-theme-acme .rte-conditional-meta {
|
|
657
639
|
color: #587089;
|
|
658
640
|
}
|
|
659
641
|
|
|
660
642
|
${f} .rte-conditional-chip,
|
|
661
|
-
${
|
|
643
|
+
${h} .rte-conditional-chip,
|
|
662
644
|
.${c}.rte-conditional-theme-acme .rte-conditional-chip {
|
|
663
645
|
background: #d9f5ee;
|
|
664
646
|
border-color: #66c6b3;
|
|
@@ -666,7 +648,7 @@ function Ie() {
|
|
|
666
648
|
}
|
|
667
649
|
|
|
668
650
|
${f} .rte-conditional-chip-else,
|
|
669
|
-
${
|
|
651
|
+
${h} .rte-conditional-chip-else,
|
|
670
652
|
.${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
|
|
671
653
|
background: #fde8ea;
|
|
672
654
|
border-color: #f1a7b2;
|
|
@@ -674,14 +656,14 @@ function Ie() {
|
|
|
674
656
|
}
|
|
675
657
|
|
|
676
658
|
${f} .rte-conditional-body,
|
|
677
|
-
${
|
|
659
|
+
${h} .rte-conditional-body,
|
|
678
660
|
.${c}.rte-conditional-theme-acme .rte-conditional-body {
|
|
679
661
|
background: #fcfeff;
|
|
680
662
|
color: #0f172a;
|
|
681
663
|
}
|
|
682
664
|
|
|
683
665
|
${f} .rte-conditional-dialog,
|
|
684
|
-
${
|
|
666
|
+
${h} .rte-conditional-dialog,
|
|
685
667
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog {
|
|
686
668
|
background: #ffffff;
|
|
687
669
|
border-color: #cbd8e8;
|
|
@@ -690,8 +672,8 @@ function Ie() {
|
|
|
690
672
|
|
|
691
673
|
${f} .rte-conditional-dialog-header,
|
|
692
674
|
${f} .rte-conditional-dialog-footer,
|
|
693
|
-
${
|
|
694
|
-
${
|
|
675
|
+
${h} .rte-conditional-dialog-header,
|
|
676
|
+
${h} .rte-conditional-dialog-footer,
|
|
695
677
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
|
|
696
678
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog-footer {
|
|
697
679
|
background: #f3f8fd;
|
|
@@ -701,9 +683,9 @@ function Ie() {
|
|
|
701
683
|
${f} .rte-conditional-dialog-title,
|
|
702
684
|
${f} .rte-conditional-field label,
|
|
703
685
|
${f} .rte-conditional-checkbox,
|
|
704
|
-
${
|
|
705
|
-
${
|
|
706
|
-
${
|
|
686
|
+
${h} .rte-conditional-dialog-title,
|
|
687
|
+
${h} .rte-conditional-field label,
|
|
688
|
+
${h} .rte-conditional-checkbox,
|
|
707
689
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog-title,
|
|
708
690
|
.${c}.rte-conditional-theme-acme .rte-conditional-field label,
|
|
709
691
|
.${c}.rte-conditional-theme-acme .rte-conditional-checkbox {
|
|
@@ -711,15 +693,15 @@ function Ie() {
|
|
|
711
693
|
}
|
|
712
694
|
|
|
713
695
|
${f} .rte-conditional-help,
|
|
714
|
-
${
|
|
696
|
+
${h} .rte-conditional-help,
|
|
715
697
|
.${c}.rte-conditional-theme-acme .rte-conditional-help {
|
|
716
698
|
color: #5f738d;
|
|
717
699
|
}
|
|
718
700
|
|
|
719
701
|
${f} .rte-conditional-field input[type="text"],
|
|
720
702
|
${f} .rte-conditional-btn,
|
|
721
|
-
${
|
|
722
|
-
${
|
|
703
|
+
${h} .rte-conditional-field input[type="text"],
|
|
704
|
+
${h} .rte-conditional-btn,
|
|
723
705
|
.${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
|
|
724
706
|
.${c}.rte-conditional-theme-acme .rte-conditional-btn {
|
|
725
707
|
background: #ffffff;
|
|
@@ -728,7 +710,7 @@ function Ie() {
|
|
|
728
710
|
}
|
|
729
711
|
|
|
730
712
|
${f} .rte-conditional-btn-primary,
|
|
731
|
-
${
|
|
713
|
+
${h} .rte-conditional-btn-primary,
|
|
732
714
|
.${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
|
|
733
715
|
border-color: #0f766e;
|
|
734
716
|
background: #0f766e;
|
|
@@ -737,67 +719,67 @@ function Ie() {
|
|
|
737
719
|
|
|
738
720
|
${f} .rte-toolbar-group-items.conditional-content,
|
|
739
721
|
.${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
|
|
740
|
-
${
|
|
722
|
+
${h} .rte-toolbar-group-items.conditional-content,
|
|
741
723
|
${f} .editora-toolbar-group-items.conditional-content {
|
|
742
724
|
border-color: #bfd0e2;
|
|
743
725
|
}
|
|
744
726
|
|
|
745
727
|
${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
746
|
-
${
|
|
728
|
+
${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
747
729
|
${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
|
|
748
730
|
border-right-color: #bfd0e2;
|
|
749
731
|
}
|
|
750
732
|
|
|
751
|
-
${f} .${
|
|
752
|
-
.${c}.rte-conditional-theme-acme .${
|
|
753
|
-
.${
|
|
733
|
+
${f} .${u},
|
|
734
|
+
.${c}.rte-conditional-theme-acme .${u},
|
|
735
|
+
.${u}.rte-conditional-theme-acme {
|
|
754
736
|
background: rgba(255, 255, 255, 0.98);
|
|
755
737
|
border-color: #bfd0e2;
|
|
756
738
|
box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
|
|
757
739
|
}
|
|
758
740
|
|
|
759
|
-
${f} .${
|
|
760
|
-
.${c}.rte-conditional-theme-acme .${
|
|
761
|
-
.${
|
|
741
|
+
${f} .${u} .rte-conditional-float-btn,
|
|
742
|
+
.${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
|
|
743
|
+
.${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
|
|
762
744
|
background: #ffffff;
|
|
763
745
|
border-color: #bfd0e2;
|
|
764
746
|
color: #1f334a;
|
|
765
747
|
}
|
|
766
748
|
|
|
767
|
-
${f} .${
|
|
768
|
-
.${c}.rte-conditional-theme-acme .${
|
|
769
|
-
.${
|
|
749
|
+
${f} .${u} .rte-conditional-float-btn:hover,
|
|
750
|
+
.${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
|
|
751
|
+
.${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
|
|
770
752
|
background: #eef7f5;
|
|
771
753
|
color: #0f4f4a;
|
|
772
754
|
}
|
|
773
755
|
|
|
774
|
-
${f} .${
|
|
775
|
-
.${c}.rte-conditional-theme-acme .${
|
|
776
|
-
.${
|
|
756
|
+
${f} .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
757
|
+
.${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
|
|
758
|
+
.${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
|
|
777
759
|
border-color: #f1a7b2;
|
|
778
760
|
color: #8b1f2f;
|
|
779
761
|
background: #fff4f6;
|
|
780
762
|
}
|
|
781
763
|
`, document.head.appendChild(e);
|
|
782
764
|
}
|
|
783
|
-
function
|
|
765
|
+
function je(e) {
|
|
784
766
|
return {
|
|
785
767
|
defaultCondition: e.defaultCondition || "",
|
|
786
768
|
defaultAudience: te(e.defaultAudience || []),
|
|
787
769
|
defaultLocale: te(e.defaultLocale || []),
|
|
788
770
|
enableElseByDefault: e.enableElseByDefault === !0,
|
|
789
|
-
labels:
|
|
771
|
+
labels: Re(e.labels),
|
|
790
772
|
context: e.context,
|
|
791
773
|
getContext: e.getContext,
|
|
792
774
|
currentAudience: e.currentAudience,
|
|
793
775
|
currentLocale: e.currentLocale,
|
|
794
|
-
evaluateCondition: e.evaluateCondition ||
|
|
776
|
+
evaluateCondition: e.evaluateCondition || ze
|
|
795
777
|
};
|
|
796
778
|
}
|
|
797
|
-
function
|
|
798
|
-
|
|
779
|
+
function Be() {
|
|
780
|
+
le && (le.cleanup(), le = null);
|
|
799
781
|
}
|
|
800
|
-
function
|
|
782
|
+
function Ve(e) {
|
|
801
783
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
802
784
|
}
|
|
803
785
|
function oe(e, t) {
|
|
@@ -805,12 +787,11 @@ function oe(e, t) {
|
|
|
805
787
|
const o = e.querySelector(".rte-conditional-header");
|
|
806
788
|
o && (o.setAttribute("contenteditable", "false"), o.setAttribute("tabindex", "0"), o.setAttribute("role", "button"), o.setAttribute("aria-label", "Edit conditional rule"));
|
|
807
789
|
const i = e.querySelector(".rte-conditional-else-label");
|
|
808
|
-
i && i.setAttribute("contenteditable", "false"),
|
|
790
|
+
i && i.setAttribute("contenteditable", "false"), Ge(e, !t);
|
|
809
791
|
}
|
|
810
|
-
function
|
|
792
|
+
function We(e) {
|
|
811
793
|
const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
812
|
-
if (!t)
|
|
813
|
-
return;
|
|
794
|
+
if (!t) return;
|
|
814
795
|
const o = /* @__PURE__ */ new Set(), i = e.querySelector(".rte-conditional-header"), n = e.querySelector(".rte-conditional-else-label"), a = e.querySelector('.rte-conditional-body[data-slot="else"]');
|
|
815
796
|
i && o.add(i), o.add(t), n && o.add(n), a && o.add(a), Array.from(e.childNodes).forEach((l) => {
|
|
816
797
|
if (!(l instanceof HTMLElement && o.has(l))) {
|
|
@@ -825,47 +806,46 @@ function Ze(e) {
|
|
|
825
806
|
function W(e) {
|
|
826
807
|
const t = window.getSelection();
|
|
827
808
|
if (t && t.rangeCount > 0) {
|
|
828
|
-
const n = t.getRangeAt(0).startContainer,
|
|
829
|
-
if (r && e.contains(r))
|
|
830
|
-
return r;
|
|
809
|
+
const n = t.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(H);
|
|
810
|
+
if (r && e.contains(r)) return r;
|
|
831
811
|
}
|
|
832
|
-
const
|
|
812
|
+
const i = document.activeElement?.closest(H);
|
|
833
813
|
return i && e.contains(i) ? i : null;
|
|
834
814
|
}
|
|
835
815
|
function Ee(e, t) {
|
|
836
816
|
let o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
|
|
837
817
|
o || (o = document.createElement("div"), o.className = "rte-conditional-else-label", o.setAttribute("contenteditable", "false"), o.innerHTML = `
|
|
838
|
-
<span class="rte-conditional-chip rte-conditional-chip-else">${
|
|
818
|
+
<span class="rte-conditional-chip rte-conditional-chip-else">${y(t.blockElseLabel)}</span>
|
|
839
819
|
<span class="rte-conditional-summary">Else branch</span>
|
|
840
820
|
`, 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));
|
|
841
821
|
}
|
|
842
|
-
function
|
|
822
|
+
function Ze(e, t) {
|
|
843
823
|
e.setAttribute("data-has-else", t ? "true" : "false");
|
|
844
824
|
const o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
|
|
845
825
|
o && o.classList.toggle("rte-conditional-hidden", !t), i && i.classList.toggle("rte-conditional-hidden", !t);
|
|
846
826
|
}
|
|
847
|
-
function
|
|
827
|
+
function Ge(e, t) {
|
|
848
828
|
Array.from(e.querySelectorAll(".rte-conditional-body")).forEach((i) => {
|
|
849
829
|
i.setAttribute("contenteditable", t ? "true" : "false");
|
|
850
830
|
}), e.setAttribute("contenteditable", "false");
|
|
851
831
|
}
|
|
852
832
|
function ve(e, t) {
|
|
853
|
-
const o = e.getAttribute("data-condition") || "", i =
|
|
833
|
+
const o = e.getAttribute("data-condition") || "", i = O(e.getAttribute("data-audience")), n = O(e.getAttribute("data-locale"));
|
|
854
834
|
let a = e.querySelector(".rte-conditional-header");
|
|
855
835
|
a || (a = document.createElement("div"), a.className = "rte-conditional-header", e.prepend(a)), a.setAttribute("contenteditable", "false"), a.setAttribute("tabindex", "0"), a.setAttribute("role", "button"), a.setAttribute("aria-label", "Edit conditional rule");
|
|
856
836
|
const r = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
|
|
857
837
|
if (a.innerHTML = `
|
|
858
|
-
<span class="rte-conditional-chip">${
|
|
859
|
-
<span class="rte-conditional-summary">${
|
|
860
|
-
<span class="rte-conditional-meta">${
|
|
838
|
+
<span class="rte-conditional-chip">${y(t.blockIfLabel)}</span>
|
|
839
|
+
<span class="rte-conditional-summary">${y(r)}</span>
|
|
840
|
+
<span class="rte-conditional-meta">${y(l)} · ${y(d)}</span>
|
|
861
841
|
`, !e.querySelector('.rte-conditional-body[data-slot="if"]')) {
|
|
862
|
-
const
|
|
863
|
-
|
|
842
|
+
const v = document.createElement("div");
|
|
843
|
+
v.className = "rte-conditional-body", v.setAttribute("data-slot", "if"), v.innerHTML = "<p><br></p>", e.insertBefore(v, e.children[1] || null);
|
|
864
844
|
}
|
|
865
|
-
const
|
|
866
|
-
|
|
845
|
+
const m = e.getAttribute("data-has-else") === "true";
|
|
846
|
+
m && Ee(e, t), We(e), Ze(e, m);
|
|
867
847
|
}
|
|
868
|
-
function
|
|
848
|
+
function Me(e, t) {
|
|
869
849
|
const o = document.createElement("section");
|
|
870
850
|
o.className = "rte-conditional-block", o.setAttribute("data-conditional-content", "true"), o.setAttribute("data-condition", (e.condition || "").trim()), o.setAttribute("data-audience", te(e.audience).join(",")), o.setAttribute("data-locale", te(e.locale).join(",")), o.setAttribute("data-has-else", e.hasElse ? "true" : "false"), o.setAttribute("role", "group"), o.setAttribute("aria-label", "Conditional content block"), o.setAttribute("contenteditable", "false"), o.setAttribute("spellcheck", "false");
|
|
871
851
|
const i = document.createElement("div");
|
|
@@ -873,61 +853,52 @@ function Ne(e, t) {
|
|
|
873
853
|
const n = document.createElement("div");
|
|
874
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 && Ee(o, t), ve(o, t), oe(o, !1), o;
|
|
875
855
|
}
|
|
876
|
-
function
|
|
856
|
+
function Ue(e, t) {
|
|
877
857
|
if (t)
|
|
878
858
|
try {
|
|
879
|
-
if (!e.isConnected)
|
|
880
|
-
return;
|
|
859
|
+
if (!e.isConnected) return;
|
|
881
860
|
const o = e.contains(t.startContainer), i = e.contains(t.endContainer);
|
|
882
|
-
if (!o || !i)
|
|
883
|
-
return;
|
|
861
|
+
if (!o || !i) return;
|
|
884
862
|
xe(e, t);
|
|
885
863
|
} catch {
|
|
886
864
|
}
|
|
887
865
|
}
|
|
888
|
-
function
|
|
866
|
+
function Ye(e) {
|
|
889
867
|
return (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !0 : e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol") !== null;
|
|
890
868
|
}
|
|
891
|
-
function
|
|
869
|
+
function Ne(e, t, o) {
|
|
892
870
|
let i = null;
|
|
893
|
-
|
|
894
|
-
try {
|
|
895
|
-
const r = o.cloneRange();
|
|
896
|
-
e.contains(r.commonAncestorContainer) && (i = r);
|
|
897
|
-
} catch {
|
|
898
|
-
i = null;
|
|
899
|
-
}
|
|
900
|
-
i || (i = Se(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
|
|
871
|
+
i || (i = ke(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
|
|
901
872
|
let n = null;
|
|
902
873
|
i.collapsed || (n = i.extractContents()), i.insertNode(t);
|
|
903
874
|
const a = t.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
904
|
-
a && n &&
|
|
875
|
+
a && n && Ye(n) && (a.innerHTML = "", a.appendChild(n)), a ? pe(e, a) : pe(e, t), e.normalize();
|
|
905
876
|
}
|
|
906
|
-
function
|
|
877
|
+
function Je(e) {
|
|
907
878
|
return {
|
|
908
879
|
condition: e.getAttribute("data-condition") || "",
|
|
909
|
-
audience:
|
|
910
|
-
locale:
|
|
880
|
+
audience: O(e.getAttribute("data-audience")),
|
|
881
|
+
locale: O(e.getAttribute("data-locale")),
|
|
911
882
|
hasElse: e.getAttribute("data-has-else") === "true"
|
|
912
883
|
};
|
|
913
884
|
}
|
|
914
|
-
function
|
|
885
|
+
function Xe(e, t, o) {
|
|
915
886
|
e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", te(t.audience).join(",")), e.setAttribute("data-locale", te(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && Ee(e, o), ve(e, o), oe(e, e.classList.contains("rte-conditional-preview"));
|
|
916
887
|
}
|
|
917
888
|
function ne(e, t) {
|
|
918
889
|
he(e, e);
|
|
919
|
-
const o = Array.from(e.querySelectorAll(
|
|
890
|
+
const o = Array.from(e.querySelectorAll(H)), i = w.get(e) === !0;
|
|
920
891
|
return o.forEach((n) => {
|
|
921
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"), ve(n, t), oe(n, i);
|
|
922
893
|
}), o;
|
|
923
894
|
}
|
|
924
|
-
async function
|
|
895
|
+
async function Qe(e, t) {
|
|
925
896
|
const o = $e.get(e);
|
|
926
897
|
if (o)
|
|
927
898
|
return o;
|
|
928
899
|
if (typeof t.getContext == "function")
|
|
929
900
|
try {
|
|
930
|
-
const i =
|
|
901
|
+
const i = ce(e), n = await Promise.resolve(t.getContext({ editor: e, editorRoot: i }));
|
|
931
902
|
if (n && typeof n == "object")
|
|
932
903
|
return n;
|
|
933
904
|
} catch {
|
|
@@ -946,51 +917,49 @@ async function et(e, t) {
|
|
|
946
917
|
function be(e) {
|
|
947
918
|
return Array.isArray(e) ? e.map((t) => t.trim().toLowerCase()).filter(Boolean) : typeof e == "string" ? e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : [];
|
|
948
919
|
}
|
|
949
|
-
function
|
|
920
|
+
function Ae(e, t) {
|
|
950
921
|
return e.length === 0 || e.includes("all") ? !0 : t.length === 0 ? !1 : e.some((o) => t.includes(o));
|
|
951
922
|
}
|
|
952
923
|
async function Z(e, t, o) {
|
|
953
|
-
var M, le;
|
|
954
924
|
const i = t.labels, n = ne(e, i);
|
|
955
|
-
if (
|
|
956
|
-
n.forEach((
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
|
|
925
|
+
if (w.set(e, o), De(e, o), ce(e).classList.toggle("rte-conditional-preview-on", o), !o) {
|
|
926
|
+
n.forEach(($) => {
|
|
927
|
+
$.classList.remove("rte-conditional-preview"), oe($, !1);
|
|
928
|
+
const P = $.querySelector('.rte-conditional-body[data-slot="if"]'), T = $.querySelector('.rte-conditional-body[data-slot="else"]'), F = $.querySelector(".rte-conditional-else-label"), B = $.getAttribute("data-has-else") === "true";
|
|
929
|
+
P && (P.classList.remove("rte-conditional-hidden"), P.removeAttribute("aria-hidden")), T && (T.classList.toggle("rte-conditional-hidden", !B), T.setAttribute("aria-hidden", B ? "false" : "true")), F && F.classList.toggle("rte-conditional-hidden", !B);
|
|
960
930
|
});
|
|
961
931
|
return;
|
|
962
932
|
}
|
|
963
|
-
const r = await
|
|
964
|
-
r.audience ??
|
|
965
|
-
),
|
|
966
|
-
r.locale ??
|
|
967
|
-
),
|
|
968
|
-
n.forEach((
|
|
969
|
-
const
|
|
970
|
-
if (
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
}
|
|
974
|
-
if (
|
|
975
|
-
const
|
|
976
|
-
|
|
933
|
+
const r = await Qe(e, t), l = be(t.currentAudience), d = be(t.currentLocale), E = be(
|
|
934
|
+
r.audience ?? r.user?.audience
|
|
935
|
+
), m = be(
|
|
936
|
+
r.locale ?? r.user?.locale
|
|
937
|
+
), v = l.length > 0 ? l : E, S = d.length > 0 ? d : m;
|
|
938
|
+
n.forEach(($) => {
|
|
939
|
+
const P = $.getAttribute("data-condition") || "", T = O($.getAttribute("data-audience")).map((s) => s.toLowerCase()), F = O($.getAttribute("data-locale")).map((s) => s.toLowerCase()), B = $.getAttribute("data-has-else") === "true", ge = t.evaluateCondition(P, r), M = Ae(T, v), de = Ae(F, S), R = ge && M && de, ie = $.querySelector('.rte-conditional-body[data-slot="if"]'), j = $.querySelector('.rte-conditional-body[data-slot="else"]'), ae = $.querySelector(".rte-conditional-else-label");
|
|
940
|
+
if ($.classList.add("rte-conditional-preview"), oe($, !0), ie && (ie.classList.toggle("rte-conditional-hidden", !R), ie.setAttribute("aria-hidden", R ? "false" : "true")), j) {
|
|
941
|
+
const s = B && !R;
|
|
942
|
+
j.classList.toggle("rte-conditional-hidden", !s), j.setAttribute("aria-hidden", s ? "false" : "true");
|
|
943
|
+
}
|
|
944
|
+
if (ae) {
|
|
945
|
+
const s = B && !R;
|
|
946
|
+
ae.classList.toggle("rte-conditional-hidden", !s);
|
|
977
947
|
}
|
|
978
948
|
});
|
|
979
949
|
}
|
|
980
|
-
function
|
|
981
|
-
const o =
|
|
950
|
+
function De(e, t) {
|
|
951
|
+
const o = ce(e);
|
|
982
952
|
Array.from(
|
|
983
953
|
o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
|
|
984
954
|
).forEach((n) => {
|
|
985
955
|
n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
|
|
986
956
|
});
|
|
987
957
|
}
|
|
988
|
-
function
|
|
989
|
-
const t =
|
|
990
|
-
if (t && t.isConnected)
|
|
991
|
-
return t;
|
|
958
|
+
function et(e) {
|
|
959
|
+
const t = _.get(e);
|
|
960
|
+
if (t && t.isConnected) return t;
|
|
992
961
|
const o = document.createElement("div");
|
|
993
|
-
return o.className =
|
|
962
|
+
return o.className = u, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
|
|
994
963
|
<button type="button" class="rte-conditional-float-btn" data-action="edit" title="Edit Condition" aria-label="Edit Condition">
|
|
995
964
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 17.3V20h2.7l9.7-9.7-2.7-2.7L4 17.3Zm14.7-9.4a1 1 0 0 0 0-1.4l-1.2-1.2a1 1 0 0 0-1.4 0l-1.1 1.1 2.7 2.7 1-1.2Z" fill="currentColor"></path></svg>
|
|
996
965
|
</button>
|
|
@@ -1000,28 +969,25 @@ function tt(e) {
|
|
|
1000
969
|
`, o.addEventListener("mousedown", (i) => {
|
|
1001
970
|
i.preventDefault();
|
|
1002
971
|
}), o.addEventListener("click", (i) => {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
if (!a)
|
|
1006
|
-
return;
|
|
972
|
+
const a = i.target?.closest("[data-action]")?.getAttribute("data-action");
|
|
973
|
+
if (!a) return;
|
|
1007
974
|
const r = x.get(e) || ee;
|
|
1008
|
-
if (!r)
|
|
1009
|
-
|
|
1010
|
-
const l = I.get(e);
|
|
975
|
+
if (!r) return;
|
|
976
|
+
const l = z.get(e);
|
|
1011
977
|
if (!(!l || !e.contains(l))) {
|
|
1012
978
|
if (a === "edit") {
|
|
1013
|
-
|
|
979
|
+
C(e, r, "edit", void 0, l);
|
|
1014
980
|
return;
|
|
1015
981
|
}
|
|
1016
|
-
a === "delete" && (
|
|
982
|
+
a === "delete" && (Oe(e, l), z.set(e, null), I(e));
|
|
1017
983
|
}
|
|
1018
|
-
}), document.body.appendChild(o),
|
|
984
|
+
}), document.body.appendChild(o), _.set(e, o), o;
|
|
1019
985
|
}
|
|
1020
|
-
function
|
|
1021
|
-
const t =
|
|
986
|
+
function I(e) {
|
|
987
|
+
const t = _.get(e);
|
|
1022
988
|
t && t.classList.remove("show");
|
|
1023
989
|
}
|
|
1024
|
-
function
|
|
990
|
+
function He(e, t) {
|
|
1025
991
|
const o = t.getBoundingClientRect();
|
|
1026
992
|
e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
|
|
1027
993
|
const i = e.getBoundingClientRect(), n = 8, a = window.innerWidth, r = window.innerHeight;
|
|
@@ -1031,231 +997,215 @@ function Oe(e, t) {
|
|
|
1031
997
|
d = Math.max(n, Math.min(d, a - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
|
|
1032
998
|
}
|
|
1033
999
|
function me(e, t) {
|
|
1034
|
-
const o =
|
|
1035
|
-
he(o, e),
|
|
1000
|
+
const o = et(e);
|
|
1001
|
+
he(o, e), z.set(e, t), He(o, t);
|
|
1036
1002
|
}
|
|
1037
|
-
function
|
|
1003
|
+
function D(e) {
|
|
1038
1004
|
const t = x.get(e) || ee;
|
|
1039
|
-
if (!t)
|
|
1040
|
-
return;
|
|
1005
|
+
if (!t) return;
|
|
1041
1006
|
const o = W(e);
|
|
1042
|
-
if (!o || !e.contains(o) ||
|
|
1043
|
-
|
|
1007
|
+
if (!o || !e.contains(o) || k(e)) {
|
|
1008
|
+
z.set(e, null), I(e);
|
|
1044
1009
|
return;
|
|
1045
1010
|
}
|
|
1046
1011
|
ne(e, t.labels), me(e, o);
|
|
1047
1012
|
}
|
|
1048
|
-
function
|
|
1049
|
-
|
|
1013
|
+
function tt() {
|
|
1014
|
+
_.forEach((e, t) => {
|
|
1050
1015
|
if (!t.isConnected || !e.isConnected) {
|
|
1051
|
-
e.remove(),
|
|
1016
|
+
e.remove(), _.delete(t), z.delete(t);
|
|
1052
1017
|
return;
|
|
1053
1018
|
}
|
|
1054
|
-
if (!e.classList.contains("show"))
|
|
1055
|
-
return;
|
|
1019
|
+
if (!e.classList.contains("show")) return;
|
|
1056
1020
|
he(e, t);
|
|
1057
|
-
const o =
|
|
1021
|
+
const o = z.get(t);
|
|
1058
1022
|
if (!o || !t.contains(o)) {
|
|
1059
|
-
|
|
1023
|
+
I(t);
|
|
1060
1024
|
return;
|
|
1061
1025
|
}
|
|
1062
|
-
|
|
1026
|
+
He(e, o);
|
|
1063
1027
|
});
|
|
1064
1028
|
}
|
|
1065
|
-
function
|
|
1066
|
-
if (!e.contains(t))
|
|
1067
|
-
return !1;
|
|
1029
|
+
function Oe(e, t) {
|
|
1030
|
+
if (!e.contains(t)) return !1;
|
|
1068
1031
|
const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
|
|
1069
1032
|
t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
|
|
1070
1033
|
const a = document.createRange();
|
|
1071
|
-
return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), xe(e, a),
|
|
1034
|
+
return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), xe(e, a), Se(e), Te(e, o), !0;
|
|
1072
1035
|
}
|
|
1073
|
-
function
|
|
1036
|
+
function we(e, t, o) {
|
|
1074
1037
|
const i = e.cloneRange(), n = document.createRange();
|
|
1075
1038
|
return n.selectNodeContents(t), n.collapse(o === "start"), i.startContainer === n.startContainer && i.startOffset === n.startOffset && i.endContainer === n.endContainer && i.endOffset === n.endOffset;
|
|
1076
1039
|
}
|
|
1077
|
-
function
|
|
1078
|
-
|
|
1079
|
-
const a = t.labels, r = o === "insert" ?
|
|
1040
|
+
function C(e, t, o, i, n) {
|
|
1041
|
+
Be();
|
|
1042
|
+
const a = t.labels, r = o === "insert" ? ke(e) : null, l = document.createElement("div");
|
|
1080
1043
|
l.className = c, he(l, e);
|
|
1081
1044
|
const d = document.createElement("section");
|
|
1082
1045
|
d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
|
|
1083
|
-
const E = n ?
|
|
1046
|
+
const E = n ? Je(n) : void 0, m = i || E || {}, v = m.condition ?? t.defaultCondition, S = m.audience ?? t.defaultAudience, $ = m.locale ?? t.defaultLocale, P = m.hasElse ?? t.enableElseByDefault;
|
|
1084
1047
|
d.innerHTML = `
|
|
1085
1048
|
<header class="rte-conditional-dialog-header">
|
|
1086
|
-
<h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${
|
|
1049
|
+
<h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${y(
|
|
1087
1050
|
o === "edit" ? a.dialogTitleEdit : a.dialogTitleInsert
|
|
1088
1051
|
)}</h2>
|
|
1089
|
-
<button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${
|
|
1052
|
+
<button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${y(a.cancelText)}">✕</button>
|
|
1090
1053
|
</header>
|
|
1091
1054
|
<div class="rte-conditional-dialog-body">
|
|
1092
1055
|
<div class="rte-conditional-field">
|
|
1093
|
-
<label for="rte-conditional-condition">${
|
|
1094
|
-
<input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${
|
|
1095
|
-
|
|
1096
|
-
)}" placeholder="${
|
|
1056
|
+
<label for="rte-conditional-condition">${y(a.conditionLabel)}</label>
|
|
1057
|
+
<input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${y(
|
|
1058
|
+
v || ""
|
|
1059
|
+
)}" placeholder="${y(a.conditionPlaceholder)}" />
|
|
1097
1060
|
</div>
|
|
1098
1061
|
<div class="rte-conditional-field">
|
|
1099
|
-
<label for="rte-conditional-audience">${
|
|
1100
|
-
<input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${
|
|
1101
|
-
|
|
1102
|
-
)}" placeholder="${
|
|
1062
|
+
<label for="rte-conditional-audience">${y(a.audienceLabel)}</label>
|
|
1063
|
+
<input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${y(
|
|
1064
|
+
Le(S)
|
|
1065
|
+
)}" placeholder="${y(a.audiencePlaceholder)}" />
|
|
1103
1066
|
</div>
|
|
1104
1067
|
<div class="rte-conditional-field">
|
|
1105
|
-
<label for="rte-conditional-locale">${
|
|
1106
|
-
<input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${
|
|
1107
|
-
|
|
1108
|
-
)}" placeholder="${
|
|
1068
|
+
<label for="rte-conditional-locale">${y(a.localeLabel)}</label>
|
|
1069
|
+
<input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${y(
|
|
1070
|
+
Le($)
|
|
1071
|
+
)}" placeholder="${y(a.localePlaceholder)}" />
|
|
1109
1072
|
</div>
|
|
1110
1073
|
<label class="rte-conditional-checkbox">
|
|
1111
|
-
<input class="rte-conditional-input-else" type="checkbox" ${
|
|
1112
|
-
<span>${
|
|
1074
|
+
<input class="rte-conditional-input-else" type="checkbox" ${P ? "checked" : ""} />
|
|
1075
|
+
<span>${y(a.elseLabel)}</span>
|
|
1113
1076
|
</label>
|
|
1114
1077
|
<p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
|
|
1115
1078
|
</div>
|
|
1116
1079
|
<footer class="rte-conditional-dialog-footer">
|
|
1117
|
-
<button type="button" class="rte-conditional-btn" data-action="cancel">${
|
|
1118
|
-
<button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${
|
|
1080
|
+
<button type="button" class="rte-conditional-btn" data-action="cancel">${y(a.cancelText)}</button>
|
|
1081
|
+
<button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${y(a.saveText)}</button>
|
|
1119
1082
|
</footer>
|
|
1120
1083
|
`, l.appendChild(d), document.body.appendChild(l);
|
|
1121
|
-
const
|
|
1122
|
-
l.removeEventListener("click",
|
|
1123
|
-
},
|
|
1124
|
-
|
|
1125
|
-
},
|
|
1126
|
-
|
|
1127
|
-
},
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1130
|
-
const k = Array.from(
|
|
1084
|
+
const T = d.querySelector(".rte-conditional-input-condition"), F = d.querySelector(".rte-conditional-input-audience"), B = d.querySelector(".rte-conditional-input-locale"), ge = d.querySelector(".rte-conditional-input-else"), M = () => {
|
|
1085
|
+
l.removeEventListener("click", R), l.removeEventListener("keydown", ae, !0), document.removeEventListener("keydown", de, !0), l.parentNode && l.parentNode.removeChild(l), le = null, e.focus({ preventScroll: !0 }), D(e);
|
|
1086
|
+
}, de = (s) => {
|
|
1087
|
+
s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), M());
|
|
1088
|
+
}, R = (s) => {
|
|
1089
|
+
s.target === l && M();
|
|
1090
|
+
}, ie = (s) => {
|
|
1091
|
+
if (s.key !== "Tab") return;
|
|
1092
|
+
const q = Array.from(
|
|
1131
1093
|
d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
|
|
1132
1094
|
);
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
u.preventDefault(), ie.focus();
|
|
1095
|
+
if (q.length === 0) return;
|
|
1096
|
+
const V = q[0], K = q[q.length - 1], re = document.activeElement;
|
|
1097
|
+
if (s.shiftKey && re === V) {
|
|
1098
|
+
s.preventDefault(), K.focus();
|
|
1138
1099
|
return;
|
|
1139
1100
|
}
|
|
1140
|
-
!
|
|
1141
|
-
},
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
}, k = e.innerHTML;
|
|
1101
|
+
!s.shiftKey && re === K && (s.preventDefault(), V.focus());
|
|
1102
|
+
}, j = async () => {
|
|
1103
|
+
const s = {
|
|
1104
|
+
condition: T?.value?.trim() || "",
|
|
1105
|
+
audience: O(F?.value),
|
|
1106
|
+
locale: O(B?.value),
|
|
1107
|
+
hasElse: ge?.checked || !1
|
|
1108
|
+
}, q = e.innerHTML;
|
|
1149
1109
|
if (n)
|
|
1150
|
-
|
|
1110
|
+
Xe(n, s, a), oe(n, w.get(e) === !0);
|
|
1151
1111
|
else {
|
|
1152
|
-
|
|
1153
|
-
const
|
|
1112
|
+
Ue(e, r);
|
|
1113
|
+
const K = Me(s, a);
|
|
1154
1114
|
try {
|
|
1155
|
-
|
|
1115
|
+
Ne(e, K);
|
|
1156
1116
|
} catch {
|
|
1157
|
-
e.appendChild(
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1117
|
+
e.appendChild(K);
|
|
1118
|
+
const re = K.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
1119
|
+
re ? pe(e, re) : pe(e, K);
|
|
1160
1120
|
}
|
|
1161
1121
|
}
|
|
1162
|
-
|
|
1163
|
-
},
|
|
1164
|
-
if (
|
|
1165
|
-
|
|
1122
|
+
w.get(e) === !0 && await Z(e, t, !0), Se(e), Te(e, q), D(e), M();
|
|
1123
|
+
}, ae = (s) => {
|
|
1124
|
+
if (s.key === "Escape") {
|
|
1125
|
+
s.preventDefault(), M();
|
|
1166
1126
|
return;
|
|
1167
1127
|
}
|
|
1168
|
-
|
|
1128
|
+
ie(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), j());
|
|
1169
1129
|
};
|
|
1170
|
-
d.addEventListener("click", (
|
|
1171
|
-
const
|
|
1172
|
-
if (
|
|
1173
|
-
|
|
1130
|
+
d.addEventListener("click", (s) => {
|
|
1131
|
+
const V = s.target.getAttribute("data-action");
|
|
1132
|
+
if (V === "cancel") {
|
|
1133
|
+
M();
|
|
1174
1134
|
return;
|
|
1175
1135
|
}
|
|
1176
|
-
|
|
1177
|
-
}), l.addEventListener("click",
|
|
1136
|
+
V === "save" && j();
|
|
1137
|
+
}), l.addEventListener("click", R), l.addEventListener("keydown", ae, !0), document.addEventListener("keydown", de, !0), le = { cleanup: M }, T?.focus();
|
|
1178
1138
|
}
|
|
1179
|
-
function
|
|
1139
|
+
function ot(e) {
|
|
1180
1140
|
const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", a = t && e.altKey && e.shiftKey && (i === "c" || n === "keyc"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f9" || n === "f9");
|
|
1181
1141
|
return a || r;
|
|
1182
1142
|
}
|
|
1183
|
-
function
|
|
1143
|
+
function nt(e) {
|
|
1184
1144
|
const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", a = t && e.altKey && e.shiftKey && (i === "p" || n === "keyp"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f10" || n === "f10");
|
|
1185
1145
|
return a || r;
|
|
1186
1146
|
}
|
|
1187
|
-
function
|
|
1147
|
+
function it(e) {
|
|
1188
1148
|
ee = e, U || (U = (t) => {
|
|
1189
|
-
const
|
|
1190
|
-
if (!i)
|
|
1191
|
-
|
|
1192
|
-
y = i, x.has(i) || x.set(i, e);
|
|
1149
|
+
const i = t.target?.closest(L);
|
|
1150
|
+
if (!i) return;
|
|
1151
|
+
g = i, x.has(i) || x.set(i, e);
|
|
1193
1152
|
const n = x.get(i) || e;
|
|
1194
|
-
ne(i, n.labels),
|
|
1153
|
+
ne(i, n.labels), De(i, w.get(i) === !0), D(i);
|
|
1195
1154
|
}, document.addEventListener("focusin", U, !0)), G || (G = (t) => {
|
|
1196
|
-
|
|
1197
|
-
if (document.querySelector(`.${c}`))
|
|
1198
|
-
return;
|
|
1155
|
+
if (document.querySelector(`.${c}`)) return;
|
|
1199
1156
|
const i = t.target;
|
|
1200
|
-
if (!!
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
return;
|
|
1205
|
-
const l = x.get(r) || ee || e, d = document.activeElement, E = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
|
|
1157
|
+
if (!!i?.closest("input, textarea, select")) return;
|
|
1158
|
+
const r = i?.closest(L) || A(void 0, !1) || g;
|
|
1159
|
+
if (!r || k(r)) return;
|
|
1160
|
+
const l = x.get(r) || ee || e, d = document.activeElement, E = i?.closest(".rte-conditional-header") || d?.closest(".rte-conditional-header");
|
|
1206
1161
|
if (E && (t.key === "Enter" || t.key === " ")) {
|
|
1207
|
-
const
|
|
1208
|
-
if (
|
|
1209
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1162
|
+
const m = E.closest(H);
|
|
1163
|
+
if (m && r.contains(m)) {
|
|
1164
|
+
t.preventDefault(), t.stopPropagation(), C(r, l, "edit", void 0, m);
|
|
1210
1165
|
return;
|
|
1211
1166
|
}
|
|
1212
1167
|
}
|
|
1213
|
-
if (
|
|
1168
|
+
if (ot(t)) {
|
|
1214
1169
|
t.preventDefault(), t.stopPropagation();
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1170
|
+
const m = W(r);
|
|
1171
|
+
m ? C(r, l, "edit", void 0, m) : C(r, l, "insert");
|
|
1217
1172
|
return;
|
|
1218
1173
|
}
|
|
1219
|
-
if (
|
|
1174
|
+
if (nt(t)) {
|
|
1220
1175
|
t.preventDefault(), t.stopPropagation();
|
|
1221
|
-
const
|
|
1222
|
-
Z(r, l,
|
|
1176
|
+
const m = w.get(r) !== !0;
|
|
1177
|
+
Z(r, l, m), D(r);
|
|
1223
1178
|
return;
|
|
1224
1179
|
}
|
|
1225
1180
|
if ((t.key === "Backspace" || t.key === "Delete") && !t.altKey && !t.ctrlKey && !t.metaKey) {
|
|
1226
|
-
const
|
|
1227
|
-
if (!
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
if (!M || !r.contains(M))
|
|
1234
|
-
return;
|
|
1235
|
-
if (t.key === "Backspace" && ke(B, M, "start")) {
|
|
1181
|
+
const m = window.getSelection();
|
|
1182
|
+
if (!m || m.rangeCount === 0) return;
|
|
1183
|
+
const v = m.getRangeAt(0);
|
|
1184
|
+
if (!v.collapsed || !r.contains(v.commonAncestorContainer)) return;
|
|
1185
|
+
const S = Ve(v.startContainer)?.closest(".rte-conditional-body");
|
|
1186
|
+
if (!S || !r.contains(S)) return;
|
|
1187
|
+
if (t.key === "Backspace" && we(v, S, "start")) {
|
|
1236
1188
|
t.preventDefault();
|
|
1237
1189
|
return;
|
|
1238
1190
|
}
|
|
1239
|
-
if (t.key === "Delete" &&
|
|
1191
|
+
if (t.key === "Delete" && we(v, S, "end")) {
|
|
1240
1192
|
t.preventDefault();
|
|
1241
1193
|
return;
|
|
1242
1194
|
}
|
|
1243
1195
|
}
|
|
1244
1196
|
}, document.addEventListener("keydown", G, !0)), J || (J = (t) => {
|
|
1245
1197
|
const o = t.target;
|
|
1246
|
-
if (!o || o.closest(`.${
|
|
1247
|
-
|
|
1248
|
-
const i = o.closest(w);
|
|
1198
|
+
if (!o || o.closest(`.${u}`)) return;
|
|
1199
|
+
const i = o.closest(L);
|
|
1249
1200
|
if (!i) {
|
|
1250
|
-
|
|
1201
|
+
g && I(g);
|
|
1251
1202
|
return;
|
|
1252
1203
|
}
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
const n = o.closest(q);
|
|
1204
|
+
if (k(i)) return;
|
|
1205
|
+
g = i, x.has(i) || x.set(i, e);
|
|
1206
|
+
const n = o.closest(H);
|
|
1257
1207
|
if (!n) {
|
|
1258
|
-
|
|
1208
|
+
I(i);
|
|
1259
1209
|
return;
|
|
1260
1210
|
}
|
|
1261
1211
|
requestAnimationFrame(() => {
|
|
@@ -1263,43 +1213,40 @@ function at(e) {
|
|
|
1263
1213
|
});
|
|
1264
1214
|
}, document.addEventListener("mousedown", J, !0)), Y || (Y = (t) => {
|
|
1265
1215
|
const o = t.target;
|
|
1266
|
-
if (!o || o.closest(`.${
|
|
1267
|
-
|
|
1268
|
-
const i = o.closest(w);
|
|
1216
|
+
if (!o || o.closest(`.${u}`)) return;
|
|
1217
|
+
const i = o.closest(L);
|
|
1269
1218
|
if (!i) {
|
|
1270
|
-
|
|
1219
|
+
g && I(g);
|
|
1271
1220
|
return;
|
|
1272
1221
|
}
|
|
1273
|
-
if (
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
const n = x.get(i) || e, a = o.closest(q), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
|
|
1222
|
+
if (k(i)) return;
|
|
1223
|
+
g = i, x.has(i) || x.set(i, e);
|
|
1224
|
+
const n = x.get(i) || e, a = o.closest(H), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
|
|
1277
1225
|
if (a && r) {
|
|
1278
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1226
|
+
t.preventDefault(), t.stopPropagation(), C(i, n, "edit", void 0, a), me(i, a);
|
|
1279
1227
|
return;
|
|
1280
1228
|
}
|
|
1281
|
-
a ? me(i, a) :
|
|
1229
|
+
a ? me(i, a) : I(i);
|
|
1282
1230
|
}, document.addEventListener("click", Y, !0)), X || (X = () => {
|
|
1283
|
-
const t =
|
|
1284
|
-
t && t.isConnected &&
|
|
1231
|
+
const t = A(void 0, !1) || g;
|
|
1232
|
+
t && t.isConnected && D(t);
|
|
1285
1233
|
}, document.addEventListener("selectionchange", X)), Q || (Q = (t) => {
|
|
1286
|
-
const
|
|
1287
|
-
if (!i)
|
|
1288
|
-
return;
|
|
1234
|
+
const i = t.target?.closest(L);
|
|
1235
|
+
if (!i) return;
|
|
1289
1236
|
const n = x.get(i) || ee || e;
|
|
1290
|
-
ne(i, n.labels),
|
|
1291
|
-
}, document.addEventListener("input", Q, !0)),
|
|
1292
|
-
|
|
1293
|
-
}, window.addEventListener("scroll",
|
|
1237
|
+
ne(i, n.labels), D(i);
|
|
1238
|
+
}, document.addEventListener("input", Q, !0)), N || (N = () => {
|
|
1239
|
+
tt();
|
|
1240
|
+
}, window.addEventListener("scroll", N, !0), window.addEventListener("resize", N));
|
|
1294
1241
|
}
|
|
1295
|
-
function
|
|
1296
|
-
U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), Y && (document.removeEventListener("click", Y, !0), Y = null), J && (document.removeEventListener("mousedown", J, !0), J = null), X && (document.removeEventListener("selectionchange", X), X = null), Q && (document.removeEventListener("input", Q, !0), Q = null),
|
|
1242
|
+
function at() {
|
|
1243
|
+
U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), Y && (document.removeEventListener("click", Y, !0), Y = null), J && (document.removeEventListener("mousedown", J, !0), J = null), X && (document.removeEventListener("selectionchange", X), X = null), Q && (document.removeEventListener("input", Q, !0), Q = null), N && (window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N), N = null), _.forEach((e) => {
|
|
1297
1244
|
e.remove();
|
|
1298
|
-
}),
|
|
1245
|
+
}), _.clear(), z.clear(), ee = null, g = null;
|
|
1299
1246
|
}
|
|
1300
|
-
const
|
|
1301
|
-
const t =
|
|
1302
|
-
return
|
|
1247
|
+
const rt = (e = {}) => {
|
|
1248
|
+
const t = je(e);
|
|
1249
|
+
return Fe(), {
|
|
1303
1250
|
name: "conditionalContent",
|
|
1304
1251
|
toolbar: [
|
|
1305
1252
|
{
|
|
@@ -1327,77 +1274,69 @@ const lt = (e = {}) => {
|
|
|
1327
1274
|
],
|
|
1328
1275
|
commands: {
|
|
1329
1276
|
conditionalContent: (o, i) => {
|
|
1330
|
-
const n =
|
|
1331
|
-
if (!n ||
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
const a = o == null ? void 0 : o.target;
|
|
1277
|
+
const n = A(i);
|
|
1278
|
+
if (!n || k(n)) return !1;
|
|
1279
|
+
g = n, x.set(n, t), ne(n, t.labels);
|
|
1280
|
+
const a = o?.target;
|
|
1335
1281
|
if (a === "insert")
|
|
1336
|
-
return
|
|
1282
|
+
return C(n, t, "insert", o), !0;
|
|
1337
1283
|
const r = W(n);
|
|
1338
|
-
return a === "edit" || r ? !r && a === "edit" ? !1 : (
|
|
1284
|
+
return a === "edit" || r ? !r && a === "edit" ? !1 : (C(n, t, "edit", o, r || void 0), !0) : (C(n, t, "insert", o), !0);
|
|
1339
1285
|
},
|
|
1340
1286
|
openConditionalDialog: (o, i) => {
|
|
1341
|
-
const n =
|
|
1342
|
-
if (!n ||
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
const a = o == null ? void 0 : o.target;
|
|
1287
|
+
const n = A(i);
|
|
1288
|
+
if (!n || k(n)) return !1;
|
|
1289
|
+
g = n, x.set(n, t), ne(n, t.labels);
|
|
1290
|
+
const a = o?.target;
|
|
1346
1291
|
if (a === "insert")
|
|
1347
|
-
return
|
|
1292
|
+
return C(n, t, "insert", o), !0;
|
|
1348
1293
|
const r = W(n);
|
|
1349
|
-
return a === "edit" || r ? !r && a === "edit" ? !1 : (
|
|
1294
|
+
return a === "edit" || r ? !r && a === "edit" ? !1 : (C(n, t, "edit", o, r || void 0), !0) : (C(n, t, "insert", o), !0);
|
|
1350
1295
|
},
|
|
1351
1296
|
conditionalPreview: async (o, i) => {
|
|
1352
|
-
const n =
|
|
1353
|
-
if (!n)
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
return await Z(n, t, a), R(n), !0;
|
|
1297
|
+
const n = A(i);
|
|
1298
|
+
if (!n) return !1;
|
|
1299
|
+
g = n, x.set(n, t);
|
|
1300
|
+
const a = typeof o == "boolean" ? o : w.get(n) !== !0;
|
|
1301
|
+
return await Z(n, t, a), D(n), !0;
|
|
1358
1302
|
},
|
|
1359
1303
|
editConditionalBlock: (o, i) => {
|
|
1360
|
-
const n =
|
|
1361
|
-
if (!n ||
|
|
1362
|
-
|
|
1363
|
-
y = n, x.set(n, t);
|
|
1304
|
+
const n = A(i);
|
|
1305
|
+
if (!n || k(n)) return !1;
|
|
1306
|
+
g = n, x.set(n, t);
|
|
1364
1307
|
const a = W(n);
|
|
1365
|
-
return a ? (
|
|
1308
|
+
return a ? (C(n, t, "edit", o, a), !0) : !1;
|
|
1366
1309
|
},
|
|
1367
1310
|
deleteConditionalBlock: (o, i) => {
|
|
1368
|
-
const n =
|
|
1369
|
-
if (!n ||
|
|
1370
|
-
return !1;
|
|
1311
|
+
const n = A(i);
|
|
1312
|
+
if (!n || k(n)) return !1;
|
|
1371
1313
|
const a = W(n);
|
|
1372
|
-
if (!a)
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
return r && R(n), r;
|
|
1314
|
+
if (!a) return !1;
|
|
1315
|
+
const r = Oe(n, a);
|
|
1316
|
+
return r && D(n), r;
|
|
1376
1317
|
},
|
|
1377
1318
|
insertConditionalBlock: (o, i) => {
|
|
1378
|
-
const n =
|
|
1379
|
-
if (!n ||
|
|
1380
|
-
|
|
1381
|
-
y = n, x.set(n, t);
|
|
1319
|
+
const n = A(i);
|
|
1320
|
+
if (!n || k(n)) return !1;
|
|
1321
|
+
g = n, x.set(n, t);
|
|
1382
1322
|
const a = {
|
|
1383
|
-
condition:
|
|
1384
|
-
audience:
|
|
1385
|
-
locale:
|
|
1386
|
-
hasElse:
|
|
1387
|
-
}, r =
|
|
1388
|
-
return
|
|
1323
|
+
condition: o?.condition ?? t.defaultCondition,
|
|
1324
|
+
audience: o?.audience ?? t.defaultAudience,
|
|
1325
|
+
locale: o?.locale ?? t.defaultLocale,
|
|
1326
|
+
hasElse: o?.hasElse ?? t.enableElseByDefault
|
|
1327
|
+
}, r = Me(a, t.labels);
|
|
1328
|
+
return Ne(n, r), w.get(n) === !0 && Z(n, t, !0), !0;
|
|
1389
1329
|
},
|
|
1390
1330
|
toggleConditionalPreview: async (o, i) => {
|
|
1391
|
-
const n =
|
|
1392
|
-
if (!n)
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
const a = typeof o == "boolean" ? o : T.get(n) !== !0;
|
|
1331
|
+
const n = A(i);
|
|
1332
|
+
if (!n) return !1;
|
|
1333
|
+
g = n, x.set(n, t);
|
|
1334
|
+
const a = typeof o == "boolean" ? o : w.get(n) !== !0;
|
|
1396
1335
|
return await Z(n, t, a), !0;
|
|
1397
1336
|
},
|
|
1398
1337
|
setConditionalContext: (o, i) => {
|
|
1399
|
-
const n =
|
|
1400
|
-
return n ? (
|
|
1338
|
+
const n = A(i);
|
|
1339
|
+
return n ? (g = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o), w.get(n) === !0 && Z(n, t, !0), !0) : !1;
|
|
1401
1340
|
}
|
|
1402
1341
|
},
|
|
1403
1342
|
keymap: {
|
|
@@ -1409,13 +1348,13 @@ const lt = (e = {}) => {
|
|
|
1409
1348
|
F10: "toggleConditionalPreview"
|
|
1410
1349
|
},
|
|
1411
1350
|
init: () => {
|
|
1412
|
-
se += 1,
|
|
1351
|
+
se += 1, it(t);
|
|
1413
1352
|
},
|
|
1414
1353
|
destroy: () => {
|
|
1415
|
-
se = Math.max(0, se - 1), se === 0 && (
|
|
1354
|
+
se = Math.max(0, se - 1), se === 0 && (Be(), at());
|
|
1416
1355
|
}
|
|
1417
1356
|
};
|
|
1418
1357
|
};
|
|
1419
1358
|
export {
|
|
1420
|
-
|
|
1359
|
+
rt as ConditionalContentPlugin
|
|
1421
1360
|
};
|