monto-email-builder 1.4.4 → 1.4.5
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/HtmlEditor/variables.d.ts.map +1 -1
- package/dist/chunks/{chunk-CT9uNEVC.js → chunk-BN0O7D8l.js} +186 -181
- package/dist/documents/blocks/Text/textDom.d.ts.map +1 -1
- package/dist/documents/blocks/Text/variableCatalog.d.ts +1 -1
- package/dist/documents/blocks/Text/variableCatalog.d.ts.map +1 -1
- package/dist/documents/editor/collectTemplateVariables.d.ts.map +1 -1
- package/dist/html-editor.js +268 -267
- package/dist/index.js +1195 -1182
- package/package.json +1 -1
package/dist/html-editor.js
CHANGED
|
@@ -1,171 +1,172 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { forwardRef as ut, useState as V, useRef as $, useEffect as G, useCallback as L, useMemo as J, useImperativeHandle as
|
|
3
|
-
import
|
|
4
|
-
import { html as
|
|
5
|
-
import { xcodeDark as
|
|
1
|
+
import { jsx as r, jsxs as g, Fragment as Ot } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ut, useState as V, useRef as $, useEffect as G, useCallback as L, useMemo as J, useImperativeHandle as Pt } from "react";
|
|
3
|
+
import _t from "@uiw/react-codemirror";
|
|
4
|
+
import { html as Wt } from "@codemirror/lang-html";
|
|
5
|
+
import { xcodeDark as jt, tomorrowNightBlue as Gt, dracula as mt, basicDark as qt, abcdef as Ut, bbedit as Yt, noctisLilac as Kt, gruvboxLight as Xt, tokyoNightDay as Jt, vscodeLight as Qt, xcodeLight as Zt } from "@uiw/codemirror-themes-all";
|
|
6
6
|
import Q from "@mui/material/ToggleButton";
|
|
7
7
|
import et from "@mui/material/ToggleButtonGroup";
|
|
8
|
-
import { ThemeProvider as
|
|
8
|
+
import { ThemeProvider as er, ScopedCssBaseline as tr, useTheme as rr, Box as h, Tooltip as q, FormControl as or, InputLabel as ar, Select as nr, ListSubheader as tt, MenuItem as rt, Button as Ie, Tabs as ir, Tab as ot, Typography as k, Accordion as lr, AccordionSummary as sr, AccordionDetails as cr, TextField as Ee, Divider as dr } from "@mui/material";
|
|
9
9
|
import { alpha as de } from "@mui/material/styles";
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
10
|
+
import * as ur from "@mui/icons-material/AddOutlined";
|
|
11
|
+
import * as mr from "@mui/icons-material/Code";
|
|
12
|
+
import * as hr from "@mui/icons-material/DataObjectOutlined";
|
|
13
|
+
import * as br from "@mui/icons-material/ExpandMoreOutlined";
|
|
14
|
+
import * as pr from "@mui/icons-material/HelpOutlined";
|
|
15
|
+
import * as fr from "@mui/icons-material/Visibility";
|
|
16
|
+
import * as gr from "@mui/icons-material/ViewColumn";
|
|
17
17
|
import * as xr from "@mui/icons-material/MonitorOutlined";
|
|
18
|
-
import * as
|
|
19
|
-
import { B as
|
|
20
|
-
const Ve =
|
|
21
|
-
function
|
|
22
|
-
return n
|
|
18
|
+
import * as vr from "@mui/icons-material/PhoneIphoneOutlined";
|
|
19
|
+
import { B as yr, V as F, i as ht, r as B, T as Ir, a as at, t as Er } from "./chunks/chunk-BN0O7D8l.js";
|
|
20
|
+
const Ve = yr, nt = "unsubscribe_link", Ce = /\{\{\s*([^{}]+?)\s*\}\}/g, it = /\{%\s*([^{}%]+?)\s*%\}/g;
|
|
21
|
+
function Te(a, n, l, u, d) {
|
|
22
|
+
return a[n - 1] !== u && a[l] !== d;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function bt(a, n = "user") {
|
|
25
|
+
return n === "builtin" || n === "system" ? `{%${a}%}` : `{{${a}}}`;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
if (F.test(
|
|
27
|
+
function Vr(a) {
|
|
28
|
+
const n = typeof a == "string" ? a.trim() : "";
|
|
29
|
+
if (n.startsWith("{{") && n.endsWith("}}")) {
|
|
30
|
+
const l = n.slice(2, -2).trim();
|
|
31
|
+
if (F.test(l))
|
|
32
|
+
return { attribute: l, type: ht(l) ? "system" : "user" };
|
|
32
33
|
}
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
if (F.test(
|
|
34
|
+
if (n.startsWith("{%") && n.endsWith("%}")) {
|
|
35
|
+
const l = n.slice(2, -2).trim();
|
|
36
|
+
if (F.test(l)) return { attribute: l, type: "system" };
|
|
36
37
|
}
|
|
37
38
|
return null;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
40
|
+
function Cr(a, n) {
|
|
41
|
+
const l = a.variable ?? a.Variable ?? a.key ?? "", u = Vr(l), x = (a.type ?? a.Type ?? (u == null ? void 0 : u.type) ?? (ht(String(a.attribute ?? a.Attribute ?? (u == null ? void 0 : u.attribute) ?? "")) ? "system" : "user")) === "system" ? "system" : "user", i = a.attribute ?? a.Attribute ?? (u == null ? void 0 : u.attribute) ?? "", m = String(i).trim();
|
|
41
42
|
return !m || !F.test(m) ? null : {
|
|
42
|
-
id: Number(
|
|
43
|
-
variableInstanceId:
|
|
44
|
-
variable:
|
|
45
|
-
type:
|
|
43
|
+
id: Number(a.id) || n + 1,
|
|
44
|
+
variableInstanceId: a.variableInstanceId ?? a.VariableInstanceId,
|
|
45
|
+
variable: x === "system" ? `{%${m}%}` : `{{${m}}}`,
|
|
46
|
+
type: x,
|
|
46
47
|
attribute: m,
|
|
47
|
-
default: String(
|
|
48
|
+
default: String(a.default ?? a.Default ?? a.value ?? "")
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
function lt(
|
|
51
|
-
return Array.isArray(
|
|
52
|
-
...
|
|
53
|
-
id:
|
|
54
|
-
variableInstanceId:
|
|
51
|
+
function lt(a) {
|
|
52
|
+
return Array.isArray(a) ? a.map((n, l) => Cr(n, l)).filter((n) => !!n).map((n, l) => ({
|
|
53
|
+
...n,
|
|
54
|
+
id: l + 1,
|
|
55
|
+
variableInstanceId: n.variableInstanceId || He(n.type, n.attribute, l)
|
|
55
56
|
})) : [];
|
|
56
57
|
}
|
|
57
|
-
function Z(
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
function Z(a) {
|
|
59
|
+
const n = a || "", l = [], u = (i, m, f) => {
|
|
60
|
+
l.push({ attribute: i, type: m, start: f });
|
|
60
61
|
};
|
|
61
62
|
let d;
|
|
62
|
-
for (
|
|
63
|
+
for (Ce.lastIndex = 0; d = Ce.exec(n); ) {
|
|
63
64
|
const i = d.index, m = i + d[0].length;
|
|
64
|
-
if (!
|
|
65
|
+
if (!Te(n, i, m, "{", "}")) continue;
|
|
65
66
|
const f = d[1].trim();
|
|
66
67
|
!f || !F.test(f) || u(f, "user", i);
|
|
67
68
|
}
|
|
68
|
-
let
|
|
69
|
-
for (it.lastIndex = 0;
|
|
70
|
-
const i =
|
|
71
|
-
if (!
|
|
72
|
-
const f =
|
|
69
|
+
let x;
|
|
70
|
+
for (it.lastIndex = 0; x = it.exec(n); ) {
|
|
71
|
+
const i = x.index, m = i + x[0].length;
|
|
72
|
+
if (!Te(n, i, m, "{", "}")) continue;
|
|
73
|
+
const f = x[1].trim();
|
|
73
74
|
!f || !F.test(f) || u(f, "system", i);
|
|
74
75
|
}
|
|
75
|
-
return
|
|
76
|
+
return l.sort((i, m) => i.start - m.start), l.map((i, m) => ({
|
|
76
77
|
id: m + 1,
|
|
77
|
-
variableInstanceId:
|
|
78
|
+
variableInstanceId: Sr(i.type, i.attribute, i.start),
|
|
78
79
|
variable: i.type === "system" ? `{%${i.attribute}%}` : `{{${i.attribute}}}`,
|
|
79
80
|
type: i.type,
|
|
80
81
|
attribute: i.attribute,
|
|
81
82
|
default: ""
|
|
82
83
|
}));
|
|
83
84
|
}
|
|
84
|
-
function ue(
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
const
|
|
85
|
+
function ue(a, n) {
|
|
86
|
+
const l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
87
|
+
return n.forEach((d) => {
|
|
88
|
+
const x = { item: d, consumed: !1 };
|
|
88
89
|
if (d.variableInstanceId) {
|
|
89
|
-
const f =
|
|
90
|
-
f.push(
|
|
90
|
+
const f = l.get(d.variableInstanceId) ?? [];
|
|
91
|
+
f.push(x), l.set(d.variableInstanceId, f);
|
|
91
92
|
}
|
|
92
93
|
const i = `${d.type}:${d.attribute}`, m = u.get(i) ?? [];
|
|
93
|
-
m.push(
|
|
94
|
-
}),
|
|
95
|
-
var
|
|
96
|
-
const i = `${d.type}:${d.attribute}`, m = d.variableInstanceId ? (
|
|
94
|
+
m.push(x), u.set(i, m);
|
|
95
|
+
}), a.map((d, x) => {
|
|
96
|
+
var N;
|
|
97
|
+
const i = `${d.type}:${d.attribute}`, m = d.variableInstanceId ? (N = l.get(d.variableInstanceId)) == null ? void 0 : N.find((v) => !v.consumed) : void 0, f = (u.get(i) ?? []).find((v) => !v.consumed), H = m ?? f;
|
|
97
98
|
return H && (H.consumed = !0), {
|
|
98
99
|
...d,
|
|
99
|
-
id:
|
|
100
|
-
variableInstanceId: d.variableInstanceId || He(d.type, d.attribute,
|
|
100
|
+
id: x + 1,
|
|
101
|
+
variableInstanceId: d.variableInstanceId || He(d.type, d.attribute, x),
|
|
101
102
|
default: d.type === "system" ? "" : (H == null ? void 0 : H.item.default) ?? d.default ?? ""
|
|
102
103
|
};
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
|
-
function Tr(
|
|
106
|
-
return
|
|
106
|
+
function Tr(a) {
|
|
107
|
+
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
107
108
|
}
|
|
108
|
-
function st(
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
i.type === "user" && (i.variableInstanceId &&
|
|
109
|
+
function st(a, n) {
|
|
110
|
+
const l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
111
|
+
n.forEach((i) => {
|
|
112
|
+
i.type === "user" && (i.variableInstanceId && l.set(i.variableInstanceId, i.default ?? ""), u.has(i.attribute) || u.set(i.attribute, i.default ?? ""));
|
|
112
113
|
});
|
|
113
|
-
const d = Z(
|
|
114
|
+
const d = Z(a), x = /* @__PURE__ */ new Map();
|
|
114
115
|
return d.forEach((i) => {
|
|
115
116
|
const m = Number(String(i.variableInstanceId ?? "").split("-at-")[1]);
|
|
116
|
-
Number.isFinite(m) &&
|
|
117
|
-
}), (
|
|
117
|
+
Number.isFinite(m) && x.set(m, i);
|
|
118
|
+
}), (a || "").replace(Ce, (i, m, f, H) => {
|
|
118
119
|
var ee;
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
120
|
+
const N = f + i.length;
|
|
121
|
+
if (!Te(H, f, N, "{", "}")) return i;
|
|
121
122
|
const v = String(m).trim();
|
|
122
123
|
if (!v || !F.test(v)) return i;
|
|
123
|
-
const R = (ee =
|
|
124
|
-
return
|
|
124
|
+
const R = (ee = x.get(f)) == null ? void 0 : ee.variableInstanceId, z = (R ? l.get(R) : void 0) ?? (n.filter((s) => s.type === "user" && s.attribute === v).length === 1 ? u.get(v) : void 0);
|
|
125
|
+
return z === void 0 || z === "" ? i : Tr(z);
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
|
-
function ct(
|
|
128
|
-
const u =
|
|
128
|
+
function ct(a, n, l = "") {
|
|
129
|
+
const u = a.trim();
|
|
129
130
|
if (!u || !F.test(u)) return null;
|
|
130
|
-
const d =
|
|
131
|
+
const d = n === "builtin" ? "system" : "user";
|
|
131
132
|
return {
|
|
132
133
|
id: 1,
|
|
133
134
|
variableInstanceId: He(d, u, 0),
|
|
134
|
-
variable:
|
|
135
|
+
variable: bt(u, n),
|
|
135
136
|
type: d,
|
|
136
137
|
attribute: u,
|
|
137
|
-
default: d === "system" ? "" :
|
|
138
|
+
default: d === "system" ? "" : l
|
|
138
139
|
};
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
return
|
|
141
|
+
function wr(a) {
|
|
142
|
+
const n = a.trim();
|
|
143
|
+
return n ? Ve.some((l) => l.items.some((u) => u.name === n)) : !1;
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
-
const
|
|
146
|
-
return
|
|
145
|
+
function Hr(a, n) {
|
|
146
|
+
const l = a.trim();
|
|
147
|
+
return n === "builtin" && l === nt ? `<a href="{%${nt}%}">Unsubscribe Link</a>` : bt(l, n);
|
|
147
148
|
}
|
|
148
|
-
function He(
|
|
149
|
-
return `html-${
|
|
149
|
+
function He(a, n, l) {
|
|
150
|
+
return `html-${a}-${n}-${l + 1}`;
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
-
return `html-${
|
|
152
|
+
function Sr(a, n, l) {
|
|
153
|
+
return `html-${a}-${n}-at-${l}`;
|
|
153
154
|
}
|
|
154
|
-
const
|
|
155
|
+
const Dr = B(ur), Mr = B(mr), Lr = B(hr), kr = B(br), Br = B(pr), Ar = B(fr), Fr = B(gr), Rr = B(xr), $r = B(vr), we = {
|
|
155
156
|
// 浅色主题
|
|
156
|
-
xcodeLight:
|
|
157
|
-
vscodeLight:
|
|
158
|
-
tokyoNightDay:
|
|
159
|
-
gruvboxLight:
|
|
160
|
-
noctisLilac:
|
|
161
|
-
bbedit:
|
|
157
|
+
xcodeLight: Zt,
|
|
158
|
+
vscodeLight: Qt,
|
|
159
|
+
tokyoNightDay: Jt,
|
|
160
|
+
gruvboxLight: Xt,
|
|
161
|
+
noctisLilac: Kt,
|
|
162
|
+
bbedit: Yt,
|
|
162
163
|
// 深色主题
|
|
163
|
-
abcdef:
|
|
164
|
-
basicDark:
|
|
164
|
+
abcdef: Ut,
|
|
165
|
+
basicDark: qt,
|
|
165
166
|
dracula: mt,
|
|
166
|
-
tomorrowNightBlue:
|
|
167
|
-
xcodeDark:
|
|
168
|
-
},
|
|
167
|
+
tomorrowNightBlue: Gt,
|
|
168
|
+
xcodeDark: jt
|
|
169
|
+
}, Nr = {
|
|
169
170
|
xcodeLight: "Xcode Light (Light)",
|
|
170
171
|
vscodeLight: "VSCode Light (Light)",
|
|
171
172
|
tokyoNightDay: "Tokyo Night Day (Light)",
|
|
@@ -178,56 +179,56 @@ const Sr = B(dr), Dr = B(ur), Mr = B(mr), Lr = B(hr), kr = B(br), Br = B(pr), Ar
|
|
|
178
179
|
dracula: "Dracula (Dark)",
|
|
179
180
|
tomorrowNightBlue: "Tomorrow Night Blue (Dark)",
|
|
180
181
|
xcodeDark: "Xcode Dark (Dark)"
|
|
181
|
-
},
|
|
182
|
-
function
|
|
183
|
-
const
|
|
184
|
-
if (typeof window > "u") return
|
|
182
|
+
}, pt = "html-editor-theme", dt = "dracula";
|
|
183
|
+
function Or(a = dt) {
|
|
184
|
+
const n = a && we[a] ? a : dt;
|
|
185
|
+
if (typeof window > "u") return n;
|
|
185
186
|
try {
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
187
|
+
const l = localStorage.getItem(pt);
|
|
188
|
+
if (l && we[l]) return l;
|
|
188
189
|
} catch {
|
|
189
190
|
console.error("Failed to get HTML Editor stored theme");
|
|
190
191
|
}
|
|
191
|
-
return
|
|
192
|
+
return n;
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function Pr(a) {
|
|
194
195
|
try {
|
|
195
|
-
localStorage.setItem(
|
|
196
|
+
localStorage.setItem(pt, a);
|
|
196
197
|
} catch {
|
|
197
|
-
console.error("Failed to set HTML Editor stored theme",
|
|
198
|
+
console.error("Failed to set HTML Editor stored theme", a);
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
-
value:
|
|
202
|
-
onChange:
|
|
203
|
-
language:
|
|
201
|
+
function _r({
|
|
202
|
+
value: a,
|
|
203
|
+
onChange: n,
|
|
204
|
+
language: l = "zh",
|
|
204
205
|
initialMode: u = "split",
|
|
205
206
|
initialDevice: d = "desktop",
|
|
206
|
-
codeEditorHeight:
|
|
207
|
+
codeEditorHeight: x = "100%",
|
|
207
208
|
previewHeight: i = "100%",
|
|
208
209
|
sx: m,
|
|
209
210
|
showToolbar: f = !0,
|
|
210
211
|
initialTheme: H,
|
|
211
|
-
initialRightTab:
|
|
212
|
+
initialRightTab: N = "preview",
|
|
212
213
|
variables: v,
|
|
213
214
|
onVariablesChange: R,
|
|
214
|
-
requireVariableDefaults:
|
|
215
|
+
requireVariableDefaults: z = !0
|
|
215
216
|
}, ee) {
|
|
216
|
-
var Re, $e,
|
|
217
|
-
const
|
|
217
|
+
var Re, $e, Ne, ze, Oe, Pe, _e, We, je, Ge, qe, Ue, Ye, Ke, Xe, Je, Qe, Ze;
|
|
218
|
+
const s = (e, t) => Er(e, t, l), [S, gt] = V(u), [O, xt] = V(d), [Se, vt] = V(() => Or(H)), [E, me] = V(a), [te, P] = V(N), [w, he] = V(() => lt(v)), [yt, It] = V(!1), [Et, Vt] = V(null), [_, De] = V(""), [W, Me] = V(""), [be, re] = V(!1), [pe, oe] = V(!1), U = $(null), fe = $(null), C = $(w), Le = $(null), ke = $(null), ge = $(!1), ae = $(null);
|
|
218
219
|
G(() => {
|
|
219
|
-
|
|
220
|
-
}, [
|
|
220
|
+
a !== E && me(a);
|
|
221
|
+
}, [a]), G(() => {
|
|
221
222
|
if (v === void 0) return;
|
|
222
223
|
const e = lt(v);
|
|
223
|
-
|
|
224
|
+
C.current = e, he(e);
|
|
224
225
|
}, [v]), G(() => {
|
|
225
226
|
if (v !== void 0) return;
|
|
226
|
-
const e = Z(E), t = ue(e,
|
|
227
|
-
(t.length !==
|
|
228
|
-
const b =
|
|
227
|
+
const e = Z(E), t = ue(e, C.current);
|
|
228
|
+
(t.length !== C.current.length || t.some((c, y) => {
|
|
229
|
+
const b = C.current[y];
|
|
229
230
|
return !b || b.variableInstanceId !== c.variableInstanceId || b.attribute !== c.attribute || b.type !== c.type || b.default !== c.default;
|
|
230
|
-
})) && (
|
|
231
|
+
})) && (C.current = t, he(t));
|
|
231
232
|
}, [E, v]);
|
|
232
233
|
const A = L(
|
|
233
234
|
(e) => {
|
|
@@ -236,45 +237,45 @@ function Pr({
|
|
|
236
237
|
id: c + 1,
|
|
237
238
|
default: o.type === "system" ? "" : o.default ?? ""
|
|
238
239
|
}));
|
|
239
|
-
return
|
|
240
|
+
return C.current = t, he(t), R == null || R(t), t;
|
|
240
241
|
},
|
|
241
242
|
[R]
|
|
242
243
|
), D = L(() => {
|
|
243
244
|
var t, o;
|
|
244
245
|
const e = (o = (t = fe.current) == null ? void 0 : t.state) == null ? void 0 : o.doc;
|
|
245
246
|
return e && typeof e.toString == "function" ? e.toString() : E;
|
|
246
|
-
}, [E]),
|
|
247
|
+
}, [E]), xe = (e) => {
|
|
247
248
|
me(e), U.current && clearTimeout(U.current), U.current = setTimeout(() => {
|
|
248
|
-
|
|
249
|
+
n == null || n(e);
|
|
249
250
|
}, 300);
|
|
250
251
|
}, Y = L(
|
|
251
252
|
(e) => {
|
|
252
|
-
const t = Z(e ?? D()), o = ue(t,
|
|
253
|
+
const t = Z(e ?? D()), o = ue(t, C.current);
|
|
253
254
|
return A(o);
|
|
254
255
|
},
|
|
255
256
|
[D, A]
|
|
256
|
-
),
|
|
257
|
+
), ne = L(() => {
|
|
257
258
|
const e = D();
|
|
258
259
|
e !== E && me(e);
|
|
259
|
-
const t = Y(e), o =
|
|
260
|
-
(c) => c.type === "user" &&
|
|
260
|
+
const t = Y(e), o = z ? t.filter(
|
|
261
|
+
(c) => c.type === "user" && at(c.attribute, "user") && c.default.trim() === ""
|
|
261
262
|
) : [];
|
|
262
|
-
return
|
|
263
|
+
return It(o.length > 0), o.length > 0 && P("variables"), {
|
|
263
264
|
valid: o.length === 0,
|
|
264
265
|
variables: t,
|
|
265
266
|
missing: o
|
|
266
267
|
};
|
|
267
|
-
}, [D, E,
|
|
268
|
-
|
|
269
|
-
}, [
|
|
268
|
+
}, [D, E, z, Y]), Ct = L(() => {
|
|
269
|
+
ge.current = !0, ne(), P("variables");
|
|
270
|
+
}, [ne]);
|
|
270
271
|
G(() => {
|
|
271
|
-
if (te !== "variables" || !
|
|
272
|
+
if (te !== "variables" || !ge.current) return;
|
|
272
273
|
const e = window.requestAnimationFrame(() => {
|
|
273
274
|
const t = Le.current, o = ke.current;
|
|
274
275
|
t && o && t.scrollTo({
|
|
275
276
|
top: Math.max(o.offsetTop - 8, 0),
|
|
276
277
|
behavior: "auto"
|
|
277
|
-
}),
|
|
278
|
+
}), ge.current = !1;
|
|
278
279
|
});
|
|
279
280
|
return () => window.cancelAnimationFrame(e);
|
|
280
281
|
}, [te, w.length]), G(() => () => {
|
|
@@ -287,8 +288,8 @@ function Pr({
|
|
|
287
288
|
if (!t.trim())
|
|
288
289
|
o = "<!DOCTYPE html><html><head></head><body></body></html>";
|
|
289
290
|
else {
|
|
290
|
-
const M = new DOMParser().parseFromString(t, "text/html"), ye = ((p = M.documentElement) == null ? void 0 : p.tagName.toLowerCase()) === "html",
|
|
291
|
-
if (!ye ||
|
|
291
|
+
const M = new DOMParser().parseFromString(t, "text/html"), ye = ((p = M.documentElement) == null ? void 0 : p.tagName.toLowerCase()) === "html", $t = ((I = M.head) == null ? void 0 : I.tagName.toLowerCase()) === "head", Nt = ((K = M.body) == null ? void 0 : K.tagName.toLowerCase()) === "body";
|
|
292
|
+
if (!ye || !$t || !Nt) {
|
|
292
293
|
const zt = M.body ? M.body.innerHTML : t;
|
|
293
294
|
o = `<!DOCTYPE html><html><head>${M.head ? M.head.innerHTML : ""}</head><body>${zt}</body></html>`;
|
|
294
295
|
} else
|
|
@@ -302,26 +303,26 @@ function Pr({
|
|
|
302
303
|
() => st(E, w),
|
|
303
304
|
[w, E]
|
|
304
305
|
), ie = J(() => Tt(Be), [Be]);
|
|
305
|
-
|
|
306
|
+
Pt(
|
|
306
307
|
ee,
|
|
307
308
|
() => ({
|
|
308
309
|
getValue: () => D(),
|
|
309
|
-
getPreviewHtml: () => st(D(),
|
|
310
|
+
getPreviewHtml: () => st(D(), C.current),
|
|
310
311
|
scanVariables: () => Y(D()),
|
|
311
312
|
getVariables: (e) => {
|
|
312
313
|
const t = Y(D());
|
|
313
314
|
return e == null || e(t), t;
|
|
314
315
|
},
|
|
315
|
-
validateVariables:
|
|
316
|
+
validateVariables: ne,
|
|
316
317
|
showVariables: () => P("variables")
|
|
317
318
|
}),
|
|
318
|
-
[D, Y,
|
|
319
|
+
[D, Y, ne]
|
|
319
320
|
), G(() => {
|
|
320
|
-
|
|
321
|
+
ae.current && ae.current.srcdoc !== ie && (ae.current.srcdoc = ie);
|
|
321
322
|
}, [ie]);
|
|
322
|
-
const
|
|
323
|
-
t !== null &&
|
|
324
|
-
},
|
|
323
|
+
const wt = (e, t) => {
|
|
324
|
+
t !== null && gt(t);
|
|
325
|
+
}, Ht = (e, t) => {
|
|
325
326
|
(t === "desktop" || t === "mobile") && xt(t);
|
|
326
327
|
}, le = L(
|
|
327
328
|
(e) => {
|
|
@@ -332,15 +333,15 @@ function Pr({
|
|
|
332
333
|
return t.dispatch({
|
|
333
334
|
changes: { from: I, to: K, insert: e },
|
|
334
335
|
selection: { anchor: I + e.length }
|
|
335
|
-
}), (y = t.focus) == null || y.call(t),
|
|
336
|
+
}), (y = t.focus) == null || y.call(t), xe(X), X;
|
|
336
337
|
}
|
|
337
338
|
const o = `${E}${e}`;
|
|
338
|
-
return
|
|
339
|
+
return xe(o), o;
|
|
339
340
|
},
|
|
340
341
|
[E]
|
|
341
|
-
),
|
|
342
|
+
), St = L(
|
|
342
343
|
(e, t) => {
|
|
343
|
-
const o =
|
|
344
|
+
const o = C.current;
|
|
344
345
|
A(
|
|
345
346
|
o.map(
|
|
346
347
|
(c) => c.variableInstanceId === e ? { ...c, default: t } : c
|
|
@@ -348,22 +349,22 @@ function Pr({
|
|
|
348
349
|
);
|
|
349
350
|
},
|
|
350
351
|
[A]
|
|
351
|
-
),
|
|
352
|
+
), Dt = L(
|
|
352
353
|
(e, t) => {
|
|
353
354
|
if (!ct(e, t)) return;
|
|
354
|
-
const c = le(
|
|
355
|
+
const c = le(Hr(e, t)), y = Z(c), b = ue(y, C.current);
|
|
355
356
|
A(b), P("variables");
|
|
356
357
|
},
|
|
357
358
|
[le, A]
|
|
358
359
|
), se = J(() => {
|
|
359
360
|
const e = _.trim();
|
|
360
|
-
return e ? F.test(e) ?
|
|
361
|
-
}, [_, w]),
|
|
361
|
+
return e ? F.test(e) ? wr(e) || w.some((t) => t.type === "user" && t.attribute === e) ? s("text.variables.customVariableNameDuplicate") : "" : s("text.variables.customVariableNameInvalid") : s("text.variables.customVariableNameRequired");
|
|
362
|
+
}, [_, w]), Mt = L(() => {
|
|
362
363
|
const e = W.trim();
|
|
363
364
|
if (re(!0), oe(!0), se || e === "") return;
|
|
364
365
|
const t = ct(_.trim(), "user", e);
|
|
365
366
|
if (!t) return;
|
|
366
|
-
const o = le(t.variable), c = Z(o), y = ue(c,
|
|
367
|
+
const o = le(t.variable), c = Z(o), y = ue(c, C.current);
|
|
367
368
|
let b = -1;
|
|
368
369
|
for (let p = y.length - 1; p >= 0; p -= 1) {
|
|
369
370
|
const I = y[p];
|
|
@@ -377,7 +378,7 @@ function Pr({
|
|
|
377
378
|
(p, I) => I === b ? { ...p, default: t.default } : p
|
|
378
379
|
)
|
|
379
380
|
), De(""), Me(""), re(!1), oe(!1), P("variables");
|
|
380
|
-
}, [W, _, se, le, A]),
|
|
381
|
+
}, [W, _, se, le, A]), Lt = J(() => {
|
|
381
382
|
const e = /* @__PURE__ */ new Set();
|
|
382
383
|
return [{ id: "custom", items: w.filter((o) => o.type === "user").filter((o) => !Ve.some((c) => c.items.some((y) => y.name === o.attribute))).filter((o) => e.has(o.attribute) ? !1 : (e.add(o.attribute), !0)).map((o) => ({
|
|
383
384
|
name: o.attribute,
|
|
@@ -387,8 +388,8 @@ function Pr({
|
|
|
387
388
|
}, [w]), ce = J(
|
|
388
389
|
() => w.filter((e) => e.type !== "system"),
|
|
389
390
|
[w]
|
|
390
|
-
),
|
|
391
|
-
($e = (Re =
|
|
391
|
+
), kt = (e) => e === "custom" ? "text.variables.groupCustom" : e === "contacts" ? "text.variables.groupContacts" : e === "email" ? "text.variables.groupEmail" : e === "organization" ? "text.variables.groupOrganization" : e === "date" ? "text.variables.groupDate" : "text.variables.groupLinks", T = rr(), Bt = O === "desktop" || O === "mobile" ? O : "desktop", At = S === "split" || S === "code" || S === "preview" ? S : "split";
|
|
392
|
+
($e = (Re = T.palette) == null ? void 0 : Re.action) == null || $e.selected, (ze = (Ne = T.palette) == null ? void 0 : Ne.primary) == null || ze.main, (Pe = (Oe = T.palette) == null ? void 0 : Oe.action) == null || Pe.selected, (We = (_e = T.palette) == null ? void 0 : _e.background) == null || We.paper, (Ge = (je = T.palette) == null ? void 0 : je.text) == null || Ge.primary, (Ue = (qe = T.palette) == null ? void 0 : qe.action) == null || Ue.hover;
|
|
392
393
|
const j = {
|
|
393
394
|
tooltip: {
|
|
394
395
|
sx: {
|
|
@@ -396,12 +397,12 @@ function Pr({
|
|
|
396
397
|
fontWeight: 400,
|
|
397
398
|
lineHeight: 1.45,
|
|
398
399
|
maxWidth: 360,
|
|
399
|
-
backgroundColor: de(((Ke = (Ye =
|
|
400
|
-
color: ((Je = (Xe =
|
|
400
|
+
backgroundColor: de(((Ke = (Ye = T.palette) == null ? void 0 : Ye.text) == null ? void 0 : Ke.primary) ?? "#1F1F21", 0.9),
|
|
401
|
+
color: ((Je = (Xe = T.palette) == null ? void 0 : Xe.common) == null ? void 0 : Je.white) ?? "#fff"
|
|
401
402
|
}
|
|
402
403
|
},
|
|
403
404
|
arrow: {
|
|
404
|
-
sx: { color: de(((Ze = (Qe =
|
|
405
|
+
sx: { color: de(((Ze = (Qe = T.palette) == null ? void 0 : Qe.text) == null ? void 0 : Ze.primary) ?? "#1F1F21", 0.9) }
|
|
405
406
|
}
|
|
406
407
|
}, ve = {
|
|
407
408
|
component: "div",
|
|
@@ -411,11 +412,11 @@ function Pr({
|
|
|
411
412
|
minHeight: 18,
|
|
412
413
|
lineHeight: 1.5
|
|
413
414
|
}
|
|
414
|
-
}, Ae = () => /* @__PURE__ */
|
|
415
|
+
}, Ae = () => /* @__PURE__ */ g(
|
|
415
416
|
h,
|
|
416
417
|
{
|
|
417
418
|
sx: {
|
|
418
|
-
height:
|
|
419
|
+
height: x,
|
|
419
420
|
minHeight: 0,
|
|
420
421
|
display: "flex",
|
|
421
422
|
flexDirection: "column",
|
|
@@ -456,13 +457,13 @@ function Pr({
|
|
|
456
457
|
}
|
|
457
458
|
},
|
|
458
459
|
children: /* @__PURE__ */ r(
|
|
459
|
-
|
|
460
|
+
_t,
|
|
460
461
|
{
|
|
461
462
|
value: E,
|
|
462
463
|
height: "100%",
|
|
463
|
-
extensions: [
|
|
464
|
+
extensions: [Wt()],
|
|
464
465
|
theme: we[Se] || mt,
|
|
465
|
-
onChange:
|
|
466
|
+
onChange: xe,
|
|
466
467
|
onCreateEditor: (e) => {
|
|
467
468
|
fe.current = e;
|
|
468
469
|
},
|
|
@@ -481,8 +482,8 @@ function Pr({
|
|
|
481
482
|
{
|
|
482
483
|
size: "small",
|
|
483
484
|
variant: "contained",
|
|
484
|
-
startIcon: /* @__PURE__ */ r(
|
|
485
|
-
onClick:
|
|
485
|
+
startIcon: /* @__PURE__ */ r(Lr, { fontSize: "small" }),
|
|
486
|
+
onClick: Ct,
|
|
486
487
|
sx: {
|
|
487
488
|
position: "absolute",
|
|
488
489
|
right: 16,
|
|
@@ -491,12 +492,12 @@ function Pr({
|
|
|
491
492
|
textTransform: "none",
|
|
492
493
|
boxShadow: 3
|
|
493
494
|
},
|
|
494
|
-
children:
|
|
495
|
+
children: s("common.save")
|
|
495
496
|
}
|
|
496
497
|
)
|
|
497
498
|
]
|
|
498
499
|
}
|
|
499
|
-
),
|
|
500
|
+
), Ft = () => /* @__PURE__ */ r(h, { sx: {
|
|
500
501
|
height: i,
|
|
501
502
|
overflow: "auto",
|
|
502
503
|
backgroundColor: "#F5F5F5",
|
|
@@ -516,7 +517,7 @@ function Pr({
|
|
|
516
517
|
children: /* @__PURE__ */ r(
|
|
517
518
|
"iframe",
|
|
518
519
|
{
|
|
519
|
-
ref:
|
|
520
|
+
ref: ae,
|
|
520
521
|
srcDoc: ie,
|
|
521
522
|
style: {
|
|
522
523
|
width: "100%",
|
|
@@ -529,7 +530,7 @@ function Pr({
|
|
|
529
530
|
}
|
|
530
531
|
)
|
|
531
532
|
}
|
|
532
|
-
) }),
|
|
533
|
+
) }), Rt = () => /* @__PURE__ */ g(
|
|
533
534
|
h,
|
|
534
535
|
{
|
|
535
536
|
ref: Le,
|
|
@@ -544,23 +545,23 @@ function Pr({
|
|
|
544
545
|
pb: 6
|
|
545
546
|
},
|
|
546
547
|
children: [
|
|
547
|
-
/* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: /* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */ r(k, { variant: "subtitle1", sx: { fontWeight: 700 }, children:
|
|
550
|
-
/* @__PURE__ */ r(q, { title:
|
|
548
|
+
/* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: /* @__PURE__ */ g(h, { sx: { minWidth: 0 }, children: [
|
|
549
|
+
/* @__PURE__ */ g(h, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
|
|
550
|
+
/* @__PURE__ */ r(k, { variant: "subtitle1", sx: { fontWeight: 700 }, children: s("htmlEditor.variables.title") }),
|
|
551
|
+
/* @__PURE__ */ r(q, { title: s("htmlEditor.variables.help"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(h, { component: "span", sx: { display: "inline-flex", color: "text.secondary", cursor: "help" }, children: /* @__PURE__ */ r(Br, { fontSize: "small" }) }) })
|
|
551
552
|
] }),
|
|
552
|
-
/* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.secondary", children:
|
|
553
|
+
/* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.secondary", children: s("htmlEditor.variables.scanHint") })
|
|
553
554
|
] }) }),
|
|
554
|
-
/* @__PURE__ */ r(h, { sx: { mb: 2 }, children:
|
|
555
|
-
const t =
|
|
556
|
-
return /* @__PURE__ */
|
|
557
|
-
|
|
555
|
+
/* @__PURE__ */ r(h, { sx: { mb: 2 }, children: Lt.map((e) => {
|
|
556
|
+
const t = Et === e.id;
|
|
557
|
+
return /* @__PURE__ */ g(
|
|
558
|
+
lr,
|
|
558
559
|
{
|
|
559
560
|
disableGutters: !0,
|
|
560
561
|
square: !0,
|
|
561
562
|
elevation: 0,
|
|
562
563
|
expanded: t,
|
|
563
|
-
onChange: (o, c) =>
|
|
564
|
+
onChange: (o, c) => Vt(c ? e.id : null),
|
|
564
565
|
sx: {
|
|
565
566
|
"&:before": { display: "none" },
|
|
566
567
|
border: 1,
|
|
@@ -571,24 +572,24 @@ function Pr({
|
|
|
571
572
|
},
|
|
572
573
|
children: [
|
|
573
574
|
/* @__PURE__ */ r(
|
|
574
|
-
|
|
575
|
+
sr,
|
|
575
576
|
{
|
|
576
|
-
expandIcon: /* @__PURE__ */ r(
|
|
577
|
+
expandIcon: /* @__PURE__ */ r(kr, { fontSize: "small" }),
|
|
577
578
|
sx: {
|
|
578
579
|
minHeight: 44,
|
|
579
580
|
"& .MuiAccordionSummary-content": { my: 1 }
|
|
580
581
|
},
|
|
581
|
-
children: /* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.primary", children:
|
|
582
|
+
children: /* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.primary", children: s(kt(e.id)) })
|
|
582
583
|
}
|
|
583
584
|
),
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
e.id === "custom" && /* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ g(cr, { sx: { pt: 0, pb: 1.25 }, children: [
|
|
586
|
+
e.id === "custom" && /* @__PURE__ */ g(h, { sx: { mb: 1 }, children: [
|
|
586
587
|
/* @__PURE__ */ r(
|
|
587
588
|
Ee,
|
|
588
589
|
{
|
|
589
590
|
size: "small",
|
|
590
591
|
fullWidth: !0,
|
|
591
|
-
label:
|
|
592
|
+
label: s("text.variables.customVariableName"),
|
|
592
593
|
value: _,
|
|
593
594
|
placeholder: "e.g. order_id",
|
|
594
595
|
onChange: (o) => {
|
|
@@ -608,9 +609,9 @@ function Pr({
|
|
|
608
609
|
{
|
|
609
610
|
size: "small",
|
|
610
611
|
fullWidth: !0,
|
|
611
|
-
label:
|
|
612
|
+
label: s("text.variables.defaultValueLabel"),
|
|
612
613
|
value: W,
|
|
613
|
-
placeholder:
|
|
614
|
+
placeholder: s("text.variables.defaultPlaceholder"),
|
|
614
615
|
onChange: (o) => {
|
|
615
616
|
Me(o.target.value), !pe && o.target.value.trim() !== "" && oe(!0);
|
|
616
617
|
},
|
|
@@ -618,7 +619,7 @@ function Pr({
|
|
|
618
619
|
W.trim() !== "" && oe(!0);
|
|
619
620
|
},
|
|
620
621
|
error: pe && W.trim() === "",
|
|
621
|
-
helperText: pe && W.trim() === "" ?
|
|
622
|
+
helperText: pe && W.trim() === "" ? s("text.variables.defaultRequired") : " ",
|
|
622
623
|
FormHelperTextProps: ve
|
|
623
624
|
}
|
|
624
625
|
),
|
|
@@ -628,8 +629,8 @@ function Pr({
|
|
|
628
629
|
fullWidth: !0,
|
|
629
630
|
size: "small",
|
|
630
631
|
variant: "outlined",
|
|
631
|
-
startIcon: /* @__PURE__ */ r(
|
|
632
|
-
onClick:
|
|
632
|
+
startIcon: /* @__PURE__ */ r(Dr, { fontSize: "small" }),
|
|
633
|
+
onClick: Mt,
|
|
633
634
|
sx: {
|
|
634
635
|
justifyContent: "center",
|
|
635
636
|
borderColor: "divider",
|
|
@@ -637,7 +638,7 @@ function Pr({
|
|
|
637
638
|
color: "text.secondary",
|
|
638
639
|
textTransform: "none"
|
|
639
640
|
},
|
|
640
|
-
children:
|
|
641
|
+
children: s("text.variables.addCustomVariable")
|
|
641
642
|
}
|
|
642
643
|
)
|
|
643
644
|
] }),
|
|
@@ -646,15 +647,15 @@ function Pr({
|
|
|
646
647
|
{
|
|
647
648
|
size: "small",
|
|
648
649
|
variant: "outlined",
|
|
649
|
-
onClick: () =>
|
|
650
|
+
onClick: () => Dt(o.name, o.kind),
|
|
650
651
|
sx: {
|
|
651
652
|
justifyContent: "flex-start",
|
|
652
653
|
borderColor: "divider",
|
|
653
654
|
color: "text.secondary",
|
|
654
655
|
textTransform: "none"
|
|
655
656
|
},
|
|
656
|
-
children: /* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.primary", children: e.id === "custom" ? o.name :
|
|
657
|
+
children: /* @__PURE__ */ g(h, { sx: { textAlign: "left", minWidth: 0 }, children: [
|
|
658
|
+
/* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.primary", children: e.id === "custom" ? o.name : s(o.labelKey) }),
|
|
658
659
|
/* @__PURE__ */ r(
|
|
659
660
|
k,
|
|
660
661
|
{
|
|
@@ -675,9 +676,9 @@ function Pr({
|
|
|
675
676
|
e.id
|
|
676
677
|
);
|
|
677
678
|
}) }),
|
|
678
|
-
/* @__PURE__ */ r(
|
|
679
|
-
/* @__PURE__ */ r(k, { component: "div", ref: ke, variant: "subtitle2", sx: { mb: 0.5 }, children:
|
|
680
|
-
/* @__PURE__ */ r(k, { component: "div", variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children:
|
|
679
|
+
/* @__PURE__ */ r(dr, { sx: { my: 2 } }),
|
|
680
|
+
/* @__PURE__ */ r(k, { component: "div", ref: ke, variant: "subtitle2", sx: { mb: 0.5 }, children: s("htmlEditor.variables.detected") }),
|
|
681
|
+
/* @__PURE__ */ r(k, { component: "div", variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children: s("htmlEditor.variables.defaultHelp") }),
|
|
681
682
|
ce.length === 0 ? /* @__PURE__ */ r(
|
|
682
683
|
h,
|
|
683
684
|
{
|
|
@@ -690,11 +691,11 @@ function Pr({
|
|
|
690
691
|
fontSize: 14,
|
|
691
692
|
textAlign: "center"
|
|
692
693
|
},
|
|
693
|
-
children:
|
|
694
|
+
children: s("htmlEditor.variables.empty")
|
|
694
695
|
}
|
|
695
696
|
) : /* @__PURE__ */ r(h, { sx: { display: "grid", gap: 0.75 }, children: ce.map((e, t) => {
|
|
696
|
-
const o = e.type === "user" &&
|
|
697
|
-
return /* @__PURE__ */
|
|
697
|
+
const o = e.type === "user" && at(e.attribute, "user"), c = yt && o && e.default.trim() === "", y = ce.filter((p) => p.type === e.type && p.attribute === e.attribute).length, b = ce.slice(0, t + 1).filter((p) => p.type === e.type && p.attribute === e.attribute).length;
|
|
698
|
+
return /* @__PURE__ */ g(
|
|
698
699
|
h,
|
|
699
700
|
{
|
|
700
701
|
sx: {
|
|
@@ -708,10 +709,10 @@ function Pr({
|
|
|
708
709
|
borderColor: c ? "error.main" : "transparent",
|
|
709
710
|
borderRadius: 1,
|
|
710
711
|
borderBottomColor: c ? "error.main" : "divider",
|
|
711
|
-
backgroundColor: c ? de(
|
|
712
|
+
backgroundColor: c ? de(T.palette.error.main, 0.04) : "transparent",
|
|
712
713
|
transition: "background-color 120ms ease, border-color 120ms ease",
|
|
713
714
|
"&:hover": {
|
|
714
|
-
backgroundColor: c ? de(
|
|
715
|
+
backgroundColor: c ? de(T.palette.error.main, 0.04) : "action.hover",
|
|
715
716
|
borderColor: c ? "error.main" : "divider"
|
|
716
717
|
}
|
|
717
718
|
},
|
|
@@ -737,12 +738,12 @@ function Pr({
|
|
|
737
738
|
size: "small",
|
|
738
739
|
fullWidth: !0,
|
|
739
740
|
value: e.default,
|
|
740
|
-
label: c ?
|
|
741
|
-
placeholder:
|
|
741
|
+
label: c ? s("text.variables.defaultValueLabel") : void 0,
|
|
742
|
+
placeholder: s("text.variables.defaultPlaceholder"),
|
|
742
743
|
error: c,
|
|
743
|
-
helperText: c ?
|
|
744
|
+
helperText: c ? s("text.variables.defaultRequired") : " ",
|
|
744
745
|
FormHelperTextProps: ve,
|
|
745
|
-
onChange: (p) =>
|
|
746
|
+
onChange: (p) => St(e.variableInstanceId, p.target.value),
|
|
746
747
|
sx: {
|
|
747
748
|
"& .MuiOutlinedInput-root": {
|
|
748
749
|
minHeight: 40,
|
|
@@ -754,7 +755,7 @@ function Pr({
|
|
|
754
755
|
}
|
|
755
756
|
}
|
|
756
757
|
}
|
|
757
|
-
) : /* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.secondary", sx: { fontSize: 13 }, children:
|
|
758
|
+
) : /* @__PURE__ */ r(k, { component: "div", variant: "body2", color: "text.secondary", sx: { fontSize: 13 }, children: s("htmlEditor.variables.systemDefault") })
|
|
758
759
|
]
|
|
759
760
|
},
|
|
760
761
|
e.variableInstanceId || `${e.type}:${e.attribute}:${e.id}`
|
|
@@ -762,9 +763,9 @@ function Pr({
|
|
|
762
763
|
}) })
|
|
763
764
|
]
|
|
764
765
|
}
|
|
765
|
-
), Fe = () => /* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
767
|
-
|
|
766
|
+
), Fe = () => /* @__PURE__ */ g(h, { sx: { height: i, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
|
|
767
|
+
/* @__PURE__ */ g(
|
|
768
|
+
ir,
|
|
768
769
|
{
|
|
769
770
|
value: te,
|
|
770
771
|
onChange: (e, t) => P(t),
|
|
@@ -779,14 +780,14 @@ function Pr({
|
|
|
779
780
|
}
|
|
780
781
|
},
|
|
781
782
|
children: [
|
|
782
|
-
/* @__PURE__ */ r(ot, { value: "preview", label:
|
|
783
|
-
/* @__PURE__ */ r(ot, { value: "variables", label:
|
|
783
|
+
/* @__PURE__ */ r(ot, { value: "preview", label: s("htmlEditor.tabs.preview") }),
|
|
784
|
+
/* @__PURE__ */ r(ot, { value: "variables", label: s("htmlEditor.tabs.variables") })
|
|
784
785
|
]
|
|
785
786
|
}
|
|
786
787
|
),
|
|
787
|
-
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, overflow: "hidden", display: "flex", flexDirection: "column" }, children: te === "preview" ?
|
|
788
|
+
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, overflow: "hidden", display: "flex", flexDirection: "column" }, children: te === "preview" ? Ft() : Rt() })
|
|
788
789
|
] });
|
|
789
|
-
return /* @__PURE__ */
|
|
790
|
+
return /* @__PURE__ */ g(
|
|
790
791
|
h,
|
|
791
792
|
{
|
|
792
793
|
sx: {
|
|
@@ -799,7 +800,7 @@ function Pr({
|
|
|
799
800
|
...m
|
|
800
801
|
},
|
|
801
802
|
children: [
|
|
802
|
-
f && /* @__PURE__ */
|
|
803
|
+
f && /* @__PURE__ */ g(
|
|
803
804
|
h,
|
|
804
805
|
{
|
|
805
806
|
sx: {
|
|
@@ -812,55 +813,55 @@ function Pr({
|
|
|
812
813
|
backgroundColor: "background.paper"
|
|
813
814
|
},
|
|
814
815
|
children: [
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ g(h, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
817
|
+
/* @__PURE__ */ g(
|
|
817
818
|
et,
|
|
818
819
|
{
|
|
819
|
-
value:
|
|
820
|
+
value: At,
|
|
820
821
|
exclusive: !0,
|
|
821
|
-
onChange:
|
|
822
|
+
onChange: wt,
|
|
822
823
|
size: "small",
|
|
823
|
-
"aria-label":
|
|
824
|
+
"aria-label": s("htmlEditor.mode.split"),
|
|
824
825
|
children: [
|
|
825
|
-
/* @__PURE__ */ r(q, { title:
|
|
826
|
+
/* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.splitView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
826
827
|
Q,
|
|
827
828
|
{
|
|
828
829
|
value: "split",
|
|
829
|
-
"aria-label":
|
|
830
|
-
children: /* @__PURE__ */ r(
|
|
830
|
+
"aria-label": s("htmlEditor.mode.split"),
|
|
831
|
+
children: /* @__PURE__ */ r(Fr, { fontSize: "small" })
|
|
831
832
|
}
|
|
832
833
|
) }),
|
|
833
|
-
/* @__PURE__ */ r(q, { title:
|
|
834
|
+
/* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.codeOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
834
835
|
Q,
|
|
835
836
|
{
|
|
836
837
|
value: "code",
|
|
837
|
-
"aria-label":
|
|
838
|
-
children: /* @__PURE__ */ r(
|
|
838
|
+
"aria-label": s("htmlEditor.mode.code"),
|
|
839
|
+
children: /* @__PURE__ */ r(Mr, { fontSize: "small" })
|
|
839
840
|
}
|
|
840
841
|
) }),
|
|
841
|
-
/* @__PURE__ */ r(q, { title:
|
|
842
|
+
/* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.previewOnly"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
842
843
|
Q,
|
|
843
844
|
{
|
|
844
845
|
value: "preview",
|
|
845
|
-
"aria-label":
|
|
846
|
-
children: /* @__PURE__ */ r(
|
|
846
|
+
"aria-label": s("htmlEditor.mode.preview"),
|
|
847
|
+
children: /* @__PURE__ */ r(Ar, { fontSize: "small" })
|
|
847
848
|
}
|
|
848
849
|
) })
|
|
849
850
|
]
|
|
850
851
|
}
|
|
851
852
|
),
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */ r(
|
|
854
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ g(or, { size: "small", sx: { minWidth: 140 }, children: [
|
|
854
|
+
/* @__PURE__ */ r(ar, { id: "theme-select-label", children: s("htmlEditor.theme") }),
|
|
855
|
+
/* @__PURE__ */ g(
|
|
855
856
|
nr,
|
|
856
857
|
{
|
|
857
858
|
labelId: "theme-select-label",
|
|
858
859
|
id: "theme-select",
|
|
859
860
|
value: Se,
|
|
860
|
-
label:
|
|
861
|
+
label: s("htmlEditor.theme"),
|
|
861
862
|
onChange: (e) => {
|
|
862
863
|
const t = e.target.value;
|
|
863
|
-
|
|
864
|
+
vt(t), Pr(t);
|
|
864
865
|
},
|
|
865
866
|
sx: {
|
|
866
867
|
// fontSize: '0.875rem',
|
|
@@ -869,38 +870,38 @@ function Pr({
|
|
|
869
870
|
}
|
|
870
871
|
},
|
|
871
872
|
children: [
|
|
872
|
-
/* @__PURE__ */ r(tt, { children:
|
|
873
|
-
Object.entries(
|
|
874
|
-
/* @__PURE__ */ r(tt, { children:
|
|
873
|
+
/* @__PURE__ */ r(tt, { children: s("htmlEditor.lightThemes") }),
|
|
874
|
+
Object.entries(Nr).map(([e, t]) => /* @__PURE__ */ r(rt, { value: e, children: t }, e)),
|
|
875
|
+
/* @__PURE__ */ r(tt, { children: s("htmlEditor.darkThemes") }),
|
|
875
876
|
Object.entries(zr).map(([e, t]) => /* @__PURE__ */ r(rt, { value: e, children: t }, e))
|
|
876
877
|
]
|
|
877
878
|
}
|
|
878
879
|
)
|
|
879
880
|
] })
|
|
880
881
|
] }),
|
|
881
|
-
/* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: S !== "code" && /* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: S !== "code" && /* @__PURE__ */ g(
|
|
882
883
|
et,
|
|
883
884
|
{
|
|
884
|
-
value:
|
|
885
|
+
value: Bt,
|
|
885
886
|
exclusive: !0,
|
|
886
|
-
onChange:
|
|
887
|
+
onChange: Ht,
|
|
887
888
|
size: "small",
|
|
888
|
-
"aria-label":
|
|
889
|
+
"aria-label": s("htmlEditor.device.desktop"),
|
|
889
890
|
children: [
|
|
890
|
-
/* @__PURE__ */ r(q, { title:
|
|
891
|
+
/* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.desktopView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
891
892
|
Q,
|
|
892
893
|
{
|
|
893
894
|
value: "desktop",
|
|
894
|
-
"aria-label":
|
|
895
|
-
children: /* @__PURE__ */ r(
|
|
895
|
+
"aria-label": s("htmlEditor.device.desktop"),
|
|
896
|
+
children: /* @__PURE__ */ r(Rr, { fontSize: "small" })
|
|
896
897
|
}
|
|
897
898
|
) }),
|
|
898
|
-
/* @__PURE__ */ r(q, { title:
|
|
899
|
+
/* @__PURE__ */ r(q, { title: s("htmlEditor.tooltips.mobileView"), arrow: !0, slotProps: j, children: /* @__PURE__ */ r(
|
|
899
900
|
Q,
|
|
900
901
|
{
|
|
901
902
|
value: "mobile",
|
|
902
|
-
"aria-label":
|
|
903
|
-
children: /* @__PURE__ */ r(
|
|
903
|
+
"aria-label": s("htmlEditor.device.mobile"),
|
|
904
|
+
children: /* @__PURE__ */ r($r, { fontSize: "small" })
|
|
904
905
|
}
|
|
905
906
|
) })
|
|
906
907
|
]
|
|
@@ -909,7 +910,7 @@ function Pr({
|
|
|
909
910
|
]
|
|
910
911
|
}
|
|
911
912
|
),
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
+
/* @__PURE__ */ g(
|
|
913
914
|
h,
|
|
914
915
|
{
|
|
915
916
|
sx: {
|
|
@@ -920,7 +921,7 @@ function Pr({
|
|
|
920
921
|
overflow: "hidden"
|
|
921
922
|
},
|
|
922
923
|
children: [
|
|
923
|
-
S === "split" && /* @__PURE__ */
|
|
924
|
+
S === "split" && /* @__PURE__ */ g(Ot, { children: [
|
|
924
925
|
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Ae() }),
|
|
925
926
|
/* @__PURE__ */ r(h, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: Fe() })
|
|
926
927
|
] }),
|
|
@@ -933,10 +934,10 @@ function Pr({
|
|
|
933
934
|
}
|
|
934
935
|
);
|
|
935
936
|
}
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
937
|
+
const ft = ut(_r);
|
|
938
|
+
ft.displayName = "HtmlEditorContent";
|
|
939
|
+
const Wr = ut((a, n) => /* @__PURE__ */ r(er, { theme: Ir, children: /* @__PURE__ */ r(
|
|
940
|
+
tr,
|
|
940
941
|
{
|
|
941
942
|
sx: {
|
|
942
943
|
height: "100%",
|
|
@@ -946,11 +947,11 @@ const _r = ut((n, a) => /* @__PURE__ */ r(Zt, { theme: yr, children: /* @__PURE_
|
|
|
946
947
|
display: "flex",
|
|
947
948
|
flexDirection: "column"
|
|
948
949
|
},
|
|
949
|
-
children: /* @__PURE__ */ r(
|
|
950
|
+
children: /* @__PURE__ */ r(ft, { ref: n, ...a })
|
|
950
951
|
}
|
|
951
952
|
) }));
|
|
952
|
-
|
|
953
|
+
Wr.displayName = "HtmlEditor";
|
|
953
954
|
export {
|
|
954
|
-
|
|
955
|
-
|
|
955
|
+
Wr as HtmlEditor,
|
|
956
|
+
Wr as default
|
|
956
957
|
};
|