@editora/plugins 1.0.16 → 1.0.18
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/CodePlugin.native-Bwf25lLX.js +460 -0
- package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
- package/dist/a11y-checker.cjs.js +16 -16
- package/dist/a11y-checker.esm.js +79 -75
- package/dist/anchor.cjs.js +9 -9
- package/dist/anchor.esm.js +61 -60
- package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
- package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
- package/dist/approval-workflow.cjs.js +5 -5
- package/dist/approval-workflow.esm.js +105 -104
- package/dist/background-color.cjs.js +1 -1
- package/dist/background-color.esm.js +1 -1
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +226 -202
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +9 -4
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +154 -116
- package/dist/citations.cjs.js +43 -18
- package/dist/citations.esm.js +465 -446
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +21 -20
- package/dist/code-sample.cjs.js +85 -66
- package/dist/code-sample.esm.js +301 -190
- package/dist/code.cjs.js +1 -669
- package/dist/code.esm.js +2 -4560
- package/dist/collaboration.cjs.js +68 -0
- package/dist/collaboration.esm.js +7428 -0
- package/dist/comments.cjs.js +11 -11
- package/dist/comments.esm.js +284 -237
- package/dist/conditional-content.cjs.js +67 -60
- package/dist/conditional-content.esm.js +270 -220
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +28 -27
- package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
- package/dist/dialogHelpers-zU6zpMIA.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
- package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
- package/dist/embed-iframe.cjs.js +37 -17
- package/dist/embed-iframe.esm.js +188 -143
- package/dist/emojis.cjs.js +13 -10
- package/dist/emojis.esm.js +288 -76
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +9 -7
- package/dist/escapeHtml-D2Zh82pD.js +1 -0
- package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +48 -41
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +67 -60
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +2 -1
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +40 -36
- package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
- package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
- package/dist/index-Bm1eqYHh.mjs +194 -0
- package/dist/index-CoflqYuK.js +30 -0
- package/dist/index-CxhJLMPS.js +221 -0
- package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
- package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
- package/dist/index.esm.js +17 -15
- package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
- package/dist/link.cjs.js +17 -13
- package/dist/link.esm.js +138 -69
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +66 -33
- package/dist/math.cjs.js +22 -22
- package/dist/math.esm.js +221 -126
- package/dist/media-manager.cjs.js +12 -12
- package/dist/media-manager.esm.js +55 -50
- package/dist/mentions.cjs.js +2 -2
- package/dist/mentions.esm.js +17 -12
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +43 -42
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +30 -27
- package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
- package/dist/slash-commands.cjs.js +13 -7
- package/dist/slash-commands.esm.js +90 -79
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +85 -81
- package/dist/special-characters.cjs.js +6 -3
- package/dist/special-characters.esm.js +72 -25
- package/dist/spell-check.cjs.js +8 -8
- package/dist/spell-check.esm.js +10189 -295
- package/dist/table.cjs.js +166 -13
- package/dist/table.esm.js +543 -266
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +290 -264
- package/dist/text-color.cjs.js +1 -1
- package/dist/text-color.esm.js +1 -1
- package/dist/translation-workflow.cjs.js +4 -4
- package/dist/translation-workflow.esm.js +33 -31
- package/dist/version-diff.cjs.js +6 -6
- package/dist/version-diff.esm.js +40 -40
- package/package.json +10 -4
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/index-BFsKNTTj.mjs +0 -145
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-tqLTHcO6.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { i as qe } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
2
|
+
const L = ".rte-content, .editora-content", w = '.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)", 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", k = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
3
|
+
let le = null, se = 0, G = null, U = null, X = null, Y = null, J = null, Q = null, M = null, g = null, ee = null;
|
|
4
|
+
const Ie = {
|
|
4
5
|
dialogTitleInsert: "Insert Conditional Content",
|
|
5
6
|
dialogTitleEdit: "Edit Conditional Content",
|
|
6
7
|
conditionLabel: "Condition",
|
|
@@ -29,13 +30,13 @@ function Le(e) {
|
|
|
29
30
|
function te(e) {
|
|
30
31
|
return e ? e.map((t) => t.trim()).filter(Boolean) : [];
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function Ke(e) {
|
|
33
34
|
return {
|
|
34
|
-
...
|
|
35
|
+
...Ie,
|
|
35
36
|
...e || {}
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function T(e) {
|
|
39
40
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
40
41
|
}
|
|
41
42
|
function ce(e) {
|
|
@@ -46,7 +47,7 @@ function ue(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 _e(e) {
|
|
50
51
|
const t = ce(e);
|
|
51
52
|
if (ue(t)) return !0;
|
|
52
53
|
const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
@@ -57,17 +58,17 @@ function fe(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 Fe(e) {
|
|
61
62
|
const t = ce(e);
|
|
62
63
|
if (fe(t)) return !0;
|
|
63
64
|
const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
|
|
64
65
|
return fe(o) ? !0 : fe(document.documentElement) || fe(document.body);
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
67
|
+
function ze(e) {
|
|
68
|
+
return _e(e) ? "dark" : Fe(e) ? "acme" : "light";
|
|
68
69
|
}
|
|
69
70
|
function he(e, t) {
|
|
70
|
-
const o =
|
|
71
|
+
const o = ze(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
74
|
function A(e, t = !0) {
|
|
@@ -91,20 +92,20 @@ function A(e, t = !0) {
|
|
|
91
92
|
}
|
|
92
93
|
return g && g.isConnected ? g : t ? document.querySelector(L) : null;
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function Te(e) {
|
|
95
96
|
const t = window.getSelection();
|
|
96
97
|
if (!t || t.rangeCount === 0) return null;
|
|
97
98
|
const o = t.getRangeAt(0);
|
|
98
99
|
return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function Ee(e, t) {
|
|
101
102
|
const o = window.getSelection();
|
|
102
103
|
o && (o.removeAllRanges(), o.addRange(t), e.focus({ preventScroll: !0 }));
|
|
103
104
|
}
|
|
104
105
|
function Se(e) {
|
|
105
106
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function Be(e, t) {
|
|
108
109
|
if (t === e.innerHTML) return;
|
|
109
110
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
110
111
|
if (typeof o == "function")
|
|
@@ -115,7 +116,7 @@ function Te(e, t) {
|
|
|
115
116
|
}
|
|
116
117
|
function pe(e, t) {
|
|
117
118
|
const o = document.createRange();
|
|
118
|
-
o.selectNodeContents(t), o.collapse(!1),
|
|
119
|
+
o.selectNodeContents(t), o.collapse(!1), Ee(e, o);
|
|
119
120
|
}
|
|
120
121
|
function ye(e, t) {
|
|
121
122
|
if (t)
|
|
@@ -124,7 +125,7 @@ function ye(e, t) {
|
|
|
124
125
|
return o[i];
|
|
125
126
|
}, e);
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function je(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,17 +142,17 @@ function _e(e) {
|
|
|
141
142
|
}
|
|
142
143
|
return t;
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function Ve(e, t) {
|
|
145
146
|
const o = e.trim();
|
|
146
147
|
if (!o) return !0;
|
|
147
148
|
if (o.startsWith("!")) {
|
|
148
|
-
const
|
|
149
|
-
return !ye(t,
|
|
149
|
+
const x = o.slice(1).trim();
|
|
150
|
+
return !ye(t, x);
|
|
150
151
|
}
|
|
151
152
|
const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
|
|
152
153
|
if (!i)
|
|
153
154
|
return !!ye(t, o);
|
|
154
|
-
const [, n, a, r] = i, l = ye(t, n), d =
|
|
155
|
+
const [, n, a, r] = i, l = ye(t, n), d = je(r);
|
|
155
156
|
switch (a) {
|
|
156
157
|
case "==":
|
|
157
158
|
return l == d;
|
|
@@ -166,15 +167,15 @@ 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((x) => x == l) : typeof d == "string" ? d.split(",").map((x) => x.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((x) => String(x).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
|
+
function We() {
|
|
178
179
|
if (typeof document > "u" || document.getElementById(Ce)) return;
|
|
179
180
|
const e = document.createElement("style");
|
|
180
181
|
e.id = Ce, e.textContent = `
|
|
@@ -458,24 +459,31 @@ function Fe() {
|
|
|
458
459
|
background: #fff5f5;
|
|
459
460
|
}
|
|
460
461
|
|
|
461
|
-
.rte-conditional-preview-on ${
|
|
462
|
+
.rte-conditional-preview-on ${w} {
|
|
462
463
|
border-width: 2px;
|
|
463
464
|
}
|
|
464
465
|
|
|
465
|
-
.rte-conditional-preview-on ${
|
|
466
|
+
.rte-conditional-preview-on ${w} .rte-conditional-header {
|
|
466
467
|
background: #ecfeff;
|
|
467
468
|
border-color: #bae6fd;
|
|
468
469
|
}
|
|
469
470
|
|
|
470
|
-
${
|
|
471
|
+
${f} .rte-conditional-preview-on ${w} .rte-conditional-header,
|
|
472
|
+
${p} .rte-conditional-preview-on ${w} .rte-conditional-header,
|
|
473
|
+
.${c}.rte-conditional-theme-dark .rte-conditional-preview-on ${w} .rte-conditional-header {
|
|
474
|
+
background: #0c2b36;
|
|
475
|
+
border-color: #155e75;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
${f} .rte-conditional-block,
|
|
471
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
|
-
${
|
|
485
|
+
${f} .rte-conditional-header,
|
|
486
|
+
${f} .rte-conditional-else-label,
|
|
479
487
|
${p} .rte-conditional-header,
|
|
480
488
|
${p} .rte-conditional-else-label,
|
|
481
489
|
.${c}.rte-conditional-theme-dark .rte-conditional-header,
|
|
@@ -484,19 +492,19 @@ function Fe() {
|
|
|
484
492
|
border-color: #334155;
|
|
485
493
|
}
|
|
486
494
|
|
|
487
|
-
${
|
|
495
|
+
${f} .rte-conditional-summary,
|
|
488
496
|
${p} .rte-conditional-summary,
|
|
489
497
|
.${c}.rte-conditional-theme-dark .rte-conditional-summary {
|
|
490
498
|
color: #e2e8f0;
|
|
491
499
|
}
|
|
492
500
|
|
|
493
|
-
${
|
|
501
|
+
${f} .rte-conditional-meta,
|
|
494
502
|
${p} .rte-conditional-meta,
|
|
495
503
|
.${c}.rte-conditional-theme-dark .rte-conditional-meta {
|
|
496
504
|
color: #94a3b8;
|
|
497
505
|
}
|
|
498
506
|
|
|
499
|
-
${
|
|
507
|
+
${f} .rte-conditional-chip,
|
|
500
508
|
${p} .rte-conditional-chip,
|
|
501
509
|
.${c}.rte-conditional-theme-dark .rte-conditional-chip {
|
|
502
510
|
background: #1e3a8a;
|
|
@@ -504,7 +512,7 @@ function Fe() {
|
|
|
504
512
|
color: #dbeafe;
|
|
505
513
|
}
|
|
506
514
|
|
|
507
|
-
${
|
|
515
|
+
${f} .rte-conditional-chip-else,
|
|
508
516
|
${p} .rte-conditional-chip-else,
|
|
509
517
|
.${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
|
|
510
518
|
background: #7f1d1d;
|
|
@@ -512,22 +520,22 @@ function Fe() {
|
|
|
512
520
|
color: #fee2e2;
|
|
513
521
|
}
|
|
514
522
|
|
|
515
|
-
${
|
|
523
|
+
${f} .rte-conditional-body,
|
|
516
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
|
-
${
|
|
530
|
+
${f} .rte-conditional-dialog,
|
|
523
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
|
-
${
|
|
537
|
+
${f} .rte-conditional-dialog-header,
|
|
538
|
+
${f} .rte-conditional-dialog-footer,
|
|
531
539
|
${p} .rte-conditional-dialog-header,
|
|
532
540
|
${p} .rte-conditional-dialog-footer,
|
|
533
541
|
.${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
|
|
@@ -536,9 +544,9 @@ function Fe() {
|
|
|
536
544
|
border-color: #334155;
|
|
537
545
|
}
|
|
538
546
|
|
|
539
|
-
${
|
|
540
|
-
${
|
|
541
|
-
${
|
|
547
|
+
${f} .rte-conditional-dialog-title,
|
|
548
|
+
${f} .rte-conditional-field label,
|
|
549
|
+
${f} .rte-conditional-checkbox,
|
|
542
550
|
${p} .rte-conditional-dialog-title,
|
|
543
551
|
${p} .rte-conditional-field label,
|
|
544
552
|
${p} .rte-conditional-checkbox,
|
|
@@ -548,14 +556,14 @@ function Fe() {
|
|
|
548
556
|
color: #e2e8f0;
|
|
549
557
|
}
|
|
550
558
|
|
|
551
|
-
${
|
|
559
|
+
${f} .rte-conditional-help,
|
|
552
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
|
-
${
|
|
565
|
+
${f} .rte-conditional-field input[type="text"],
|
|
566
|
+
${f} .rte-conditional-btn,
|
|
559
567
|
${p} .rte-conditional-field input[type="text"],
|
|
560
568
|
${p} .rte-conditional-btn,
|
|
561
569
|
.${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
|
|
@@ -565,7 +573,7 @@ function Fe() {
|
|
|
565
573
|
color: #e2e8f0;
|
|
566
574
|
}
|
|
567
575
|
|
|
568
|
-
${
|
|
576
|
+
${f} .rte-conditional-btn-primary,
|
|
569
577
|
${p} .rte-conditional-btn-primary,
|
|
570
578
|
.${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
|
|
571
579
|
border-color: #3b82f6;
|
|
@@ -573,20 +581,20 @@ function Fe() {
|
|
|
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
586
|
${p} .rte-toolbar-group-items.conditional-content,
|
|
579
|
-
${
|
|
587
|
+
${f} .editora-toolbar-group-items.conditional-content {
|
|
580
588
|
border-color: #566275;
|
|
581
589
|
}
|
|
582
590
|
|
|
583
|
-
${
|
|
591
|
+
${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
584
592
|
${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
|
|
585
|
-
${
|
|
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 Fe() {
|
|
|
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 Fe() {
|
|
|
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 Fe() {
|
|
|
610
618
|
background: rgba(127, 29, 29, 0.45);
|
|
611
619
|
}
|
|
612
620
|
|
|
613
|
-
${
|
|
621
|
+
${b} .rte-conditional-block,
|
|
614
622
|
${h} .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
|
${h} .rte-conditional-header,
|
|
623
631
|
${h} .rte-conditional-else-label,
|
|
624
632
|
.${c}.rte-conditional-theme-acme .rte-conditional-header,
|
|
@@ -627,19 +635,19 @@ function Fe() {
|
|
|
627
635
|
border-color: #cbd8e8;
|
|
628
636
|
}
|
|
629
637
|
|
|
630
|
-
${
|
|
638
|
+
${b} .rte-conditional-summary,
|
|
631
639
|
${h} .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
|
${h} .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
|
${h} .rte-conditional-chip,
|
|
644
652
|
.${c}.rte-conditional-theme-acme .rte-conditional-chip {
|
|
645
653
|
background: #d9f5ee;
|
|
@@ -647,7 +655,7 @@ function Fe() {
|
|
|
647
655
|
color: #0f4f4a;
|
|
648
656
|
}
|
|
649
657
|
|
|
650
|
-
${
|
|
658
|
+
${b} .rte-conditional-chip-else,
|
|
651
659
|
${h} .rte-conditional-chip-else,
|
|
652
660
|
.${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
|
|
653
661
|
background: #fde8ea;
|
|
@@ -655,14 +663,14 @@ function Fe() {
|
|
|
655
663
|
color: #8b1f2f;
|
|
656
664
|
}
|
|
657
665
|
|
|
658
|
-
${
|
|
666
|
+
${b} .rte-conditional-body,
|
|
659
667
|
${h} .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
|
${h} .rte-conditional-dialog,
|
|
667
675
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog {
|
|
668
676
|
background: #ffffff;
|
|
@@ -670,8 +678,8 @@ function Fe() {
|
|
|
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
|
${h} .rte-conditional-dialog-header,
|
|
676
684
|
${h} .rte-conditional-dialog-footer,
|
|
677
685
|
.${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
|
|
@@ -680,9 +688,9 @@ function Fe() {
|
|
|
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
|
${h} .rte-conditional-dialog-title,
|
|
687
695
|
${h} .rte-conditional-field label,
|
|
688
696
|
${h} .rte-conditional-checkbox,
|
|
@@ -692,14 +700,14 @@ function Fe() {
|
|
|
692
700
|
color: #1f334a;
|
|
693
701
|
}
|
|
694
702
|
|
|
695
|
-
${
|
|
703
|
+
${b} .rte-conditional-help,
|
|
696
704
|
${h} .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
|
${h} .rte-conditional-field input[type="text"],
|
|
704
712
|
${h} .rte-conditional-btn,
|
|
705
713
|
.${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
|
|
@@ -709,7 +717,7 @@ function Fe() {
|
|
|
709
717
|
color: #0f172a;
|
|
710
718
|
}
|
|
711
719
|
|
|
712
|
-
${
|
|
720
|
+
${b} .rte-conditional-btn-primary,
|
|
713
721
|
${h} .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 Fe() {
|
|
|
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
|
${h} .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
|
${h} .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 Fe() {
|
|
|
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 Fe() {
|
|
|
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,24 +770,24 @@ function Fe() {
|
|
|
762
770
|
}
|
|
763
771
|
`, document.head.appendChild(e);
|
|
764
772
|
}
|
|
765
|
-
function
|
|
773
|
+
function Ze(e) {
|
|
766
774
|
return {
|
|
767
775
|
defaultCondition: e.defaultCondition || "",
|
|
768
776
|
defaultAudience: te(e.defaultAudience || []),
|
|
769
777
|
defaultLocale: te(e.defaultLocale || []),
|
|
770
778
|
enableElseByDefault: e.enableElseByDefault === !0,
|
|
771
|
-
labels:
|
|
779
|
+
labels: Ke(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 || Ve
|
|
777
785
|
};
|
|
778
786
|
}
|
|
779
|
-
function
|
|
787
|
+
function Ne() {
|
|
780
788
|
le && (le.cleanup(), le = null);
|
|
781
789
|
}
|
|
782
|
-
function
|
|
790
|
+
function Ge(e) {
|
|
783
791
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
784
792
|
}
|
|
785
793
|
function oe(e, t) {
|
|
@@ -787,9 +795,9 @@ function oe(e, t) {
|
|
|
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"), Ye(e, !t);
|
|
791
799
|
}
|
|
792
|
-
function
|
|
800
|
+
function Ue(e) {
|
|
793
801
|
const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
794
802
|
if (!t) return;
|
|
795
803
|
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"]');
|
|
@@ -806,25 +814,25 @@ function We(e) {
|
|
|
806
814
|
function W(e) {
|
|
807
815
|
const t = window.getSelection();
|
|
808
816
|
if (t && t.rangeCount > 0) {
|
|
809
|
-
const n = t.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(
|
|
817
|
+
const n = t.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(w);
|
|
810
818
|
if (r && e.contains(r)) return r;
|
|
811
819
|
}
|
|
812
|
-
const i = document.activeElement?.closest(
|
|
820
|
+
const i = document.activeElement?.closest(w);
|
|
813
821
|
return i && e.contains(i) ? i : null;
|
|
814
822
|
}
|
|
815
|
-
function
|
|
823
|
+
function xe(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">${y(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 Xe(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 Ye(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");
|
|
@@ -843,38 +851,80 @@ function ve(e, t) {
|
|
|
843
851
|
v.className = "rte-conditional-body", v.setAttribute("data-slot", "if"), v.innerHTML = "<p><br></p>", e.insertBefore(v, e.children[1] || null);
|
|
844
852
|
}
|
|
845
853
|
const m = e.getAttribute("data-has-else") === "true";
|
|
846
|
-
m &&
|
|
854
|
+
m && xe(e, t), Ue(e), Xe(e, m);
|
|
847
855
|
}
|
|
848
|
-
function
|
|
856
|
+
function He(e, t) {
|
|
849
857
|
const o = document.createElement("section");
|
|
850
858
|
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");
|
|
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 && xe(o, t), ve(o, t), oe(o, !1), o;
|
|
855
863
|
}
|
|
856
|
-
function
|
|
864
|
+
function Je(e, t) {
|
|
857
865
|
if (t)
|
|
858
866
|
try {
|
|
859
867
|
if (!e.isConnected) return;
|
|
860
868
|
const o = e.contains(t.startContainer), i = e.contains(t.endContainer);
|
|
861
869
|
if (!o || !i) return;
|
|
862
|
-
|
|
870
|
+
Ee(e, t);
|
|
863
871
|
} catch {
|
|
864
872
|
}
|
|
865
873
|
}
|
|
866
|
-
function
|
|
874
|
+
function Qe(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 Me = /* @__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 we(e, t) {
|
|
899
|
+
let o = e;
|
|
900
|
+
for (; o && o !== t; ) {
|
|
901
|
+
if (o.nodeType === Node.ELEMENT_NODE && Me.has(o.tagName))
|
|
902
|
+
return o;
|
|
903
|
+
o = o.parentNode;
|
|
904
|
+
}
|
|
905
|
+
return null;
|
|
906
|
+
}
|
|
907
|
+
function et(e) {
|
|
908
|
+
let t = null;
|
|
909
|
+
Array.from(e.childNodes).forEach((o) => {
|
|
910
|
+
if (o.nodeType === Node.ELEMENT_NODE && Me.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 De(e, t, o) {
|
|
870
918
|
let i = null;
|
|
871
|
-
i || (i =
|
|
919
|
+
i || (i = Te(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
|
|
872
920
|
let n = null;
|
|
873
|
-
i.collapsed || (n = i.extractContents())
|
|
874
|
-
const a =
|
|
875
|
-
a &&
|
|
921
|
+
i.collapsed || (n = i.extractContents());
|
|
922
|
+
const a = we(i.endContainer, e) || we(i.startContainer, e);
|
|
923
|
+
a && a.parentNode ? a.parentNode.insertBefore(t, a.nextSibling) : i.insertNode(t);
|
|
924
|
+
const r = t.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
925
|
+
r && n && Qe(n) && (r.innerHTML = "", r.appendChild(n)), et(e), r ? pe(e, r) : pe(e, t), e.normalize();
|
|
876
926
|
}
|
|
877
|
-
function
|
|
927
|
+
function tt(e) {
|
|
878
928
|
return {
|
|
879
929
|
condition: e.getAttribute("data-condition") || "",
|
|
880
930
|
audience: O(e.getAttribute("data-audience")),
|
|
@@ -882,17 +932,17 @@ function Je(e) {
|
|
|
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", te(t.audience).join(",")), e.setAttribute("data-locale", te(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse &&
|
|
935
|
+
function ot(e, t, o) {
|
|
936
|
+
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 && xe(e, o), ve(e, o), oe(e, e.classList.contains("rte-conditional-preview"));
|
|
887
937
|
}
|
|
888
938
|
function ne(e, t) {
|
|
889
939
|
he(e, e);
|
|
890
|
-
const o = Array.from(e.querySelectorAll(
|
|
940
|
+
const o = Array.from(e.querySelectorAll(w)), i = k.get(e) === !0;
|
|
891
941
|
return o.forEach((n) => {
|
|
892
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"), ve(n, t), oe(n, i);
|
|
893
943
|
}), o;
|
|
894
944
|
}
|
|
895
|
-
async function
|
|
945
|
+
async function nt(e, t) {
|
|
896
946
|
const o = $e.get(e);
|
|
897
947
|
if (o)
|
|
898
948
|
return o;
|
|
@@ -922,32 +972,32 @@ function Ae(e, t) {
|
|
|
922
972
|
}
|
|
923
973
|
async function Z(e, t, o) {
|
|
924
974
|
const i = t.labels, n = ne(e, i);
|
|
925
|
-
if (
|
|
975
|
+
if (k.set(e, o), Oe(e, o), ce(e).classList.toggle("rte-conditional-preview-on", o), !o) {
|
|
926
976
|
n.forEach(($) => {
|
|
927
977
|
$.classList.remove("rte-conditional-preview"), oe($, !1);
|
|
928
|
-
const
|
|
929
|
-
|
|
978
|
+
const R = $.querySelector('.rte-conditional-body[data-slot="if"]'), B = $.querySelector('.rte-conditional-body[data-slot="else"]'), z = $.querySelector(".rte-conditional-else-label"), N = $.getAttribute("data-has-else") === "true";
|
|
979
|
+
R && (R.classList.remove("rte-conditional-hidden"), R.removeAttribute("aria-hidden")), B && (B.classList.toggle("rte-conditional-hidden", !N), B.setAttribute("aria-hidden", N ? "false" : "true")), z && z.classList.toggle("rte-conditional-hidden", !N);
|
|
930
980
|
});
|
|
931
981
|
return;
|
|
932
982
|
}
|
|
933
|
-
const r = await
|
|
983
|
+
const r = await nt(e, t), l = be(t.currentAudience), d = be(t.currentLocale), x = be(
|
|
934
984
|
r.audience ?? r.user?.audience
|
|
935
985
|
), m = be(
|
|
936
986
|
r.locale ?? r.user?.locale
|
|
937
|
-
), v = l.length > 0 ? l :
|
|
987
|
+
), v = l.length > 0 ? l : x, S = d.length > 0 ? d : m;
|
|
938
988
|
n.forEach(($) => {
|
|
939
|
-
const
|
|
940
|
-
if ($.classList.add("rte-conditional-preview"), oe($, !0), ie && (ie.classList.toggle("rte-conditional-hidden", !
|
|
941
|
-
const s =
|
|
989
|
+
const R = $.getAttribute("data-condition") || "", B = O($.getAttribute("data-audience")).map((s) => s.toLowerCase()), z = O($.getAttribute("data-locale")).map((s) => s.toLowerCase()), N = $.getAttribute("data-has-else") === "true", ge = t.evaluateCondition(R, r), H = Ae(B, v), de = Ae(z, S), P = ge && H && de, ie = $.querySelector('.rte-conditional-body[data-slot="if"]'), j = $.querySelector('.rte-conditional-body[data-slot="else"]'), ae = $.querySelector(".rte-conditional-else-label");
|
|
990
|
+
if ($.classList.add("rte-conditional-preview"), oe($, !0), ie && (ie.classList.toggle("rte-conditional-hidden", !P), ie.setAttribute("aria-hidden", P ? "false" : "true")), j) {
|
|
991
|
+
const s = N && !P;
|
|
942
992
|
j.classList.toggle("rte-conditional-hidden", !s), j.setAttribute("aria-hidden", s ? "false" : "true");
|
|
943
993
|
}
|
|
944
994
|
if (ae) {
|
|
945
|
-
const s =
|
|
995
|
+
const s = N && !P;
|
|
946
996
|
ae.classList.toggle("rte-conditional-hidden", !s);
|
|
947
997
|
}
|
|
948
998
|
});
|
|
949
999
|
}
|
|
950
|
-
function
|
|
1000
|
+
function Oe(e, t) {
|
|
951
1001
|
const o = ce(e);
|
|
952
1002
|
Array.from(
|
|
953
1003
|
o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
|
|
@@ -955,7 +1005,7 @@ function De(e, t) {
|
|
|
955
1005
|
n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
|
|
956
1006
|
});
|
|
957
1007
|
}
|
|
958
|
-
function
|
|
1008
|
+
function it(e) {
|
|
959
1009
|
const t = _.get(e);
|
|
960
1010
|
if (t && t.isConnected) return t;
|
|
961
1011
|
const o = document.createElement("div");
|
|
@@ -971,23 +1021,23 @@ function et(e) {
|
|
|
971
1021
|
}), o.addEventListener("click", (i) => {
|
|
972
1022
|
const a = i.target?.closest("[data-action]")?.getAttribute("data-action");
|
|
973
1023
|
if (!a) return;
|
|
974
|
-
const r =
|
|
1024
|
+
const r = E.get(e) || ee;
|
|
975
1025
|
if (!r) return;
|
|
976
|
-
const l =
|
|
1026
|
+
const l = F.get(e);
|
|
977
1027
|
if (!(!l || !e.contains(l))) {
|
|
978
1028
|
if (a === "edit") {
|
|
979
1029
|
C(e, r, "edit", void 0, l);
|
|
980
1030
|
return;
|
|
981
1031
|
}
|
|
982
|
-
a === "delete" && (
|
|
1032
|
+
a === "delete" && (Pe(e, l), F.set(e, null), K(e));
|
|
983
1033
|
}
|
|
984
1034
|
}), document.body.appendChild(o), _.set(e, o), o;
|
|
985
1035
|
}
|
|
986
|
-
function
|
|
1036
|
+
function K(e) {
|
|
987
1037
|
const t = _.get(e);
|
|
988
1038
|
t && t.classList.remove("show");
|
|
989
1039
|
}
|
|
990
|
-
function
|
|
1040
|
+
function Re(e, t) {
|
|
991
1041
|
const o = t.getBoundingClientRect();
|
|
992
1042
|
e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
|
|
993
1043
|
const i = e.getBoundingClientRect(), n = 8, a = window.innerWidth, r = window.innerHeight;
|
|
@@ -997,53 +1047,53 @@ function He(e, t) {
|
|
|
997
1047
|
d = Math.max(n, Math.min(d, a - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
|
|
998
1048
|
}
|
|
999
1049
|
function me(e, t) {
|
|
1000
|
-
const o =
|
|
1001
|
-
he(o, e),
|
|
1050
|
+
const o = it(e);
|
|
1051
|
+
he(o, e), F.set(e, t), Re(o, t);
|
|
1002
1052
|
}
|
|
1003
1053
|
function D(e) {
|
|
1004
|
-
const t =
|
|
1054
|
+
const t = E.get(e) || ee;
|
|
1005
1055
|
if (!t) return;
|
|
1006
1056
|
const o = W(e);
|
|
1007
|
-
if (!o || !e.contains(o) ||
|
|
1008
|
-
|
|
1057
|
+
if (!o || !e.contains(o) || T(e)) {
|
|
1058
|
+
F.set(e, null), K(e);
|
|
1009
1059
|
return;
|
|
1010
1060
|
}
|
|
1011
1061
|
ne(e, t.labels), me(e, o);
|
|
1012
1062
|
}
|
|
1013
|
-
function
|
|
1063
|
+
function at() {
|
|
1014
1064
|
_.forEach((e, t) => {
|
|
1015
1065
|
if (!t.isConnected || !e.isConnected) {
|
|
1016
|
-
e.remove(), _.delete(t),
|
|
1066
|
+
e.remove(), _.delete(t), F.delete(t);
|
|
1017
1067
|
return;
|
|
1018
1068
|
}
|
|
1019
1069
|
if (!e.classList.contains("show")) return;
|
|
1020
1070
|
he(e, t);
|
|
1021
|
-
const o =
|
|
1071
|
+
const o = F.get(t);
|
|
1022
1072
|
if (!o || !t.contains(o)) {
|
|
1023
|
-
|
|
1073
|
+
K(t);
|
|
1024
1074
|
return;
|
|
1025
1075
|
}
|
|
1026
|
-
|
|
1076
|
+
Re(e, o);
|
|
1027
1077
|
});
|
|
1028
1078
|
}
|
|
1029
|
-
function
|
|
1079
|
+
function Pe(e, t) {
|
|
1030
1080
|
if (!e.contains(t)) return !1;
|
|
1031
1081
|
const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
|
|
1032
1082
|
t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
|
|
1033
1083
|
const a = document.createRange();
|
|
1034
|
-
return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0),
|
|
1084
|
+
return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), Ee(e, a), Se(e), Be(e, o), !0;
|
|
1035
1085
|
}
|
|
1036
|
-
function
|
|
1086
|
+
function ke(e, t, o) {
|
|
1037
1087
|
const i = e.cloneRange(), n = document.createRange();
|
|
1038
1088
|
return n.selectNodeContents(t), n.collapse(o === "start"), i.startContainer === n.startContainer && i.startOffset === n.startOffset && i.endContainer === n.endContainer && i.endOffset === n.endOffset;
|
|
1039
1089
|
}
|
|
1040
1090
|
function C(e, t, o, i, n) {
|
|
1041
|
-
|
|
1042
|
-
const a = t.labels, r = o === "insert" ?
|
|
1043
|
-
l.className = c, he(l, e);
|
|
1091
|
+
Ne();
|
|
1092
|
+
const a = t.labels, r = o === "insert" ? Te(e) : null, l = document.createElement("div");
|
|
1093
|
+
qe(l), l.className = c, he(l, e);
|
|
1044
1094
|
const d = document.createElement("section");
|
|
1045
1095
|
d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
|
|
1046
|
-
const
|
|
1096
|
+
const x = n ? tt(n) : void 0, m = i || x || {}, v = m.condition ?? t.defaultCondition, S = m.audience ?? t.defaultAudience, $ = m.locale ?? t.defaultLocale, R = m.hasElse ?? t.enableElseByDefault;
|
|
1047
1097
|
d.innerHTML = `
|
|
1048
1098
|
<header class="rte-conditional-dialog-header">
|
|
1049
1099
|
<h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${y(
|
|
@@ -1071,7 +1121,7 @@ function C(e, t, o, i, n) {
|
|
|
1071
1121
|
)}" placeholder="${y(a.localePlaceholder)}" />
|
|
1072
1122
|
</div>
|
|
1073
1123
|
<label class="rte-conditional-checkbox">
|
|
1074
|
-
<input class="rte-conditional-input-else" type="checkbox" ${
|
|
1124
|
+
<input class="rte-conditional-input-else" type="checkbox" ${R ? "checked" : ""} />
|
|
1075
1125
|
<span>${y(a.elseLabel)}</span>
|
|
1076
1126
|
</label>
|
|
1077
1127
|
<p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
|
|
@@ -1081,48 +1131,48 @@ function C(e, t, o, i, n) {
|
|
|
1081
1131
|
<button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${y(a.saveText)}</button>
|
|
1082
1132
|
</footer>
|
|
1083
1133
|
`, l.appendChild(d), document.body.appendChild(l);
|
|
1084
|
-
const
|
|
1085
|
-
l.removeEventListener("click",
|
|
1134
|
+
const B = d.querySelector(".rte-conditional-input-condition"), z = d.querySelector(".rte-conditional-input-audience"), N = d.querySelector(".rte-conditional-input-locale"), ge = d.querySelector(".rte-conditional-input-else"), H = () => {
|
|
1135
|
+
l.removeEventListener("click", P), 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
1136
|
}, de = (s) => {
|
|
1087
|
-
s.key === "Escape" && (s.preventDefault(), s.stopPropagation(),
|
|
1088
|
-
},
|
|
1089
|
-
s.target === l &&
|
|
1137
|
+
s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), H());
|
|
1138
|
+
}, P = (s) => {
|
|
1139
|
+
s.target === l && H();
|
|
1090
1140
|
}, ie = (s) => {
|
|
1091
1141
|
if (s.key !== "Tab") return;
|
|
1092
1142
|
const q = Array.from(
|
|
1093
1143
|
d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
|
|
1094
1144
|
);
|
|
1095
1145
|
if (q.length === 0) return;
|
|
1096
|
-
const V = q[0],
|
|
1146
|
+
const V = q[0], I = q[q.length - 1], re = document.activeElement;
|
|
1097
1147
|
if (s.shiftKey && re === V) {
|
|
1098
|
-
s.preventDefault(),
|
|
1148
|
+
s.preventDefault(), I.focus();
|
|
1099
1149
|
return;
|
|
1100
1150
|
}
|
|
1101
|
-
!s.shiftKey && re ===
|
|
1151
|
+
!s.shiftKey && re === I && (s.preventDefault(), V.focus());
|
|
1102
1152
|
}, j = async () => {
|
|
1103
1153
|
const s = {
|
|
1104
|
-
condition:
|
|
1105
|
-
audience: O(
|
|
1106
|
-
locale: O(
|
|
1154
|
+
condition: B?.value?.trim() || "",
|
|
1155
|
+
audience: O(z?.value),
|
|
1156
|
+
locale: O(N?.value),
|
|
1107
1157
|
hasElse: ge?.checked || !1
|
|
1108
1158
|
}, q = e.innerHTML;
|
|
1109
1159
|
if (n)
|
|
1110
|
-
|
|
1160
|
+
ot(n, s, a), oe(n, k.get(e) === !0);
|
|
1111
1161
|
else {
|
|
1112
|
-
|
|
1113
|
-
const
|
|
1162
|
+
Je(e, r);
|
|
1163
|
+
const I = He(s, a);
|
|
1114
1164
|
try {
|
|
1115
|
-
|
|
1165
|
+
De(e, I);
|
|
1116
1166
|
} catch {
|
|
1117
|
-
e.appendChild(
|
|
1118
|
-
const re =
|
|
1119
|
-
re ? pe(e, re) : pe(e,
|
|
1167
|
+
e.appendChild(I);
|
|
1168
|
+
const re = I.querySelector('.rte-conditional-body[data-slot="if"]');
|
|
1169
|
+
re ? pe(e, re) : pe(e, I);
|
|
1120
1170
|
}
|
|
1121
1171
|
}
|
|
1122
|
-
|
|
1172
|
+
k.get(e) === !0 && await Z(e, t, !0), Se(e), Be(e, q), D(e), H();
|
|
1123
1173
|
}, ae = (s) => {
|
|
1124
1174
|
if (s.key === "Escape") {
|
|
1125
|
-
s.preventDefault(),
|
|
1175
|
+
s.preventDefault(), H();
|
|
1126
1176
|
return;
|
|
1127
1177
|
}
|
|
1128
1178
|
ie(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), j());
|
|
@@ -1130,50 +1180,50 @@ function C(e, t, o, i, n) {
|
|
|
1130
1180
|
d.addEventListener("click", (s) => {
|
|
1131
1181
|
const V = s.target.getAttribute("data-action");
|
|
1132
1182
|
if (V === "cancel") {
|
|
1133
|
-
|
|
1183
|
+
H();
|
|
1134
1184
|
return;
|
|
1135
1185
|
}
|
|
1136
1186
|
V === "save" && j();
|
|
1137
|
-
}), l.addEventListener("click",
|
|
1187
|
+
}), l.addEventListener("click", P), l.addEventListener("keydown", ae, !0), document.addEventListener("keydown", de, !0), le = { cleanup: H }, B?.focus();
|
|
1138
1188
|
}
|
|
1139
|
-
function
|
|
1189
|
+
function rt(e) {
|
|
1140
1190
|
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");
|
|
1141
1191
|
return a || r;
|
|
1142
1192
|
}
|
|
1143
|
-
function
|
|
1193
|
+
function lt(e) {
|
|
1144
1194
|
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");
|
|
1145
1195
|
return a || r;
|
|
1146
1196
|
}
|
|
1147
|
-
function
|
|
1197
|
+
function ct(e) {
|
|
1148
1198
|
ee = e, U || (U = (t) => {
|
|
1149
1199
|
const i = t.target?.closest(L);
|
|
1150
1200
|
if (!i) return;
|
|
1151
|
-
g = i,
|
|
1152
|
-
const n =
|
|
1153
|
-
ne(i, n.labels),
|
|
1201
|
+
g = i, E.has(i) || E.set(i, e);
|
|
1202
|
+
const n = E.get(i) || e;
|
|
1203
|
+
ne(i, n.labels), Oe(i, k.get(i) === !0), D(i);
|
|
1154
1204
|
}, document.addEventListener("focusin", U, !0)), G || (G = (t) => {
|
|
1155
1205
|
if (document.querySelector(`.${c}`)) return;
|
|
1156
1206
|
const i = t.target;
|
|
1157
1207
|
if (!!i?.closest("input, textarea, select")) return;
|
|
1158
1208
|
const r = i?.closest(L) || A(void 0, !1) || g;
|
|
1159
|
-
if (!r ||
|
|
1160
|
-
const l =
|
|
1161
|
-
if (
|
|
1162
|
-
const m =
|
|
1209
|
+
if (!r || T(r)) return;
|
|
1210
|
+
const l = E.get(r) || ee || e, d = document.activeElement, x = i?.closest(".rte-conditional-header") || d?.closest(".rte-conditional-header");
|
|
1211
|
+
if (x && (t.key === "Enter" || t.key === " ")) {
|
|
1212
|
+
const m = x.closest(w);
|
|
1163
1213
|
if (m && r.contains(m)) {
|
|
1164
1214
|
t.preventDefault(), t.stopPropagation(), C(r, l, "edit", void 0, m);
|
|
1165
1215
|
return;
|
|
1166
1216
|
}
|
|
1167
1217
|
}
|
|
1168
|
-
if (
|
|
1218
|
+
if (rt(t)) {
|
|
1169
1219
|
t.preventDefault(), t.stopPropagation();
|
|
1170
1220
|
const m = W(r);
|
|
1171
1221
|
m ? C(r, l, "edit", void 0, m) : C(r, l, "insert");
|
|
1172
1222
|
return;
|
|
1173
1223
|
}
|
|
1174
|
-
if (
|
|
1224
|
+
if (lt(t)) {
|
|
1175
1225
|
t.preventDefault(), t.stopPropagation();
|
|
1176
|
-
const m =
|
|
1226
|
+
const m = k.get(r) !== !0;
|
|
1177
1227
|
Z(r, l, m), D(r);
|
|
1178
1228
|
return;
|
|
1179
1229
|
}
|
|
@@ -1182,71 +1232,71 @@ function it(e) {
|
|
|
1182
1232
|
if (!m || m.rangeCount === 0) return;
|
|
1183
1233
|
const v = m.getRangeAt(0);
|
|
1184
1234
|
if (!v.collapsed || !r.contains(v.commonAncestorContainer)) return;
|
|
1185
|
-
const S =
|
|
1235
|
+
const S = Ge(v.startContainer)?.closest(".rte-conditional-body");
|
|
1186
1236
|
if (!S || !r.contains(S)) return;
|
|
1187
|
-
if (t.key === "Backspace" &&
|
|
1237
|
+
if (t.key === "Backspace" && ke(v, S, "start")) {
|
|
1188
1238
|
t.preventDefault();
|
|
1189
1239
|
return;
|
|
1190
1240
|
}
|
|
1191
|
-
if (t.key === "Delete" &&
|
|
1241
|
+
if (t.key === "Delete" && ke(v, S, "end")) {
|
|
1192
1242
|
t.preventDefault();
|
|
1193
1243
|
return;
|
|
1194
1244
|
}
|
|
1195
1245
|
}
|
|
1196
|
-
}, document.addEventListener("keydown", G, !0)),
|
|
1246
|
+
}, document.addEventListener("keydown", G, !0)), Y || (Y = (t) => {
|
|
1197
1247
|
const o = t.target;
|
|
1198
1248
|
if (!o || o.closest(`.${u}`)) return;
|
|
1199
1249
|
const i = o.closest(L);
|
|
1200
1250
|
if (!i) {
|
|
1201
|
-
g &&
|
|
1251
|
+
g && K(g);
|
|
1202
1252
|
return;
|
|
1203
1253
|
}
|
|
1204
|
-
if (
|
|
1205
|
-
g = i,
|
|
1206
|
-
const n = o.closest(
|
|
1254
|
+
if (T(i)) return;
|
|
1255
|
+
g = i, E.has(i) || E.set(i, e);
|
|
1256
|
+
const n = o.closest(w);
|
|
1207
1257
|
if (!n) {
|
|
1208
|
-
|
|
1258
|
+
K(i);
|
|
1209
1259
|
return;
|
|
1210
1260
|
}
|
|
1211
1261
|
requestAnimationFrame(() => {
|
|
1212
1262
|
!i.isConnected || !i.contains(n) || me(i, n);
|
|
1213
1263
|
});
|
|
1214
|
-
}, document.addEventListener("mousedown",
|
|
1264
|
+
}, document.addEventListener("mousedown", Y, !0)), X || (X = (t) => {
|
|
1215
1265
|
const o = t.target;
|
|
1216
1266
|
if (!o || o.closest(`.${u}`)) return;
|
|
1217
1267
|
const i = o.closest(L);
|
|
1218
1268
|
if (!i) {
|
|
1219
|
-
g &&
|
|
1269
|
+
g && K(g);
|
|
1220
1270
|
return;
|
|
1221
1271
|
}
|
|
1222
|
-
if (
|
|
1223
|
-
g = i,
|
|
1224
|
-
const n =
|
|
1272
|
+
if (T(i)) return;
|
|
1273
|
+
g = i, E.has(i) || E.set(i, e);
|
|
1274
|
+
const n = E.get(i) || e, a = o.closest(w), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
|
|
1225
1275
|
if (a && r) {
|
|
1226
1276
|
t.preventDefault(), t.stopPropagation(), C(i, n, "edit", void 0, a), me(i, a);
|
|
1227
1277
|
return;
|
|
1228
1278
|
}
|
|
1229
|
-
a ? me(i, a) :
|
|
1230
|
-
}, document.addEventListener("click",
|
|
1279
|
+
a ? me(i, a) : K(i);
|
|
1280
|
+
}, document.addEventListener("click", X, !0)), J || (J = () => {
|
|
1231
1281
|
const t = A(void 0, !1) || g;
|
|
1232
1282
|
t && t.isConnected && D(t);
|
|
1233
|
-
}, document.addEventListener("selectionchange",
|
|
1283
|
+
}, document.addEventListener("selectionchange", J)), Q || (Q = (t) => {
|
|
1234
1284
|
const i = t.target?.closest(L);
|
|
1235
1285
|
if (!i) return;
|
|
1236
|
-
const n =
|
|
1286
|
+
const n = E.get(i) || ee || e;
|
|
1237
1287
|
ne(i, n.labels), D(i);
|
|
1238
|
-
}, document.addEventListener("input", Q, !0)),
|
|
1239
|
-
|
|
1240
|
-
}, window.addEventListener("scroll",
|
|
1288
|
+
}, document.addEventListener("input", Q, !0)), M || (M = () => {
|
|
1289
|
+
at();
|
|
1290
|
+
}, window.addEventListener("scroll", M, !0), window.addEventListener("resize", M));
|
|
1241
1291
|
}
|
|
1242
|
-
function
|
|
1243
|
-
U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null),
|
|
1292
|
+
function dt() {
|
|
1293
|
+
U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), X && (document.removeEventListener("click", X, !0), X = null), Y && (document.removeEventListener("mousedown", Y, !0), Y = null), J && (document.removeEventListener("selectionchange", J), J = null), Q && (document.removeEventListener("input", Q, !0), Q = null), M && (window.removeEventListener("scroll", M, !0), window.removeEventListener("resize", M), M = null), _.forEach((e) => {
|
|
1244
1294
|
e.remove();
|
|
1245
|
-
}), _.clear(),
|
|
1295
|
+
}), _.clear(), F.clear(), ee = null, g = null;
|
|
1246
1296
|
}
|
|
1247
|
-
const
|
|
1248
|
-
const t =
|
|
1249
|
-
return
|
|
1297
|
+
const ut = (e = {}) => {
|
|
1298
|
+
const t = Ze(e);
|
|
1299
|
+
return We(), {
|
|
1250
1300
|
name: "conditionalContent",
|
|
1251
1301
|
toolbar: [
|
|
1252
1302
|
{
|
|
@@ -1275,8 +1325,8 @@ const rt = (e = {}) => {
|
|
|
1275
1325
|
commands: {
|
|
1276
1326
|
conditionalContent: (o, i) => {
|
|
1277
1327
|
const n = A(i);
|
|
1278
|
-
if (!n ||
|
|
1279
|
-
g = n,
|
|
1328
|
+
if (!n || T(n)) return !1;
|
|
1329
|
+
g = n, E.set(n, t), ne(n, t.labels);
|
|
1280
1330
|
const a = o?.target;
|
|
1281
1331
|
if (a === "insert")
|
|
1282
1332
|
return C(n, t, "insert", o), !0;
|
|
@@ -1285,8 +1335,8 @@ const rt = (e = {}) => {
|
|
|
1285
1335
|
},
|
|
1286
1336
|
openConditionalDialog: (o, i) => {
|
|
1287
1337
|
const n = A(i);
|
|
1288
|
-
if (!n ||
|
|
1289
|
-
g = n,
|
|
1338
|
+
if (!n || T(n)) return !1;
|
|
1339
|
+
g = n, E.set(n, t), ne(n, t.labels);
|
|
1290
1340
|
const a = o?.target;
|
|
1291
1341
|
if (a === "insert")
|
|
1292
1342
|
return C(n, t, "insert", o), !0;
|
|
@@ -1296,47 +1346,47 @@ const rt = (e = {}) => {
|
|
|
1296
1346
|
conditionalPreview: async (o, i) => {
|
|
1297
1347
|
const n = A(i);
|
|
1298
1348
|
if (!n) return !1;
|
|
1299
|
-
g = n,
|
|
1300
|
-
const a = typeof o == "boolean" ? o :
|
|
1349
|
+
g = n, E.set(n, t);
|
|
1350
|
+
const a = typeof o == "boolean" ? o : k.get(n) !== !0;
|
|
1301
1351
|
return await Z(n, t, a), D(n), !0;
|
|
1302
1352
|
},
|
|
1303
1353
|
editConditionalBlock: (o, i) => {
|
|
1304
1354
|
const n = A(i);
|
|
1305
|
-
if (!n ||
|
|
1306
|
-
g = n,
|
|
1355
|
+
if (!n || T(n)) return !1;
|
|
1356
|
+
g = n, E.set(n, t);
|
|
1307
1357
|
const a = W(n);
|
|
1308
1358
|
return a ? (C(n, t, "edit", o, a), !0) : !1;
|
|
1309
1359
|
},
|
|
1310
1360
|
deleteConditionalBlock: (o, i) => {
|
|
1311
1361
|
const n = A(i);
|
|
1312
|
-
if (!n ||
|
|
1362
|
+
if (!n || T(n)) return !1;
|
|
1313
1363
|
const a = W(n);
|
|
1314
1364
|
if (!a) return !1;
|
|
1315
|
-
const r =
|
|
1365
|
+
const r = Pe(n, a);
|
|
1316
1366
|
return r && D(n), r;
|
|
1317
1367
|
},
|
|
1318
1368
|
insertConditionalBlock: (o, i) => {
|
|
1319
1369
|
const n = A(i);
|
|
1320
|
-
if (!n ||
|
|
1321
|
-
g = n,
|
|
1370
|
+
if (!n || T(n)) return !1;
|
|
1371
|
+
g = n, E.set(n, t);
|
|
1322
1372
|
const a = {
|
|
1323
1373
|
condition: o?.condition ?? t.defaultCondition,
|
|
1324
1374
|
audience: o?.audience ?? t.defaultAudience,
|
|
1325
1375
|
locale: o?.locale ?? t.defaultLocale,
|
|
1326
1376
|
hasElse: o?.hasElse ?? t.enableElseByDefault
|
|
1327
|
-
}, r =
|
|
1328
|
-
return
|
|
1377
|
+
}, r = He(a, t.labels);
|
|
1378
|
+
return De(n, r), k.get(n) === !0 && Z(n, t, !0), !0;
|
|
1329
1379
|
},
|
|
1330
1380
|
toggleConditionalPreview: async (o, i) => {
|
|
1331
1381
|
const n = A(i);
|
|
1332
1382
|
if (!n) return !1;
|
|
1333
|
-
g = n,
|
|
1334
|
-
const a = typeof o == "boolean" ? o :
|
|
1383
|
+
g = n, E.set(n, t);
|
|
1384
|
+
const a = typeof o == "boolean" ? o : k.get(n) !== !0;
|
|
1335
1385
|
return await Z(n, t, a), !0;
|
|
1336
1386
|
},
|
|
1337
1387
|
setConditionalContext: (o, i) => {
|
|
1338
1388
|
const n = A(i);
|
|
1339
|
-
return n ? (g = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o),
|
|
1389
|
+
return n ? (g = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o), k.get(n) === !0 && Z(n, t, !0), !0) : !1;
|
|
1340
1390
|
}
|
|
1341
1391
|
},
|
|
1342
1392
|
keymap: {
|
|
@@ -1348,13 +1398,13 @@ const rt = (e = {}) => {
|
|
|
1348
1398
|
F10: "toggleConditionalPreview"
|
|
1349
1399
|
},
|
|
1350
1400
|
init: () => {
|
|
1351
|
-
se += 1,
|
|
1401
|
+
se += 1, ct(t);
|
|
1352
1402
|
},
|
|
1353
1403
|
destroy: () => {
|
|
1354
|
-
se = Math.max(0, se - 1), se === 0 && (
|
|
1404
|
+
se = Math.max(0, se - 1), se === 0 && (Ne(), dt());
|
|
1355
1405
|
}
|
|
1356
1406
|
};
|
|
1357
1407
|
};
|
|
1358
1408
|
export {
|
|
1359
|
-
|
|
1409
|
+
ut as ConditionalContentPlugin
|
|
1360
1410
|
};
|