monto-email-builder 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App/InspectorDrawer/ConfigurationPanel/input-panels/TextSidebarPanel.d.ts.map +1 -1
- package/dist/HtmlEditor/index.d.ts +32 -1
- package/dist/HtmlEditor/index.d.ts.map +1 -1
- package/dist/HtmlEditor/variables.d.ts +36 -0
- package/dist/HtmlEditor/variables.d.ts.map +1 -0
- package/dist/chunks/{chunk-kYwVqyDL.js → chunk-CF4KXMbF.js} +186 -86
- package/dist/documents/blocks/EmailLayout/EmailLayoutPropsSchema.d.ts +2 -2
- package/dist/documents/editor/core.d.ts +6 -6
- package/dist/html-editor.d.ts +1 -1
- package/dist/html-editor.d.ts.map +1 -1
- package/dist/html-editor.js +650 -212
- package/dist/index.js +3512 -3515
- package/package.json +1 -1
package/dist/html-editor.js
CHANGED
|
@@ -1,212 +1,442 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { html as
|
|
5
|
-
import { xcodeDark as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useTheme as
|
|
9
|
-
import { alpha as
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
14
|
-
import * as
|
|
15
|
-
import
|
|
16
|
-
|
|
1
|
+
import { jsxs as m, jsx as r, Fragment as wt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as St, useState as y, useRef as oe, useEffect as J, useCallback as w, useMemo as Q, useImperativeHandle as Ht } from "react";
|
|
3
|
+
import Lt from "@uiw/react-codemirror";
|
|
4
|
+
import { html as Dt } from "@codemirror/lang-html";
|
|
5
|
+
import { xcodeDark as Mt, tomorrowNightBlue as It, dracula as Je, basicDark as kt, abcdef as At, bbedit as zt, noctisLilac as Ot, gruvboxLight as Rt, tokyoNightDay as Bt, vscodeLight as Ft, xcodeLight as Nt } from "@uiw/codemirror-themes-all";
|
|
6
|
+
import F from "@mui/material/ToggleButton";
|
|
7
|
+
import _e from "@mui/material/ToggleButtonGroup";
|
|
8
|
+
import { useTheme as $t, Box as d, Tooltip as O, FormControl as _t, InputLabel as Pt, Select as Wt, ListSubheader as Pe, MenuItem as We, Button as ie, Tabs as jt, Tab as je, Typography as S, Accordion as Gt, AccordionSummary as Kt, AccordionDetails as Ut, TextField as le, Divider as Yt } from "@mui/material";
|
|
9
|
+
import { alpha as Ge } from "@mui/material/styles";
|
|
10
|
+
import * as qt from "@mui/icons-material/AddOutlined";
|
|
11
|
+
import * as Xt from "@mui/icons-material/Code";
|
|
12
|
+
import * as Jt from "@mui/icons-material/DataObjectOutlined";
|
|
13
|
+
import * as Qt from "@mui/icons-material/ExpandMoreOutlined";
|
|
14
|
+
import * as Zt from "@mui/icons-material/HelpOutlined";
|
|
15
|
+
import * as er from "@mui/icons-material/Visibility";
|
|
16
|
+
import * as tr from "@mui/icons-material/ViewColumn";
|
|
17
|
+
import * as rr from "@mui/icons-material/MonitorOutlined";
|
|
18
|
+
import * as or from "@mui/icons-material/PhoneIphoneOutlined";
|
|
19
|
+
import { B as ir, V as H, r as V, t as lr } from "./chunks/chunk-CF4KXMbF.js";
|
|
20
|
+
const ae = ir, Ke = "unsubscribe_link", ne = /\{\{\s*([^{}]+?)\s*\}\}/g, Ue = /\{%\s*([^{}%]+?)\s*%\}/g;
|
|
21
|
+
function se(o, a, s, l, c) {
|
|
22
|
+
return o[a - 1] !== l && o[s] !== c;
|
|
23
|
+
}
|
|
24
|
+
function Qe(o, a = "user") {
|
|
25
|
+
return a === "builtin" || a === "system" ? `{%${o}%}` : `{{${o}}}`;
|
|
26
|
+
}
|
|
27
|
+
function ar(o) {
|
|
28
|
+
const a = typeof o == "string" ? o.trim() : "";
|
|
29
|
+
if (a.startsWith("{{") && a.endsWith("}}")) {
|
|
30
|
+
const s = a.slice(2, -2).trim();
|
|
31
|
+
if (H.test(s)) return { attribute: s, type: "user" };
|
|
32
|
+
}
|
|
33
|
+
if (a.startsWith("{%") && a.endsWith("%}")) {
|
|
34
|
+
const s = a.slice(2, -2).trim();
|
|
35
|
+
if (H.test(s)) return { attribute: s, type: "system" };
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function nr(o, a) {
|
|
40
|
+
const s = o.variable ?? o.Variable ?? o.key ?? "", l = ar(s), g = (o.type ?? o.Type ?? (l == null ? void 0 : l.type) ?? "user") === "system" ? "system" : "user", h = o.attribute ?? o.Attribute ?? (l == null ? void 0 : l.attribute) ?? "", p = String(h).trim();
|
|
41
|
+
return !p || !H.test(p) ? null : {
|
|
42
|
+
id: Number(o.id) || a + 1,
|
|
43
|
+
variable: g === "system" ? `{%${p}%}` : `{{${p}}}`,
|
|
44
|
+
type: g,
|
|
45
|
+
attribute: p,
|
|
46
|
+
default: String(o.default ?? o.Default ?? o.value ?? "")
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function Ye(o) {
|
|
50
|
+
if (!Array.isArray(o)) return [];
|
|
51
|
+
const a = /* @__PURE__ */ new Map();
|
|
52
|
+
return o.forEach((s, l) => {
|
|
53
|
+
const c = nr(s, l);
|
|
54
|
+
c && a.set(`${c.type}:${c.attribute}`, c);
|
|
55
|
+
}), Array.from(a.values()).map((s, l) => ({
|
|
56
|
+
...s,
|
|
57
|
+
id: l + 1
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
function sr(o) {
|
|
61
|
+
const a = o || "", s = /* @__PURE__ */ new Map(), l = (h, p) => {
|
|
62
|
+
const f = `${p}:${h}`;
|
|
63
|
+
s.has(f) || s.set(f, {
|
|
64
|
+
id: s.size + 1,
|
|
65
|
+
variable: p === "system" ? `{%${h}%}` : `{{${h}}}`,
|
|
66
|
+
type: p,
|
|
67
|
+
attribute: h,
|
|
68
|
+
default: ""
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
let c;
|
|
72
|
+
for (ne.lastIndex = 0; c = ne.exec(a); ) {
|
|
73
|
+
const h = c.index, p = h + c[0].length;
|
|
74
|
+
if (!se(a, h, p, "{", "}")) continue;
|
|
75
|
+
const f = c[1].trim();
|
|
76
|
+
!f || !H.test(f) || l(f, "user");
|
|
77
|
+
}
|
|
78
|
+
let g;
|
|
79
|
+
for (Ue.lastIndex = 0; g = Ue.exec(a); ) {
|
|
80
|
+
const h = g.index, p = h + g[0].length;
|
|
81
|
+
if (!se(a, h, p, "{", "}")) continue;
|
|
82
|
+
const f = g[1].trim();
|
|
83
|
+
!f || !H.test(f) || l(f, "system");
|
|
84
|
+
}
|
|
85
|
+
return Array.from(s.values());
|
|
86
|
+
}
|
|
87
|
+
function dr(o, a) {
|
|
88
|
+
const s = /* @__PURE__ */ new Map();
|
|
89
|
+
return a.forEach((l) => {
|
|
90
|
+
s.set(`${l.type}:${l.attribute}`, l.default ?? "");
|
|
91
|
+
}), o.map((l, c) => ({
|
|
92
|
+
...l,
|
|
93
|
+
id: c + 1,
|
|
94
|
+
default: s.get(`${l.type}:${l.attribute}`) ?? l.default ?? ""
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
function cr(o) {
|
|
98
|
+
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
99
|
+
}
|
|
100
|
+
function ur(o, a) {
|
|
101
|
+
const s = /* @__PURE__ */ new Map();
|
|
102
|
+
return a.forEach((l) => {
|
|
103
|
+
l.type === "user" && s.set(l.attribute, l.default ?? "");
|
|
104
|
+
}), (o || "").replace(ne, (l, c, g, h) => {
|
|
105
|
+
const p = g + l.length;
|
|
106
|
+
if (!se(h, g, p, "{", "}")) return l;
|
|
107
|
+
const f = String(c).trim();
|
|
108
|
+
if (!f || !H.test(f)) return l;
|
|
109
|
+
const R = s.get(f);
|
|
110
|
+
return R === void 0 || R === "" ? l : cr(R);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function qe(o, a, s = "") {
|
|
114
|
+
const l = o.trim();
|
|
115
|
+
if (!l || !H.test(l)) return null;
|
|
116
|
+
const c = a === "builtin" ? "system" : "user";
|
|
117
|
+
return {
|
|
118
|
+
id: 1,
|
|
119
|
+
variable: Qe(l, a),
|
|
120
|
+
type: c,
|
|
121
|
+
attribute: l,
|
|
122
|
+
default: c === "system" ? "" : s
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function mr(o) {
|
|
126
|
+
const a = o.trim();
|
|
127
|
+
return a ? ae.some((s) => s.items.some((l) => l.name === a)) : !1;
|
|
128
|
+
}
|
|
129
|
+
function hr(o, a) {
|
|
130
|
+
const s = o.trim();
|
|
131
|
+
return a === "user" && s === Ke ? `<a href="{{${Ke}}">Unsubscribe Link</a>` : Qe(s, a);
|
|
132
|
+
}
|
|
133
|
+
const br = V(qt), pr = V(Xt), fr = V(Jt), xr = V(Qt), gr = V(Zt), yr = V(er), vr = V(tr), Er = V(rr), Tr = V(or), de = {
|
|
17
134
|
// 浅色主题
|
|
18
|
-
xcodeLight:
|
|
19
|
-
vscodeLight:
|
|
20
|
-
tokyoNightDay:
|
|
21
|
-
gruvboxLight:
|
|
22
|
-
noctisLilac:
|
|
23
|
-
bbedit:
|
|
135
|
+
xcodeLight: Nt,
|
|
136
|
+
vscodeLight: Ft,
|
|
137
|
+
tokyoNightDay: Bt,
|
|
138
|
+
gruvboxLight: Rt,
|
|
139
|
+
noctisLilac: Ot,
|
|
140
|
+
bbedit: zt,
|
|
24
141
|
// 深色主题
|
|
25
|
-
abcdef:
|
|
26
|
-
basicDark:
|
|
27
|
-
dracula:
|
|
28
|
-
tomorrowNightBlue:
|
|
29
|
-
xcodeDark:
|
|
30
|
-
},
|
|
142
|
+
abcdef: At,
|
|
143
|
+
basicDark: kt,
|
|
144
|
+
dracula: Je,
|
|
145
|
+
tomorrowNightBlue: It,
|
|
146
|
+
xcodeDark: Mt
|
|
147
|
+
}, Vr = {
|
|
31
148
|
xcodeLight: "Xcode Light (Light)",
|
|
32
149
|
vscodeLight: "VSCode Light (Light)",
|
|
33
150
|
tokyoNightDay: "Tokyo Night Day (Light)",
|
|
34
151
|
gruvboxLight: "Gruvbox Light (Light)",
|
|
35
152
|
noctisLilac: "Noctis Lilac (Light)",
|
|
36
153
|
bbedit: "BBEdit (Light)"
|
|
37
|
-
},
|
|
154
|
+
}, Cr = {
|
|
38
155
|
abcdef: "ABCDEF (Dark)",
|
|
39
156
|
basicDark: "Basic Dark (Dark)",
|
|
40
157
|
dracula: "Dracula (Dark)",
|
|
41
158
|
tomorrowNightBlue: "Tomorrow Night Blue (Dark)",
|
|
42
159
|
xcodeDark: "Xcode Dark (Dark)"
|
|
43
|
-
},
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (typeof window > "u") return
|
|
160
|
+
}, Ze = "html-editor-theme", Xe = "dracula";
|
|
161
|
+
function wr(o = Xe) {
|
|
162
|
+
const a = o && de[o] ? o : Xe;
|
|
163
|
+
if (typeof window > "u") return a;
|
|
47
164
|
try {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
165
|
+
const s = localStorage.getItem(Ze);
|
|
166
|
+
if (s && de[s]) return s;
|
|
50
167
|
} catch {
|
|
51
168
|
console.error("Failed to get HTML Editor stored theme");
|
|
52
169
|
}
|
|
53
|
-
return
|
|
170
|
+
return a;
|
|
54
171
|
}
|
|
55
|
-
function
|
|
172
|
+
function Sr(o) {
|
|
56
173
|
try {
|
|
57
|
-
localStorage.setItem(
|
|
174
|
+
localStorage.setItem(Ze, o);
|
|
58
175
|
} catch {
|
|
59
|
-
console.error("Failed to set HTML Editor stored theme",
|
|
176
|
+
console.error("Failed to set HTML Editor stored theme", o);
|
|
60
177
|
}
|
|
61
178
|
}
|
|
62
|
-
function
|
|
63
|
-
value:
|
|
64
|
-
onChange:
|
|
65
|
-
language:
|
|
66
|
-
initialMode:
|
|
67
|
-
initialDevice:
|
|
68
|
-
codeEditorHeight:
|
|
69
|
-
previewHeight:
|
|
70
|
-
sx:
|
|
71
|
-
showToolbar:
|
|
72
|
-
initialTheme:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
179
|
+
function Hr({
|
|
180
|
+
value: o,
|
|
181
|
+
onChange: a,
|
|
182
|
+
language: s = "zh",
|
|
183
|
+
initialMode: l = "split",
|
|
184
|
+
initialDevice: c = "desktop",
|
|
185
|
+
codeEditorHeight: g = "100%",
|
|
186
|
+
previewHeight: h = "100%",
|
|
187
|
+
sx: p,
|
|
188
|
+
showToolbar: f = !0,
|
|
189
|
+
initialTheme: R,
|
|
190
|
+
initialRightTab: et = "preview",
|
|
191
|
+
variables: N,
|
|
192
|
+
onVariablesChange: $,
|
|
193
|
+
requireVariableDefaults: ce = !0
|
|
194
|
+
}, tt) {
|
|
195
|
+
var ve, Ee, Te, Ve, Ce, we, Se, He, Le, De, Me, Ie, ke, Ae, ze, Oe, Re, Be;
|
|
196
|
+
const n = (e, t) => lr(e, t, s), [v, rt] = y(l), [D, ot] = y(c), [ue, it] = y(() => wr(R)), [x, me] = y(o), [he, M] = y(et), [u, be] = y(() => Ye(N)), [lt, at] = y(!1), [nt, st] = y("custom"), [I, pe] = y(""), [k, fe] = y(""), [Z, _] = y(!1), [ee, P] = y(!1), B = oe(null), xe = oe(null), W = oe(null);
|
|
197
|
+
J(() => {
|
|
198
|
+
o !== x && me(o);
|
|
199
|
+
}, [o]), J(() => {
|
|
200
|
+
N !== void 0 && be(Ye(N));
|
|
201
|
+
}, [N]);
|
|
202
|
+
const C = w(
|
|
203
|
+
(e) => {
|
|
204
|
+
const t = e.map((i, b) => ({
|
|
205
|
+
...i,
|
|
206
|
+
id: b + 1,
|
|
207
|
+
default: i.type === "system" ? "" : i.default ?? ""
|
|
208
|
+
}));
|
|
209
|
+
return be(t), $ == null || $(t), t;
|
|
210
|
+
},
|
|
211
|
+
[$]
|
|
212
|
+
), te = (e) => {
|
|
213
|
+
me(e), B.current && clearTimeout(B.current), B.current = setTimeout(() => {
|
|
214
|
+
a == null || a(e);
|
|
82
215
|
}, 300);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
216
|
+
}, j = w(
|
|
217
|
+
(e = x) => {
|
|
218
|
+
const t = sr(e), i = dr(t, u);
|
|
219
|
+
return C(i);
|
|
220
|
+
},
|
|
221
|
+
[u, x, C]
|
|
222
|
+
), G = w(() => {
|
|
223
|
+
const e = j(x), t = ce ? e.filter((i) => i.type === "user" && i.default.trim() === "") : [];
|
|
224
|
+
return at(t.length > 0), t.length > 0 && M("variables"), {
|
|
225
|
+
valid: t.length === 0,
|
|
226
|
+
variables: e,
|
|
227
|
+
missing: t
|
|
228
|
+
};
|
|
229
|
+
}, [x, ce, j]), dt = w(() => {
|
|
230
|
+
G(), M("variables");
|
|
231
|
+
}, [G]);
|
|
232
|
+
J(() => () => {
|
|
233
|
+
B.current && clearTimeout(B.current);
|
|
86
234
|
}, []);
|
|
87
|
-
const
|
|
88
|
-
var
|
|
89
|
-
const t =
|
|
90
|
-
let
|
|
235
|
+
const ct = (e) => {
|
|
236
|
+
var X, Fe, Ne;
|
|
237
|
+
const t = e || "";
|
|
238
|
+
let i = t;
|
|
91
239
|
if (!t.trim())
|
|
92
|
-
|
|
240
|
+
i = "<!DOCTYPE html><html><head></head><body></body></html>";
|
|
93
241
|
else {
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
96
|
-
const
|
|
97
|
-
|
|
242
|
+
const T = new DOMParser().parseFromString(t, "text/html"), re = ((X = T.documentElement) == null ? void 0 : X.tagName.toLowerCase()) === "html", Tt = ((Fe = T.head) == null ? void 0 : Fe.tagName.toLowerCase()) === "head", Vt = ((Ne = T.body) == null ? void 0 : Ne.tagName.toLowerCase()) === "body";
|
|
243
|
+
if (!re || !Tt || !Vt) {
|
|
244
|
+
const Ct = T.body ? T.body.innerHTML : t;
|
|
245
|
+
i = `<!DOCTYPE html><html><head>${T.head ? T.head.innerHTML : ""}</head><body>${Ct}</body></html>`;
|
|
98
246
|
} else
|
|
99
|
-
|
|
247
|
+
i = `<!DOCTYPE html>${T.documentElement.outerHTML}`;
|
|
100
248
|
}
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
249
|
+
const b = ["script", "iframe", "object", "embed", "canvas"], z = new DOMParser().parseFromString(i, "text/html");
|
|
250
|
+
return b.forEach(($e) => {
|
|
251
|
+
z.querySelectorAll($e).forEach((re) => re.remove());
|
|
252
|
+
}), i = `<!DOCTYPE html>${z.documentElement.outerHTML}`, i;
|
|
253
|
+
}, K = Q(
|
|
254
|
+
() => ur(x, u),
|
|
255
|
+
[u, x]
|
|
256
|
+
), U = Q(() => ct(K), [K]);
|
|
257
|
+
Ht(
|
|
258
|
+
tt,
|
|
259
|
+
() => ({
|
|
260
|
+
getValue: () => x,
|
|
261
|
+
getPreviewHtml: () => K,
|
|
262
|
+
scanVariables: () => j(x),
|
|
263
|
+
getVariables: (e) => (e == null || e(u), u),
|
|
264
|
+
validateVariables: G,
|
|
265
|
+
showVariables: () => M("variables")
|
|
266
|
+
}),
|
|
267
|
+
[u, x, K, j, G]
|
|
268
|
+
), J(() => {
|
|
269
|
+
W.current && W.current.srcdoc !== U && (W.current.srcdoc = U);
|
|
270
|
+
}, [U]);
|
|
271
|
+
const ut = (e, t) => {
|
|
272
|
+
t !== null && rt(t);
|
|
273
|
+
}, mt = (e, t) => {
|
|
274
|
+
(t === "desktop" || t === "mobile") && ot(t);
|
|
275
|
+
}, Y = w(
|
|
276
|
+
(e) => {
|
|
277
|
+
var i, b;
|
|
278
|
+
const t = xe.current;
|
|
279
|
+
if (t != null && t.state && (t != null && t.dispatch)) {
|
|
280
|
+
const L = (i = t.state.selection) == null ? void 0 : i.main, z = (L == null ? void 0 : L.from) ?? t.state.doc.length, X = (L == null ? void 0 : L.to) ?? z;
|
|
281
|
+
t.dispatch({
|
|
282
|
+
changes: { from: z, to: X, insert: e },
|
|
283
|
+
selection: { anchor: z + e.length }
|
|
284
|
+
}), (b = t.focus) == null || b.call(t), te(t.state.doc.toString());
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
te(`${x}${e}`);
|
|
288
|
+
},
|
|
289
|
+
[x]
|
|
290
|
+
), ht = w(
|
|
291
|
+
(e, t, i) => {
|
|
292
|
+
C(
|
|
293
|
+
u.map(
|
|
294
|
+
(b) => b.attribute === e && b.type === t ? { ...b, default: i } : b
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
},
|
|
298
|
+
[u, C]
|
|
299
|
+
), bt = w(
|
|
300
|
+
(e, t) => {
|
|
301
|
+
const i = qe(e, t);
|
|
302
|
+
i && (Y(hr(e, t)), u.some((b) => b.attribute === i.attribute && b.type === i.type) || C([...u, i]), M("variables"));
|
|
303
|
+
},
|
|
304
|
+
[u, Y, C]
|
|
305
|
+
), q = Q(() => {
|
|
306
|
+
const e = I.trim();
|
|
307
|
+
return e ? H.test(e) ? mr(e) || u.some((t) => t.type === "user" && t.attribute === e) ? n("text.variables.customVariableNameDuplicate") : "" : n("text.variables.customVariableNameInvalid") : n("text.variables.customVariableNameRequired");
|
|
308
|
+
}, [I, u]), pt = w(() => {
|
|
309
|
+
const e = k.trim();
|
|
310
|
+
if (_(!0), P(!0), q || e === "") return;
|
|
311
|
+
const t = qe(I.trim(), "user", e);
|
|
312
|
+
t && (Y(t.variable), C([...u, t]), pe(""), fe(""), _(!1), P(!1), M("variables"));
|
|
313
|
+
}, [k, I, q, u, Y, C]), ft = Q(() => [{ id: "custom", items: u.filter((t) => t.type === "user").filter((t) => !ae.some((i) => i.items.some((b) => b.name === t.attribute))).map((t) => ({
|
|
314
|
+
name: t.attribute,
|
|
315
|
+
labelKey: t.attribute,
|
|
316
|
+
kind: "user"
|
|
317
|
+
})) }, ...ae], [u]), xt = (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", E = $t(), gt = D === "desktop" || D === "mobile" ? D : "desktop", yt = v === "split" || v === "code" || v === "preview" ? v : "split";
|
|
318
|
+
(Ee = (ve = E.palette) == null ? void 0 : ve.action) == null || Ee.selected, (Ve = (Te = E.palette) == null ? void 0 : Te.primary) == null || Ve.main, (we = (Ce = E.palette) == null ? void 0 : Ce.action) == null || we.selected, (He = (Se = E.palette) == null ? void 0 : Se.background) == null || He.paper, (De = (Le = E.palette) == null ? void 0 : Le.text) == null || De.primary, (Ie = (Me = E.palette) == null ? void 0 : Me.action) == null || Ie.hover;
|
|
319
|
+
const A = {
|
|
116
320
|
tooltip: {
|
|
117
321
|
sx: {
|
|
118
|
-
fontSize: "
|
|
119
|
-
fontWeight:
|
|
120
|
-
|
|
121
|
-
|
|
322
|
+
fontSize: "13px",
|
|
323
|
+
fontWeight: 400,
|
|
324
|
+
lineHeight: 1.45,
|
|
325
|
+
maxWidth: 360,
|
|
326
|
+
backgroundColor: Ge(((Ae = (ke = E.palette) == null ? void 0 : ke.text) == null ? void 0 : Ae.primary) ?? "#1F1F21", 0.9),
|
|
327
|
+
color: ((Oe = (ze = E.palette) == null ? void 0 : ze.common) == null ? void 0 : Oe.white) ?? "#fff"
|
|
122
328
|
}
|
|
123
329
|
},
|
|
124
330
|
arrow: {
|
|
125
|
-
sx: { color:
|
|
331
|
+
sx: { color: Ge(((Be = (Re = E.palette) == null ? void 0 : Re.text) == null ? void 0 : Be.primary) ?? "#1F1F21", 0.9) }
|
|
126
332
|
}
|
|
127
|
-
},
|
|
128
|
-
|
|
333
|
+
}, ge = () => /* @__PURE__ */ m(
|
|
334
|
+
d,
|
|
129
335
|
{
|
|
130
336
|
sx: {
|
|
131
|
-
height:
|
|
337
|
+
height: g,
|
|
132
338
|
minHeight: 0,
|
|
133
339
|
display: "flex",
|
|
134
340
|
flexDirection: "column",
|
|
135
|
-
|
|
341
|
+
position: "relative",
|
|
342
|
+
borderRight: v === "split" ? "1px solid" : "none",
|
|
136
343
|
borderColor: "divider"
|
|
137
344
|
},
|
|
138
|
-
children:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ r(
|
|
347
|
+
d,
|
|
348
|
+
{
|
|
349
|
+
sx: {
|
|
350
|
+
flex: 1,
|
|
351
|
+
minHeight: 0,
|
|
352
|
+
overflow: "hidden",
|
|
353
|
+
display: "flex",
|
|
354
|
+
flexDirection: "column",
|
|
355
|
+
"& .cm-editor": {
|
|
356
|
+
fontSize: "14px"
|
|
357
|
+
},
|
|
358
|
+
"& .cm-scroller": {
|
|
359
|
+
fontFamily: "monospace"
|
|
360
|
+
},
|
|
361
|
+
"& .cm-theme": {
|
|
362
|
+
height: "100%"
|
|
363
|
+
},
|
|
364
|
+
// 自定义光标样式,使其更粗、更显眼
|
|
365
|
+
"& .cm-cursor": {
|
|
366
|
+
borderLeftWidth: "2px !important",
|
|
367
|
+
borderLeftStyle: "solid !important",
|
|
368
|
+
marginLeft: "-1px"
|
|
369
|
+
// 补偿增加的宽度,保持位置居中
|
|
370
|
+
},
|
|
371
|
+
"& .cm-focused .cm-cursor": {
|
|
372
|
+
borderLeftWidth: "2px !important",
|
|
373
|
+
borderLeftStyle: "solid !important",
|
|
374
|
+
opacity: 1
|
|
375
|
+
}
|
|
162
376
|
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
dropCursor: !0,
|
|
181
|
-
allowMultipleSelections: !0
|
|
377
|
+
children: /* @__PURE__ */ r(
|
|
378
|
+
Lt,
|
|
379
|
+
{
|
|
380
|
+
value: x,
|
|
381
|
+
height: "100%",
|
|
382
|
+
extensions: [Dt()],
|
|
383
|
+
theme: de[ue] || Je,
|
|
384
|
+
onChange: te,
|
|
385
|
+
onCreateEditor: (e) => {
|
|
386
|
+
xe.current = e;
|
|
387
|
+
},
|
|
388
|
+
basicSetup: {
|
|
389
|
+
lineNumbers: !0,
|
|
390
|
+
foldGutter: !0,
|
|
391
|
+
dropCursor: !0,
|
|
392
|
+
allowMultipleSelections: !0
|
|
393
|
+
}
|
|
182
394
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
/* @__PURE__ */ r(
|
|
399
|
+
ie,
|
|
400
|
+
{
|
|
401
|
+
size: "small",
|
|
402
|
+
variant: "contained",
|
|
403
|
+
startIcon: /* @__PURE__ */ r(fr, { fontSize: "small" }),
|
|
404
|
+
onClick: dt,
|
|
405
|
+
sx: {
|
|
406
|
+
position: "absolute",
|
|
407
|
+
right: 16,
|
|
408
|
+
bottom: 16,
|
|
409
|
+
zIndex: 2,
|
|
410
|
+
textTransform: "none",
|
|
411
|
+
boxShadow: 3
|
|
412
|
+
},
|
|
413
|
+
children: n("common.save")
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
]
|
|
187
417
|
}
|
|
188
|
-
),
|
|
189
|
-
height:
|
|
418
|
+
), vt = () => /* @__PURE__ */ r(d, { sx: {
|
|
419
|
+
height: h,
|
|
190
420
|
overflow: "auto",
|
|
191
421
|
backgroundColor: "#F5F5F5",
|
|
192
|
-
padding:
|
|
422
|
+
padding: D === "mobile" ? "32px 16px" : "16px",
|
|
193
423
|
display: "flex",
|
|
194
424
|
justifyContent: "center"
|
|
195
|
-
}, children: /* @__PURE__ */
|
|
196
|
-
|
|
425
|
+
}, children: /* @__PURE__ */ r(
|
|
426
|
+
d,
|
|
197
427
|
{
|
|
198
428
|
sx: {
|
|
199
429
|
width: "100%",
|
|
200
|
-
maxWidth:
|
|
201
|
-
height:
|
|
430
|
+
maxWidth: D === "mobile" ? "370px" : "100%",
|
|
431
|
+
height: D === "mobile" ? "800px" : "100%",
|
|
202
432
|
border: "none",
|
|
203
433
|
overflow: "hidden"
|
|
204
434
|
},
|
|
205
|
-
children: /* @__PURE__ */
|
|
435
|
+
children: /* @__PURE__ */ r(
|
|
206
436
|
"iframe",
|
|
207
437
|
{
|
|
208
|
-
ref:
|
|
209
|
-
srcDoc:
|
|
438
|
+
ref: W,
|
|
439
|
+
srcDoc: U,
|
|
210
440
|
style: {
|
|
211
441
|
width: "100%",
|
|
212
442
|
height: "100%",
|
|
@@ -218,9 +448,215 @@ function xt({
|
|
|
218
448
|
}
|
|
219
449
|
)
|
|
220
450
|
}
|
|
221
|
-
) })
|
|
222
|
-
|
|
223
|
-
|
|
451
|
+
) }), Et = () => /* @__PURE__ */ m(
|
|
452
|
+
d,
|
|
453
|
+
{
|
|
454
|
+
sx: {
|
|
455
|
+
height: h,
|
|
456
|
+
overflow: "auto",
|
|
457
|
+
backgroundColor: "background.paper",
|
|
458
|
+
p: 2
|
|
459
|
+
},
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ r(d, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: /* @__PURE__ */ m(d, { sx: { minWidth: 0 }, children: [
|
|
462
|
+
/* @__PURE__ */ m(d, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
|
|
463
|
+
/* @__PURE__ */ r(S, { variant: "subtitle1", sx: { fontWeight: 700 }, children: n("htmlEditor.variables.title") }),
|
|
464
|
+
/* @__PURE__ */ r(O, { title: n("htmlEditor.variables.help"), arrow: !0, slotProps: A, children: /* @__PURE__ */ r(d, { component: "span", sx: { display: "inline-flex", color: "text.secondary", cursor: "help" }, children: /* @__PURE__ */ r(gr, { fontSize: "small" }) }) })
|
|
465
|
+
] }),
|
|
466
|
+
/* @__PURE__ */ r(S, { variant: "body2", color: "text.secondary", children: n("htmlEditor.variables.scanHint") })
|
|
467
|
+
] }) }),
|
|
468
|
+
/* @__PURE__ */ r(d, { sx: { mb: 2 }, children: ft.map((e) => {
|
|
469
|
+
const t = nt === e.id;
|
|
470
|
+
return /* @__PURE__ */ m(
|
|
471
|
+
Gt,
|
|
472
|
+
{
|
|
473
|
+
disableGutters: !0,
|
|
474
|
+
square: !0,
|
|
475
|
+
elevation: 0,
|
|
476
|
+
expanded: t,
|
|
477
|
+
onChange: (i, b) => st(b ? e.id : null),
|
|
478
|
+
sx: {
|
|
479
|
+
"&:before": { display: "none" },
|
|
480
|
+
border: 1,
|
|
481
|
+
borderColor: "divider",
|
|
482
|
+
borderRadius: 1,
|
|
483
|
+
overflow: "hidden",
|
|
484
|
+
mb: 1
|
|
485
|
+
},
|
|
486
|
+
children: [
|
|
487
|
+
/* @__PURE__ */ r(
|
|
488
|
+
Kt,
|
|
489
|
+
{
|
|
490
|
+
expandIcon: /* @__PURE__ */ r(xr, { fontSize: "small" }),
|
|
491
|
+
sx: {
|
|
492
|
+
minHeight: 44,
|
|
493
|
+
"& .MuiAccordionSummary-content": { my: 1 }
|
|
494
|
+
},
|
|
495
|
+
children: /* @__PURE__ */ r(S, { variant: "body2", color: "text.primary", children: n(xt(e.id)) })
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
/* @__PURE__ */ m(Ut, { sx: { pt: 0, pb: 1.25 }, children: [
|
|
499
|
+
e.id === "custom" && /* @__PURE__ */ m(d, { sx: { mb: 1 }, children: [
|
|
500
|
+
/* @__PURE__ */ r(
|
|
501
|
+
le,
|
|
502
|
+
{
|
|
503
|
+
size: "small",
|
|
504
|
+
fullWidth: !0,
|
|
505
|
+
label: n("text.variables.customVariableName"),
|
|
506
|
+
value: I,
|
|
507
|
+
placeholder: "e.g. order_id",
|
|
508
|
+
onChange: (i) => {
|
|
509
|
+
pe(i.target.value), !Z && i.target.value.trim() !== "" && _(!0);
|
|
510
|
+
},
|
|
511
|
+
onBlur: () => {
|
|
512
|
+
I.trim() !== "" && _(!0);
|
|
513
|
+
},
|
|
514
|
+
error: Z && !!q,
|
|
515
|
+
helperText: Z && q || " ",
|
|
516
|
+
sx: { mb: 1 }
|
|
517
|
+
}
|
|
518
|
+
),
|
|
519
|
+
/* @__PURE__ */ r(
|
|
520
|
+
le,
|
|
521
|
+
{
|
|
522
|
+
size: "small",
|
|
523
|
+
fullWidth: !0,
|
|
524
|
+
label: n("text.variables.defaultValueLabel"),
|
|
525
|
+
value: k,
|
|
526
|
+
placeholder: n("text.variables.defaultPlaceholder"),
|
|
527
|
+
onChange: (i) => {
|
|
528
|
+
fe(i.target.value), !ee && i.target.value.trim() !== "" && P(!0);
|
|
529
|
+
},
|
|
530
|
+
onBlur: () => {
|
|
531
|
+
k.trim() !== "" && P(!0);
|
|
532
|
+
},
|
|
533
|
+
error: ee && k.trim() === "",
|
|
534
|
+
helperText: ee && k.trim() === "" ? n("text.variables.defaultRequired") : " "
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
/* @__PURE__ */ r(
|
|
538
|
+
ie,
|
|
539
|
+
{
|
|
540
|
+
fullWidth: !0,
|
|
541
|
+
size: "small",
|
|
542
|
+
variant: "outlined",
|
|
543
|
+
startIcon: /* @__PURE__ */ r(br, { fontSize: "small" }),
|
|
544
|
+
onClick: pt,
|
|
545
|
+
sx: {
|
|
546
|
+
justifyContent: "center",
|
|
547
|
+
borderColor: "divider",
|
|
548
|
+
borderStyle: "dashed",
|
|
549
|
+
color: "text.secondary",
|
|
550
|
+
textTransform: "none"
|
|
551
|
+
},
|
|
552
|
+
children: n("text.variables.addCustomVariable")
|
|
553
|
+
}
|
|
554
|
+
)
|
|
555
|
+
] }),
|
|
556
|
+
e.items.length > 0 && /* @__PURE__ */ r(d, { sx: { display: "grid", gap: 0.75 }, children: e.items.map((i) => /* @__PURE__ */ r(
|
|
557
|
+
ie,
|
|
558
|
+
{
|
|
559
|
+
size: "small",
|
|
560
|
+
variant: "outlined",
|
|
561
|
+
onClick: () => bt(i.name, i.kind),
|
|
562
|
+
sx: {
|
|
563
|
+
justifyContent: "flex-start",
|
|
564
|
+
borderColor: "divider",
|
|
565
|
+
color: "text.secondary",
|
|
566
|
+
textTransform: "none"
|
|
567
|
+
},
|
|
568
|
+
children: /* @__PURE__ */ m(d, { sx: { textAlign: "left", minWidth: 0 }, children: [
|
|
569
|
+
/* @__PURE__ */ r(S, { variant: "body2", color: "text.primary", children: e.id === "custom" ? i.name : n(i.labelKey) }),
|
|
570
|
+
/* @__PURE__ */ r(S, { variant: "caption", color: "text.secondary", sx: { fontFamily: "monospace" }, children: i.kind === "builtin" ? `{%${i.name}%}` : `{{${i.name}}}` })
|
|
571
|
+
] })
|
|
572
|
+
},
|
|
573
|
+
`${e.id}:${i.name}`
|
|
574
|
+
)) })
|
|
575
|
+
] })
|
|
576
|
+
]
|
|
577
|
+
},
|
|
578
|
+
e.id
|
|
579
|
+
);
|
|
580
|
+
}) }),
|
|
581
|
+
/* @__PURE__ */ r(Yt, { sx: { my: 2 } }),
|
|
582
|
+
/* @__PURE__ */ r(S, { variant: "subtitle2", sx: { mb: 1 }, children: n("htmlEditor.variables.detected") }),
|
|
583
|
+
/* @__PURE__ */ r(S, { variant: "body2", color: "text.secondary", sx: { mb: 1.25 }, children: n("htmlEditor.variables.defaultHelp") }),
|
|
584
|
+
u.length === 0 ? /* @__PURE__ */ r(
|
|
585
|
+
d,
|
|
586
|
+
{
|
|
587
|
+
sx: {
|
|
588
|
+
border: "1px dashed",
|
|
589
|
+
borderColor: "divider",
|
|
590
|
+
borderRadius: 1,
|
|
591
|
+
p: 2,
|
|
592
|
+
color: "text.secondary",
|
|
593
|
+
fontSize: 14,
|
|
594
|
+
textAlign: "center"
|
|
595
|
+
},
|
|
596
|
+
children: n("htmlEditor.variables.empty")
|
|
597
|
+
}
|
|
598
|
+
) : /* @__PURE__ */ r(d, { sx: { display: "grid", gap: 1.5 }, children: u.map((e) => {
|
|
599
|
+
const t = lt && e.type === "user" && e.default.trim() === "";
|
|
600
|
+
return /* @__PURE__ */ m(
|
|
601
|
+
d,
|
|
602
|
+
{
|
|
603
|
+
sx: {
|
|
604
|
+
display: "grid",
|
|
605
|
+
gap: 0.75,
|
|
606
|
+
p: 1.25,
|
|
607
|
+
border: "1px solid",
|
|
608
|
+
borderColor: t ? "error.main" : "divider",
|
|
609
|
+
borderRadius: 1
|
|
610
|
+
},
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ r(S, { variant: "body2", sx: { fontFamily: "monospace", wordBreak: "break-all" }, children: e.variable }),
|
|
613
|
+
/* @__PURE__ */ r(
|
|
614
|
+
le,
|
|
615
|
+
{
|
|
616
|
+
size: "small",
|
|
617
|
+
fullWidth: !0,
|
|
618
|
+
disabled: e.type === "system",
|
|
619
|
+
value: e.default,
|
|
620
|
+
label: n("text.variables.defaultValueLabel"),
|
|
621
|
+
placeholder: e.type === "system" ? n("htmlEditor.variables.systemDefault") : n("text.variables.defaultPlaceholder"),
|
|
622
|
+
error: t,
|
|
623
|
+
helperText: t ? n("text.variables.defaultRequired") : " ",
|
|
624
|
+
onChange: (i) => ht(e.attribute, e.type, i.target.value)
|
|
625
|
+
}
|
|
626
|
+
)
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
`${e.type}:${e.attribute}`
|
|
630
|
+
);
|
|
631
|
+
}) })
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
), ye = () => /* @__PURE__ */ m(d, { sx: { height: h, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
|
|
635
|
+
/* @__PURE__ */ m(
|
|
636
|
+
jt,
|
|
637
|
+
{
|
|
638
|
+
value: he,
|
|
639
|
+
onChange: (e, t) => M(t),
|
|
640
|
+
sx: {
|
|
641
|
+
minHeight: 40,
|
|
642
|
+
borderBottom: "1px solid",
|
|
643
|
+
borderColor: "divider",
|
|
644
|
+
backgroundColor: "background.paper",
|
|
645
|
+
"& .MuiTab-root": {
|
|
646
|
+
minHeight: 40,
|
|
647
|
+
textTransform: "none"
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
children: [
|
|
651
|
+
/* @__PURE__ */ r(je, { value: "preview", label: n("htmlEditor.tabs.preview") }),
|
|
652
|
+
/* @__PURE__ */ r(je, { value: "variables", label: n("htmlEditor.tabs.variables") })
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
),
|
|
656
|
+
/* @__PURE__ */ r(d, { sx: { flex: 1, minHeight: 0, overflow: "hidden" }, children: he === "preview" ? vt() : Et() })
|
|
657
|
+
] });
|
|
658
|
+
return /* @__PURE__ */ m(
|
|
659
|
+
d,
|
|
224
660
|
{
|
|
225
661
|
sx: {
|
|
226
662
|
display: "flex",
|
|
@@ -229,11 +665,11 @@ function xt({
|
|
|
229
665
|
width: "100%",
|
|
230
666
|
minHeight: 0,
|
|
231
667
|
minWidth: 0,
|
|
232
|
-
...
|
|
668
|
+
...p
|
|
233
669
|
},
|
|
234
670
|
children: [
|
|
235
|
-
|
|
236
|
-
|
|
671
|
+
f && /* @__PURE__ */ m(
|
|
672
|
+
d,
|
|
237
673
|
{
|
|
238
674
|
sx: {
|
|
239
675
|
display: "flex",
|
|
@@ -245,55 +681,55 @@ function xt({
|
|
|
245
681
|
backgroundColor: "background.paper"
|
|
246
682
|
},
|
|
247
683
|
children: [
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
|
|
684
|
+
/* @__PURE__ */ m(d, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
685
|
+
/* @__PURE__ */ m(
|
|
686
|
+
_e,
|
|
251
687
|
{
|
|
252
|
-
value:
|
|
688
|
+
value: yt,
|
|
253
689
|
exclusive: !0,
|
|
254
|
-
onChange:
|
|
690
|
+
onChange: ut,
|
|
255
691
|
size: "small",
|
|
256
|
-
"aria-label":
|
|
692
|
+
"aria-label": n("htmlEditor.mode.split"),
|
|
257
693
|
children: [
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
|
|
694
|
+
/* @__PURE__ */ r(O, { title: n("htmlEditor.tooltips.splitView"), arrow: !0, slotProps: A, children: /* @__PURE__ */ r(
|
|
695
|
+
F,
|
|
260
696
|
{
|
|
261
697
|
value: "split",
|
|
262
|
-
"aria-label":
|
|
263
|
-
children: /* @__PURE__ */
|
|
698
|
+
"aria-label": n("htmlEditor.mode.split"),
|
|
699
|
+
children: /* @__PURE__ */ r(vr, { fontSize: "small" })
|
|
264
700
|
}
|
|
265
701
|
) }),
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
|
|
702
|
+
/* @__PURE__ */ r(O, { title: n("htmlEditor.tooltips.codeOnly"), arrow: !0, slotProps: A, children: /* @__PURE__ */ r(
|
|
703
|
+
F,
|
|
268
704
|
{
|
|
269
705
|
value: "code",
|
|
270
|
-
"aria-label":
|
|
271
|
-
children: /* @__PURE__ */
|
|
706
|
+
"aria-label": n("htmlEditor.mode.code"),
|
|
707
|
+
children: /* @__PURE__ */ r(pr, { fontSize: "small" })
|
|
272
708
|
}
|
|
273
709
|
) }),
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
|
|
710
|
+
/* @__PURE__ */ r(O, { title: n("htmlEditor.tooltips.previewOnly"), arrow: !0, slotProps: A, children: /* @__PURE__ */ r(
|
|
711
|
+
F,
|
|
276
712
|
{
|
|
277
713
|
value: "preview",
|
|
278
|
-
"aria-label":
|
|
279
|
-
children: /* @__PURE__ */
|
|
714
|
+
"aria-label": n("htmlEditor.mode.preview"),
|
|
715
|
+
children: /* @__PURE__ */ r(yr, { fontSize: "small" })
|
|
280
716
|
}
|
|
281
717
|
) })
|
|
282
718
|
]
|
|
283
719
|
}
|
|
284
720
|
),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
|
|
721
|
+
/* @__PURE__ */ m(_t, { size: "small", sx: { minWidth: 140 }, children: [
|
|
722
|
+
/* @__PURE__ */ r(Pt, { id: "theme-select-label", children: n("htmlEditor.theme") }),
|
|
723
|
+
/* @__PURE__ */ m(
|
|
724
|
+
Wt,
|
|
289
725
|
{
|
|
290
726
|
labelId: "theme-select-label",
|
|
291
727
|
id: "theme-select",
|
|
292
|
-
value:
|
|
293
|
-
label:
|
|
294
|
-
onChange: (
|
|
295
|
-
const t =
|
|
296
|
-
|
|
728
|
+
value: ue,
|
|
729
|
+
label: n("htmlEditor.theme"),
|
|
730
|
+
onChange: (e) => {
|
|
731
|
+
const t = e.target.value;
|
|
732
|
+
it(t), console.log("theme changed to", t), Sr(t);
|
|
297
733
|
},
|
|
298
734
|
sx: {
|
|
299
735
|
// fontSize: '0.875rem',
|
|
@@ -302,38 +738,38 @@ function xt({
|
|
|
302
738
|
}
|
|
303
739
|
},
|
|
304
740
|
children: [
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
Object.entries(
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
Object.entries(
|
|
741
|
+
/* @__PURE__ */ r(Pe, { children: n("htmlEditor.lightThemes") }),
|
|
742
|
+
Object.entries(Vr).map(([e, t]) => /* @__PURE__ */ r(We, { value: e, children: t }, e)),
|
|
743
|
+
/* @__PURE__ */ r(Pe, { children: n("htmlEditor.darkThemes") }),
|
|
744
|
+
Object.entries(Cr).map(([e, t]) => /* @__PURE__ */ r(We, { value: e, children: t }, e))
|
|
309
745
|
]
|
|
310
746
|
}
|
|
311
747
|
)
|
|
312
748
|
] })
|
|
313
749
|
] }),
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
|
|
750
|
+
/* @__PURE__ */ r(d, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: v !== "code" && /* @__PURE__ */ m(
|
|
751
|
+
_e,
|
|
316
752
|
{
|
|
317
|
-
value:
|
|
753
|
+
value: gt,
|
|
318
754
|
exclusive: !0,
|
|
319
|
-
onChange:
|
|
755
|
+
onChange: mt,
|
|
320
756
|
size: "small",
|
|
321
|
-
"aria-label":
|
|
757
|
+
"aria-label": n("htmlEditor.device.desktop"),
|
|
322
758
|
children: [
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
|
|
759
|
+
/* @__PURE__ */ r(O, { title: n("htmlEditor.tooltips.desktopView"), arrow: !0, slotProps: A, children: /* @__PURE__ */ r(
|
|
760
|
+
F,
|
|
325
761
|
{
|
|
326
762
|
value: "desktop",
|
|
327
|
-
"aria-label":
|
|
328
|
-
children: /* @__PURE__ */
|
|
763
|
+
"aria-label": n("htmlEditor.device.desktop"),
|
|
764
|
+
children: /* @__PURE__ */ r(Er, { fontSize: "small" })
|
|
329
765
|
}
|
|
330
766
|
) }),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
|
|
767
|
+
/* @__PURE__ */ r(O, { title: n("htmlEditor.tooltips.mobileView"), arrow: !0, slotProps: A, children: /* @__PURE__ */ r(
|
|
768
|
+
F,
|
|
333
769
|
{
|
|
334
770
|
value: "mobile",
|
|
335
|
-
"aria-label":
|
|
336
|
-
children: /* @__PURE__ */
|
|
771
|
+
"aria-label": n("htmlEditor.device.mobile"),
|
|
772
|
+
children: /* @__PURE__ */ r(Tr, { fontSize: "small" })
|
|
337
773
|
}
|
|
338
774
|
) })
|
|
339
775
|
]
|
|
@@ -342,8 +778,8 @@ function xt({
|
|
|
342
778
|
]
|
|
343
779
|
}
|
|
344
780
|
),
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
|
|
781
|
+
/* @__PURE__ */ m(
|
|
782
|
+
d,
|
|
347
783
|
{
|
|
348
784
|
sx: {
|
|
349
785
|
flex: 1,
|
|
@@ -353,12 +789,12 @@ function xt({
|
|
|
353
789
|
overflow: "hidden"
|
|
354
790
|
},
|
|
355
791
|
children: [
|
|
356
|
-
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
792
|
+
v === "split" && /* @__PURE__ */ m(wt, { children: [
|
|
793
|
+
/* @__PURE__ */ r(d, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: ge() }),
|
|
794
|
+
/* @__PURE__ */ r(d, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: ye() })
|
|
359
795
|
] }),
|
|
360
|
-
|
|
361
|
-
|
|
796
|
+
v === "code" && /* @__PURE__ */ r(d, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: ge() }),
|
|
797
|
+
v === "preview" && /* @__PURE__ */ r(d, { sx: { flex: 1, minHeight: 0, minWidth: 0, overflow: "hidden" }, children: ye() })
|
|
362
798
|
]
|
|
363
799
|
}
|
|
364
800
|
)
|
|
@@ -366,7 +802,9 @@ function xt({
|
|
|
366
802
|
}
|
|
367
803
|
);
|
|
368
804
|
}
|
|
805
|
+
const Lr = St(Hr);
|
|
806
|
+
Lr.displayName = "HtmlEditor";
|
|
369
807
|
export {
|
|
370
|
-
|
|
371
|
-
|
|
808
|
+
Lr as HtmlEditor,
|
|
809
|
+
Lr as default
|
|
372
810
|
};
|