@kontakto/email-template-editor 2.0.0 → 2.1.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/README.md +46 -1
- package/dist/index.cjs +1555 -602
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +232 -21
- package/dist/index.d.ts +232 -21
- package/dist/index.js +1426 -473
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var DOMPurify = require('dompurify');
|
|
4
4
|
var marked = require('marked');
|
|
5
|
-
var
|
|
5
|
+
var React58 = require('react');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
var server = require('react-dom/server');
|
|
8
8
|
var styles = require('@mui/material/styles');
|
|
@@ -18,7 +18,7 @@ var htmlfy = require('htmlfy');
|
|
|
18
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
|
|
20
20
|
var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
|
|
21
|
-
var
|
|
21
|
+
var React58__default = /*#__PURE__*/_interopDefault(React58);
|
|
22
22
|
var hljs__default = /*#__PURE__*/_interopDefault(hljs);
|
|
23
23
|
var jsonHighlighter__default = /*#__PURE__*/_interopDefault(jsonHighlighter);
|
|
24
24
|
var xmlHighlighter__default = /*#__PURE__*/_interopDefault(xmlHighlighter);
|
|
@@ -168,8 +168,8 @@ function renderMarkdownString(str) {
|
|
|
168
168
|
}
|
|
169
169
|
function EmailMarkdown(_a) {
|
|
170
170
|
var _b = _a, { markdown } = _b, props = __objRest(_b, ["markdown"]);
|
|
171
|
-
const data =
|
|
172
|
-
return /* @__PURE__ */
|
|
171
|
+
const data = React58.useMemo(() => renderMarkdownString(markdown), [markdown]);
|
|
172
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", __spreadProps(__spreadValues({}, props), { dangerouslySetInnerHTML: { __html: data } }));
|
|
173
173
|
}
|
|
174
174
|
var FONT_FAMILY_SCHEMA = zod.z.enum([
|
|
175
175
|
"MODERN_SANS",
|
|
@@ -220,6 +220,8 @@ var TextPropsSchema = zod.z.object({
|
|
|
220
220
|
fontSize: zod.z.number().gte(0).optional().nullable(),
|
|
221
221
|
fontFamily: FONT_FAMILY_SCHEMA,
|
|
222
222
|
fontWeight: zod.z.enum(["bold", "normal"]).optional().nullable(),
|
|
223
|
+
lineHeight: zod.z.number().gte(0).optional().nullable(),
|
|
224
|
+
letterSpacing: zod.z.number().optional().nullable(),
|
|
223
225
|
textAlign: zod.z.enum(["left", "center", "right"]).optional().nullable(),
|
|
224
226
|
padding: PADDING_SCHEMA
|
|
225
227
|
}).optional().nullable(),
|
|
@@ -233,21 +235,23 @@ var TextPropsDefaults = {
|
|
|
233
235
|
text: ""
|
|
234
236
|
};
|
|
235
237
|
function Text({ style, props }) {
|
|
236
|
-
var _a, _b, _c, _d, _e, _f;
|
|
238
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
237
239
|
const wStyle = {
|
|
238
240
|
color: (_a = style == null ? void 0 : style.color) != null ? _a : void 0,
|
|
239
241
|
backgroundColor: (_b = style == null ? void 0 : style.backgroundColor) != null ? _b : void 0,
|
|
240
242
|
fontSize: (_c = style == null ? void 0 : style.fontSize) != null ? _c : void 0,
|
|
241
243
|
fontFamily: getFontFamily(style == null ? void 0 : style.fontFamily),
|
|
242
244
|
fontWeight: (_d = style == null ? void 0 : style.fontWeight) != null ? _d : void 0,
|
|
243
|
-
|
|
245
|
+
lineHeight: (_e = style == null ? void 0 : style.lineHeight) != null ? _e : void 0,
|
|
246
|
+
letterSpacing: (style == null ? void 0 : style.letterSpacing) != null ? `${style.letterSpacing}px` : void 0,
|
|
247
|
+
textAlign: (_f = style == null ? void 0 : style.textAlign) != null ? _f : void 0,
|
|
244
248
|
padding: getPadding(style == null ? void 0 : style.padding)
|
|
245
249
|
};
|
|
246
|
-
const text = (
|
|
250
|
+
const text = (_g = props == null ? void 0 : props.text) != null ? _g : TextPropsDefaults.text;
|
|
247
251
|
if (props == null ? void 0 : props.markdown) {
|
|
248
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ React58__default.default.createElement(EmailMarkdown, { style: wStyle, markdown: text });
|
|
249
253
|
}
|
|
250
|
-
return /* @__PURE__ */
|
|
254
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wStyle }, text);
|
|
251
255
|
}
|
|
252
256
|
var PADDING_SCHEMA2 = zod.z.object({
|
|
253
257
|
top: zod.z.number(),
|
|
@@ -296,7 +300,7 @@ function Avatar({ style, props }) {
|
|
|
296
300
|
textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
|
|
297
301
|
padding: getPadding2(style == null ? void 0 : style.padding)
|
|
298
302
|
};
|
|
299
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React58__default.default.createElement(
|
|
300
304
|
"img",
|
|
301
305
|
{
|
|
302
306
|
alt,
|
|
@@ -368,6 +372,8 @@ var ButtonPropsSchema = zod.z.object({
|
|
|
368
372
|
fontSize: zod.z.number().min(0).optional().nullable(),
|
|
369
373
|
fontFamily: FONT_FAMILY_SCHEMA2,
|
|
370
374
|
fontWeight: zod.z.enum(["bold", "normal"]).optional().nullable(),
|
|
375
|
+
lineHeight: zod.z.number().gte(0).optional().nullable(),
|
|
376
|
+
letterSpacing: zod.z.number().optional().nullable(),
|
|
371
377
|
textAlign: zod.z.enum(["left", "center", "right"]).optional().nullable(),
|
|
372
378
|
padding: PADDING_SCHEMA3
|
|
373
379
|
}).optional().nullable(),
|
|
@@ -420,7 +426,7 @@ var ButtonPropsDefaults = {
|
|
|
420
426
|
buttonBackgroundColor: "#999999"
|
|
421
427
|
};
|
|
422
428
|
function Button({ style, props }) {
|
|
423
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
429
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
424
430
|
const text = (_a = props == null ? void 0 : props.text) != null ? _a : ButtonPropsDefaults.text;
|
|
425
431
|
const url = (_b = props == null ? void 0 : props.url) != null ? _b : ButtonPropsDefaults.url;
|
|
426
432
|
const fullWidth = (_c = props == null ? void 0 : props.fullWidth) != null ? _c : ButtonPropsDefaults.fullWidth;
|
|
@@ -438,20 +444,22 @@ function Button({ style, props }) {
|
|
|
438
444
|
fontSize: (_h = style == null ? void 0 : style.fontSize) != null ? _h : 16,
|
|
439
445
|
fontFamily: getFontFamily2(style == null ? void 0 : style.fontFamily),
|
|
440
446
|
fontWeight: (_i = style == null ? void 0 : style.fontWeight) != null ? _i : "bold",
|
|
447
|
+
lineHeight: (_j = style == null ? void 0 : style.lineHeight) != null ? _j : void 0,
|
|
448
|
+
letterSpacing: (style == null ? void 0 : style.letterSpacing) != null ? `${style.letterSpacing}px` : void 0,
|
|
441
449
|
backgroundColor: buttonBackgroundColor,
|
|
442
450
|
borderRadius: getRoundedCorners(props),
|
|
443
451
|
display: fullWidth ? "block" : "inline-block",
|
|
444
452
|
padding: `${padding[0]}px ${padding[1]}px`,
|
|
445
453
|
textDecoration: "none"
|
|
446
454
|
};
|
|
447
|
-
return /* @__PURE__ */
|
|
455
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React58__default.default.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
448
456
|
"span",
|
|
449
457
|
{
|
|
450
458
|
dangerouslySetInnerHTML: {
|
|
451
459
|
__html: `<!--[if mso]><i style="letter-spacing: ${padding[1]}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
452
460
|
}
|
|
453
461
|
}
|
|
454
|
-
), /* @__PURE__ */
|
|
462
|
+
), /* @__PURE__ */ React58__default.default.createElement("span", null, text), /* @__PURE__ */ React58__default.default.createElement(
|
|
455
463
|
"span",
|
|
456
464
|
{
|
|
457
465
|
dangerouslySetInnerHTML: {
|
|
@@ -500,7 +508,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
500
508
|
contentAlignment: (_d = props == null ? void 0 : props.contentAlignment) != null ? _d : ColumnsContainerPropsDefaults.contentAlignment,
|
|
501
509
|
fixedWidths: props == null ? void 0 : props.fixedWidths
|
|
502
510
|
};
|
|
503
|
-
return /* @__PURE__ */
|
|
511
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wStyle }, /* @__PURE__ */ React58__default.default.createElement(
|
|
504
512
|
"table",
|
|
505
513
|
{
|
|
506
514
|
align: "center",
|
|
@@ -509,7 +517,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
509
517
|
border: 0,
|
|
510
518
|
style: { tableLayout: "fixed", borderCollapse: "collapse" }
|
|
511
519
|
},
|
|
512
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ React58__default.default.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React58__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React58__default.default.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React58__default.default.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React58__default.default.createElement(TableCell, { index: 2, props: blockProps, columns })))
|
|
513
521
|
));
|
|
514
522
|
}
|
|
515
523
|
function TableCell({ index, props, columns }) {
|
|
@@ -527,7 +535,7 @@ function TableCell({ index, props, columns }) {
|
|
|
527
535
|
width: (_d = (_c = props.fixedWidths) == null ? void 0 : _c[index]) != null ? _d : void 0
|
|
528
536
|
};
|
|
529
537
|
const children = (_e = columns && columns[index]) != null ? _e : null;
|
|
530
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ React58__default.default.createElement("td", { style }, children);
|
|
531
539
|
}
|
|
532
540
|
function getPaddingBefore(index, { columnsGap, columnsCount }) {
|
|
533
541
|
if (index === 0) {
|
|
@@ -589,9 +597,9 @@ function Container({ style, children }) {
|
|
|
589
597
|
padding: getPadding5(style == null ? void 0 : style.padding)
|
|
590
598
|
};
|
|
591
599
|
if (!children) {
|
|
592
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wStyle });
|
|
593
601
|
}
|
|
594
|
-
return /* @__PURE__ */
|
|
602
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wStyle }, children);
|
|
595
603
|
}
|
|
596
604
|
var container_default = Container;
|
|
597
605
|
var COLOR_SCHEMA5 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
@@ -625,7 +633,7 @@ function Divider({ style, props }) {
|
|
|
625
633
|
};
|
|
626
634
|
const borderTopWidth = (_b = props == null ? void 0 : props.lineHeight) != null ? _b : DividerPropsDefaults.lineHeight;
|
|
627
635
|
const borderTopColor = (_c = props == null ? void 0 : props.lineColor) != null ? _c : DividerPropsDefaults.lineColor;
|
|
628
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: st }, /* @__PURE__ */ React58__default.default.createElement(
|
|
629
637
|
"hr",
|
|
630
638
|
{
|
|
631
639
|
style: {
|
|
@@ -690,6 +698,8 @@ var HeadingPropsSchema = zod.z.object({
|
|
|
690
698
|
backgroundColor: COLOR_SCHEMA6,
|
|
691
699
|
fontFamily: FONT_FAMILY_SCHEMA3,
|
|
692
700
|
fontWeight: zod.z.enum(["bold", "normal"]).optional().nullable(),
|
|
701
|
+
lineHeight: zod.z.number().gte(0).optional().nullable(),
|
|
702
|
+
letterSpacing: zod.z.number().optional().nullable(),
|
|
693
703
|
textAlign: zod.z.enum(["left", "center", "right"]).optional().nullable(),
|
|
694
704
|
padding: PADDING_SCHEMA7
|
|
695
705
|
}).optional().nullable()
|
|
@@ -700,14 +710,16 @@ var HeadingPropsDefaults = {
|
|
|
700
710
|
text: ""
|
|
701
711
|
};
|
|
702
712
|
function Heading({ props, style }) {
|
|
703
|
-
var _a, _b, _c, _d, _e, _f;
|
|
713
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
704
714
|
const level = (_a = props == null ? void 0 : props.level) != null ? _a : HeadingPropsDefaults.level;
|
|
705
715
|
const text = (_b = props == null ? void 0 : props.text) != null ? _b : HeadingPropsDefaults.text;
|
|
706
716
|
const hStyle = {
|
|
707
717
|
color: (_c = style == null ? void 0 : style.color) != null ? _c : void 0,
|
|
708
718
|
backgroundColor: (_d = style == null ? void 0 : style.backgroundColor) != null ? _d : void 0,
|
|
709
719
|
fontWeight: (_e = style == null ? void 0 : style.fontWeight) != null ? _e : "bold",
|
|
710
|
-
|
|
720
|
+
lineHeight: (_f = style == null ? void 0 : style.lineHeight) != null ? _f : void 0,
|
|
721
|
+
letterSpacing: (style == null ? void 0 : style.letterSpacing) != null ? `${style.letterSpacing}px` : void 0,
|
|
722
|
+
textAlign: (_g = style == null ? void 0 : style.textAlign) != null ? _g : void 0,
|
|
711
723
|
margin: 0,
|
|
712
724
|
fontFamily: getFontFamily3(style == null ? void 0 : style.fontFamily),
|
|
713
725
|
fontSize: getFontSize(level),
|
|
@@ -715,11 +727,11 @@ function Heading({ props, style }) {
|
|
|
715
727
|
};
|
|
716
728
|
switch (level) {
|
|
717
729
|
case "h1":
|
|
718
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ React58__default.default.createElement("h1", { style: hStyle }, text);
|
|
719
731
|
case "h2":
|
|
720
|
-
return /* @__PURE__ */
|
|
732
|
+
return /* @__PURE__ */ React58__default.default.createElement("h2", { style: hStyle }, text);
|
|
721
733
|
case "h3":
|
|
722
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ React58__default.default.createElement("h3", { style: hStyle }, text);
|
|
723
735
|
}
|
|
724
736
|
}
|
|
725
737
|
function getFontSize(level) {
|
|
@@ -801,9 +813,9 @@ function Html({ style, props }) {
|
|
|
801
813
|
padding: getPadding8(style == null ? void 0 : style.padding)
|
|
802
814
|
};
|
|
803
815
|
if (!children) {
|
|
804
|
-
return /* @__PURE__ */
|
|
816
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: cssStyle });
|
|
805
817
|
}
|
|
806
|
-
return /* @__PURE__ */
|
|
818
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
807
819
|
}
|
|
808
820
|
var html_default = Html;
|
|
809
821
|
var PADDING_SCHEMA9 = zod.z.object({
|
|
@@ -839,7 +851,7 @@ function Image({ style, props }) {
|
|
|
839
851
|
const linkHref = (_c = props == null ? void 0 : props.linkHref) != null ? _c : null;
|
|
840
852
|
const width = (_d = props == null ? void 0 : props.width) != null ? _d : void 0;
|
|
841
853
|
const height = (_e = props == null ? void 0 : props.height) != null ? _e : void 0;
|
|
842
|
-
const imageElement = /* @__PURE__ */
|
|
854
|
+
const imageElement = /* @__PURE__ */ React58__default.default.createElement(
|
|
843
855
|
"img",
|
|
844
856
|
{
|
|
845
857
|
alt: (_f = props == null ? void 0 : props.alt) != null ? _f : "",
|
|
@@ -859,9 +871,9 @@ function Image({ style, props }) {
|
|
|
859
871
|
}
|
|
860
872
|
);
|
|
861
873
|
if (!linkHref) {
|
|
862
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: sectionStyle }, imageElement);
|
|
863
875
|
}
|
|
864
|
-
return /* @__PURE__ */
|
|
876
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React58__default.default.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
|
|
865
877
|
}
|
|
866
878
|
var image_default = Image;
|
|
867
879
|
var FONT_FAMILY_SCHEMA5 = zod.z.enum([
|
|
@@ -1007,7 +1019,7 @@ function Signature({ style, props }) {
|
|
|
1007
1019
|
color: linkColor,
|
|
1008
1020
|
textDecoration: "none"
|
|
1009
1021
|
};
|
|
1010
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
1022
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React58__default.default.createElement(
|
|
1011
1023
|
"img",
|
|
1012
1024
|
{
|
|
1013
1025
|
src: imageUrl,
|
|
@@ -1026,18 +1038,18 @@ function Signature({ style, props }) {
|
|
|
1026
1038
|
}
|
|
1027
1039
|
) : null;
|
|
1028
1040
|
const contactParts = [];
|
|
1029
|
-
if (email) contactParts.push(/* @__PURE__ */
|
|
1030
|
-
if (phone) contactParts.push(/* @__PURE__ */
|
|
1041
|
+
if (email) contactParts.push(/* @__PURE__ */ React58__default.default.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
|
|
1042
|
+
if (phone) contactParts.push(/* @__PURE__ */ React58__default.default.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
|
|
1031
1043
|
if (website) {
|
|
1032
1044
|
const href = website.startsWith("http") ? website : `https://${website}`;
|
|
1033
|
-
contactParts.push(/* @__PURE__ */
|
|
1045
|
+
contactParts.push(/* @__PURE__ */ React58__default.default.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
|
|
1034
1046
|
}
|
|
1035
|
-
const textContent = /* @__PURE__ */
|
|
1036
|
-
const greetingElement = greeting ? /* @__PURE__ */
|
|
1047
|
+
const textContent = /* @__PURE__ */ React58__default.default.createElement("div", null, name && /* @__PURE__ */ React58__default.default.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React58__default.default.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React58__default.default.createElement("span", { style: detailStyle }, " \xB7 "), part))));
|
|
1048
|
+
const greetingElement = greeting ? /* @__PURE__ */ React58__default.default.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
1037
1049
|
if (layout === "vertical") {
|
|
1038
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React58__default.default.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
1039
1051
|
}
|
|
1040
|
-
return /* @__PURE__ */
|
|
1052
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React58__default.default.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React58__default.default.createElement("tbody", null, /* @__PURE__ */ React58__default.default.createElement("tr", null, imageElement && /* @__PURE__ */ React58__default.default.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React58__default.default.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
1041
1053
|
}
|
|
1042
1054
|
var signature_default = Signature;
|
|
1043
1055
|
var SpacerPropsSchema = zod.z.object({
|
|
@@ -1054,13 +1066,13 @@ function Spacer({ props }) {
|
|
|
1054
1066
|
const style = {
|
|
1055
1067
|
height: (_a = props == null ? void 0 : props.height) != null ? _a : SpacerPropsDefaults.height
|
|
1056
1068
|
};
|
|
1057
|
-
return /* @__PURE__ */
|
|
1069
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style });
|
|
1058
1070
|
}
|
|
1059
1071
|
var spacer_default = Spacer;
|
|
1060
1072
|
function buildBlockComponent(blocks) {
|
|
1061
1073
|
return function BlockComponent({ type, data }) {
|
|
1062
1074
|
const Component = blocks[type].Component;
|
|
1063
|
-
return /* @__PURE__ */
|
|
1075
|
+
return /* @__PURE__ */ React58__default.default.createElement(Component, __spreadValues({}, data));
|
|
1064
1076
|
};
|
|
1065
1077
|
}
|
|
1066
1078
|
function buildBlockConfigurationSchema(blocks) {
|
|
@@ -1097,9 +1109,9 @@ function ColumnsContainerReader({ style, props }) {
|
|
|
1097
1109
|
const _a = props != null ? props : {}, { columns } = _a, restProps = __objRest(_a, ["columns"]);
|
|
1098
1110
|
let cols = void 0;
|
|
1099
1111
|
if (columns) {
|
|
1100
|
-
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */
|
|
1112
|
+
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React58__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1101
1113
|
}
|
|
1102
|
-
return /* @__PURE__ */
|
|
1114
|
+
return /* @__PURE__ */ React58__default.default.createElement(columns_container_default, { props: restProps, columns: cols, style });
|
|
1103
1115
|
}
|
|
1104
1116
|
var ContainerPropsSchema2 = zod.z.object({
|
|
1105
1117
|
style: ContainerPropsSchema.shape.style,
|
|
@@ -1110,7 +1122,7 @@ var ContainerPropsSchema2 = zod.z.object({
|
|
|
1110
1122
|
function ContainerReader({ style, props }) {
|
|
1111
1123
|
var _a;
|
|
1112
1124
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
1113
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React58__default.default.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React58__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1114
1126
|
}
|
|
1115
1127
|
var COLOR_SCHEMA9 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
1116
1128
|
var FONT_FAMILY_SCHEMA6 = zod.z.enum([
|
|
@@ -1126,7 +1138,8 @@ var FONT_FAMILY_SCHEMA6 = zod.z.enum([
|
|
|
1126
1138
|
]).nullable().optional();
|
|
1127
1139
|
var TemplateVariableSchema = zod.z.object({
|
|
1128
1140
|
name: zod.z.string(),
|
|
1129
|
-
description: zod.z.string().optional().nullable()
|
|
1141
|
+
description: zod.z.string().optional().nullable(),
|
|
1142
|
+
sampleValue: zod.z.string().optional().nullable()
|
|
1130
1143
|
});
|
|
1131
1144
|
var EmailLayoutPropsSchema = zod.z.object({
|
|
1132
1145
|
backdropColor: COLOR_SCHEMA9,
|
|
@@ -1182,9 +1195,9 @@ function EmailLayoutReader(props) {
|
|
|
1182
1195
|
margin: "0"
|
|
1183
1196
|
};
|
|
1184
1197
|
if (props.backdropDisabled) {
|
|
1185
|
-
return /* @__PURE__ */
|
|
1198
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React58__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1186
1199
|
}
|
|
1187
|
-
return /* @__PURE__ */
|
|
1200
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
1188
1201
|
"div",
|
|
1189
1202
|
{
|
|
1190
1203
|
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
@@ -1194,7 +1207,7 @@ function EmailLayoutReader(props) {
|
|
|
1194
1207
|
width: "100%"
|
|
1195
1208
|
})
|
|
1196
1209
|
},
|
|
1197
|
-
/* @__PURE__ */
|
|
1210
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
1198
1211
|
"table",
|
|
1199
1212
|
{
|
|
1200
1213
|
align: "center",
|
|
@@ -1212,19 +1225,19 @@ function EmailLayoutReader(props) {
|
|
|
1212
1225
|
cellPadding: "0",
|
|
1213
1226
|
border: 0
|
|
1214
1227
|
},
|
|
1215
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ React58__default.default.createElement("tbody", null, /* @__PURE__ */ React58__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React58__default.default.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React58__default.default.createElement(ReaderBlock, { key: childId, id: childId })))))
|
|
1216
1229
|
)
|
|
1217
1230
|
);
|
|
1218
1231
|
}
|
|
1219
1232
|
|
|
1220
1233
|
// src/email-builder/reader/core.tsx
|
|
1221
|
-
var ReaderContext =
|
|
1234
|
+
var ReaderContext = React58.createContext({});
|
|
1222
1235
|
function useReaderDocument() {
|
|
1223
|
-
return
|
|
1236
|
+
return React58.useContext(ReaderContext);
|
|
1224
1237
|
}
|
|
1225
1238
|
function ReaderBlock({ id }) {
|
|
1226
1239
|
const document2 = useReaderDocument();
|
|
1227
|
-
return document2[id] ? /* @__PURE__ */
|
|
1240
|
+
return document2[id] ? /* @__PURE__ */ React58__default.default.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
|
|
1228
1241
|
}
|
|
1229
1242
|
var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
1230
1243
|
ColumnsContainer: {
|
|
@@ -1281,13 +1294,13 @@ var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
|
|
|
1281
1294
|
var ReaderDocumentSchema = zod.z.record(zod.z.string(), ReaderBlockSchema);
|
|
1282
1295
|
var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
|
|
1283
1296
|
function Reader({ document: document2, rootBlockId }) {
|
|
1284
|
-
return /* @__PURE__ */
|
|
1297
|
+
return /* @__PURE__ */ React58__default.default.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React58__default.default.createElement(ReaderBlock, { id: rootBlockId }));
|
|
1285
1298
|
}
|
|
1286
1299
|
|
|
1287
1300
|
// src/email-builder/renderers/render-to-static-markup.tsx
|
|
1288
1301
|
function renderToStaticMarkup(document2, { rootBlockId }) {
|
|
1289
1302
|
return "<!DOCTYPE html>" + server.renderToStaticMarkup(
|
|
1290
|
-
/* @__PURE__ */
|
|
1303
|
+
/* @__PURE__ */ React58__default.default.createElement("html", null, /* @__PURE__ */ React58__default.default.createElement("body", null, /* @__PURE__ */ React58__default.default.createElement(Reader, { document: document2, rootBlockId })))
|
|
1291
1304
|
);
|
|
1292
1305
|
}
|
|
1293
1306
|
|
|
@@ -1955,7 +1968,8 @@ var editorStateStore = zustand.create(() => ({
|
|
|
1955
1968
|
selectedScreenSize: "desktop",
|
|
1956
1969
|
inspectorDrawerOpen: true,
|
|
1957
1970
|
samplesDrawerOpen: true,
|
|
1958
|
-
persistenceEnabled: false
|
|
1971
|
+
persistenceEnabled: false,
|
|
1972
|
+
lastFocusedEditable: null
|
|
1959
1973
|
}));
|
|
1960
1974
|
function useDocument() {
|
|
1961
1975
|
return editorStateStore((s) => s.document);
|
|
@@ -2028,6 +2042,15 @@ function setSelectedScreenSize(selectedScreenSize) {
|
|
|
2028
2042
|
function setPersistenceEnabled(persistenceEnabled) {
|
|
2029
2043
|
return editorStateStore.setState({ persistenceEnabled });
|
|
2030
2044
|
}
|
|
2045
|
+
function useLastFocusedEditable() {
|
|
2046
|
+
return editorStateStore((s) => s.lastFocusedEditable);
|
|
2047
|
+
}
|
|
2048
|
+
function getLastFocusedEditable() {
|
|
2049
|
+
return editorStateStore.getState().lastFocusedEditable;
|
|
2050
|
+
}
|
|
2051
|
+
function setLastFocusedEditable(lastFocusedEditable) {
|
|
2052
|
+
return editorStateStore.setState({ lastFocusedEditable });
|
|
2053
|
+
}
|
|
2031
2054
|
|
|
2032
2055
|
// src/app/save-payload.ts
|
|
2033
2056
|
var ROOT_BLOCK_ID = "root";
|
|
@@ -2045,20 +2068,20 @@ function buildSavePayload(doc) {
|
|
|
2045
2068
|
}
|
|
2046
2069
|
|
|
2047
2070
|
// src/app/context.tsx
|
|
2048
|
-
var EmailEditorContext =
|
|
2071
|
+
var EmailEditorContext = React58.createContext(null);
|
|
2049
2072
|
var EmailEditorProvider = ({
|
|
2050
2073
|
children,
|
|
2051
2074
|
initialTemplateId = null,
|
|
2052
2075
|
initialTemplateName = null,
|
|
2053
2076
|
onSave
|
|
2054
2077
|
}) => {
|
|
2055
|
-
const [currentTemplateId, setCurrentTemplateId] =
|
|
2056
|
-
const [currentTemplateName, setCurrentTemplateName] =
|
|
2057
|
-
const [currentTemplateKind, setCurrentTemplateKind] =
|
|
2058
|
-
const saveListenersRef =
|
|
2059
|
-
const onSaveRef =
|
|
2078
|
+
const [currentTemplateId, setCurrentTemplateId] = React58.useState(initialTemplateId);
|
|
2079
|
+
const [currentTemplateName, setCurrentTemplateName] = React58.useState(initialTemplateName);
|
|
2080
|
+
const [currentTemplateKind, setCurrentTemplateKind] = React58.useState(null);
|
|
2081
|
+
const saveListenersRef = React58.useRef([]);
|
|
2082
|
+
const onSaveRef = React58.useRef(onSave);
|
|
2060
2083
|
onSaveRef.current = onSave;
|
|
2061
|
-
const saveTemplate =
|
|
2084
|
+
const saveTemplate = React58.useCallback(() => {
|
|
2062
2085
|
const currentDoc = getDocument();
|
|
2063
2086
|
saveListenersRef.current.forEach((listener) => listener(currentDoc));
|
|
2064
2087
|
if (onSaveRef.current) {
|
|
@@ -2066,7 +2089,7 @@ var EmailEditorProvider = ({
|
|
|
2066
2089
|
}
|
|
2067
2090
|
return currentDoc;
|
|
2068
2091
|
}, []);
|
|
2069
|
-
const loadTemplate =
|
|
2092
|
+
const loadTemplate = React58.useCallback((newTemplate, templateId, templateName, kind) => {
|
|
2070
2093
|
if (templateId !== void 0) {
|
|
2071
2094
|
setCurrentTemplateId(templateId);
|
|
2072
2095
|
}
|
|
@@ -2077,20 +2100,20 @@ var EmailEditorProvider = ({
|
|
|
2077
2100
|
setCurrentTemplateKind(kind);
|
|
2078
2101
|
}
|
|
2079
2102
|
}, []);
|
|
2080
|
-
const setCurrentTemplate =
|
|
2103
|
+
const setCurrentTemplate = React58.useCallback((templateId, templateName, kind) => {
|
|
2081
2104
|
setCurrentTemplateId(templateId);
|
|
2082
2105
|
setCurrentTemplateName(templateName);
|
|
2083
2106
|
if (kind !== void 0) {
|
|
2084
2107
|
setCurrentTemplateKind(kind);
|
|
2085
2108
|
}
|
|
2086
2109
|
}, []);
|
|
2087
|
-
const registerSaveListener =
|
|
2110
|
+
const registerSaveListener = React58.useCallback((callback) => {
|
|
2088
2111
|
saveListenersRef.current = [...saveListenersRef.current, callback];
|
|
2089
2112
|
return () => {
|
|
2090
2113
|
saveListenersRef.current = saveListenersRef.current.filter((listener) => listener !== callback);
|
|
2091
2114
|
};
|
|
2092
2115
|
}, []);
|
|
2093
|
-
const value =
|
|
2116
|
+
const value = React58.useMemo(() => ({
|
|
2094
2117
|
currentTemplateId,
|
|
2095
2118
|
currentTemplateName,
|
|
2096
2119
|
currentTemplateKind,
|
|
@@ -2099,24 +2122,34 @@ var EmailEditorProvider = ({
|
|
|
2099
2122
|
registerSaveListener,
|
|
2100
2123
|
setCurrentTemplate
|
|
2101
2124
|
}), [currentTemplateId, currentTemplateName, currentTemplateKind, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2102
|
-
return /* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ React58__default.default.createElement(EmailEditorContext.Provider, { value }, children);
|
|
2103
2126
|
};
|
|
2104
2127
|
var useEmailEditor = () => {
|
|
2105
|
-
const context =
|
|
2128
|
+
const context = React58.useContext(EmailEditorContext);
|
|
2106
2129
|
if (!context) {
|
|
2107
2130
|
throw new Error("useEmailEditor must be used within an EmailEditorProvider");
|
|
2108
2131
|
}
|
|
2109
2132
|
return context;
|
|
2110
2133
|
};
|
|
2134
|
+
var ImageCallbacksContext = React58.createContext({});
|
|
2135
|
+
function ImageCallbacksProvider({
|
|
2136
|
+
callbacks,
|
|
2137
|
+
children
|
|
2138
|
+
}) {
|
|
2139
|
+
return /* @__PURE__ */ React58__default.default.createElement(ImageCallbacksContext.Provider, { value: callbacks }, children);
|
|
2140
|
+
}
|
|
2141
|
+
function useImageCallbacks() {
|
|
2142
|
+
return React58.useContext(ImageCallbacksContext);
|
|
2143
|
+
}
|
|
2111
2144
|
function BaseSidebarPanel({ title, children }) {
|
|
2112
|
-
return /* @__PURE__ */
|
|
2145
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, title), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 5, mb: 3 }, children));
|
|
2113
2146
|
}
|
|
2114
2147
|
function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
2115
|
-
const [value, setValue] =
|
|
2116
|
-
|
|
2148
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
2149
|
+
React58.useEffect(() => {
|
|
2117
2150
|
setValue(defaultValue);
|
|
2118
2151
|
}, [defaultValue]);
|
|
2119
|
-
return /* @__PURE__ */
|
|
2152
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React58__default.default.createElement(
|
|
2120
2153
|
material.ToggleButtonGroup,
|
|
2121
2154
|
{
|
|
2122
2155
|
exclusive: true,
|
|
@@ -2136,7 +2169,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
|
2136
2169
|
}
|
|
2137
2170
|
function RawSliderInput(_a) {
|
|
2138
2171
|
var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
|
|
2139
|
-
return /* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React58__default.default.createElement(
|
|
2140
2173
|
material.Slider,
|
|
2141
2174
|
__spreadProps(__spreadValues({}, props), {
|
|
2142
2175
|
value,
|
|
@@ -2147,14 +2180,14 @@ function RawSliderInput(_a) {
|
|
|
2147
2180
|
setValue(value2);
|
|
2148
2181
|
}
|
|
2149
2182
|
})
|
|
2150
|
-
), /* @__PURE__ */
|
|
2183
|
+
), /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
|
|
2151
2184
|
}
|
|
2152
2185
|
|
|
2153
2186
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
|
|
2154
2187
|
function SliderInput(_a) {
|
|
2155
2188
|
var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
|
|
2156
|
-
const [value, setValue] =
|
|
2157
|
-
return /* @__PURE__ */
|
|
2189
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
2190
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React58__default.default.createElement(
|
|
2158
2191
|
RawSliderInput,
|
|
2159
2192
|
__spreadValues({
|
|
2160
2193
|
value,
|
|
@@ -2166,12 +2199,12 @@ function SliderInput(_a) {
|
|
|
2166
2199
|
));
|
|
2167
2200
|
}
|
|
2168
2201
|
function TextInput({ helperText, label, placeholder, rows, InputProps: InputProps2, defaultValue, onChange }) {
|
|
2169
|
-
const [value, setValue] =
|
|
2202
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
2170
2203
|
const isMultiline = typeof rows === "number" && rows > 1;
|
|
2171
|
-
|
|
2204
|
+
React58.useEffect(() => {
|
|
2172
2205
|
setValue(defaultValue);
|
|
2173
2206
|
}, [defaultValue]);
|
|
2174
|
-
return /* @__PURE__ */
|
|
2207
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2175
2208
|
material.TextField,
|
|
2176
2209
|
{
|
|
2177
2210
|
fullWidth: true,
|
|
@@ -2197,7 +2230,7 @@ var TILE_BUTTON = {
|
|
|
2197
2230
|
};
|
|
2198
2231
|
function Swatch({ paletteColors, value, onChange }) {
|
|
2199
2232
|
const renderButton2 = (colorValue) => {
|
|
2200
|
-
return /* @__PURE__ */
|
|
2233
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2201
2234
|
material.Button,
|
|
2202
2235
|
{
|
|
2203
2236
|
key: colorValue,
|
|
@@ -2216,7 +2249,7 @@ function Swatch({ paletteColors, value, onChange }) {
|
|
|
2216
2249
|
}
|
|
2217
2250
|
);
|
|
2218
2251
|
};
|
|
2219
|
-
return /* @__PURE__ */
|
|
2252
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
|
|
2220
2253
|
}
|
|
2221
2254
|
|
|
2222
2255
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
|
|
@@ -2283,7 +2316,7 @@ var SX = {
|
|
|
2283
2316
|
}
|
|
2284
2317
|
};
|
|
2285
2318
|
function Picker({ value, onChange }) {
|
|
2286
|
-
return /* @__PURE__ */
|
|
2319
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React58__default.default.createElement(reactColorful.HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React58__default.default.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React58__default.default.createElement(material.Box, { pt: 1 }, /* @__PURE__ */ React58__default.default.createElement(reactColorful.HexColorInput, { prefixed: true, color: value, onChange })));
|
|
2287
2320
|
}
|
|
2288
2321
|
|
|
2289
2322
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
|
|
@@ -2296,8 +2329,8 @@ var BUTTON_SX = {
|
|
|
2296
2329
|
bgcolor: "#FFFFFF"
|
|
2297
2330
|
};
|
|
2298
2331
|
function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
2299
|
-
const [anchorEl, setAnchorEl] =
|
|
2300
|
-
const [value, setValue] =
|
|
2332
|
+
const [anchorEl, setAnchorEl] = React58.useState(null);
|
|
2333
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
2301
2334
|
const handleClickOpen = (event) => {
|
|
2302
2335
|
setAnchorEl(event.currentTarget);
|
|
2303
2336
|
};
|
|
@@ -2308,7 +2341,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2308
2341
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2309
2342
|
return null;
|
|
2310
2343
|
}
|
|
2311
|
-
return /* @__PURE__ */
|
|
2344
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2312
2345
|
material.ButtonBase,
|
|
2313
2346
|
{
|
|
2314
2347
|
onClick: () => {
|
|
@@ -2316,16 +2349,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2316
2349
|
onChange(null);
|
|
2317
2350
|
}
|
|
2318
2351
|
},
|
|
2319
|
-
/* @__PURE__ */
|
|
2352
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
|
|
2320
2353
|
);
|
|
2321
2354
|
};
|
|
2322
2355
|
const renderOpenButton = () => {
|
|
2323
2356
|
if (value) {
|
|
2324
|
-
return /* @__PURE__ */
|
|
2357
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
|
|
2325
2358
|
}
|
|
2326
|
-
return /* @__PURE__ */
|
|
2359
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" }));
|
|
2327
2360
|
};
|
|
2328
|
-
return /* @__PURE__ */
|
|
2361
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(material.InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React58__default.default.createElement(
|
|
2329
2362
|
material.Menu,
|
|
2330
2363
|
{
|
|
2331
2364
|
anchorEl,
|
|
@@ -2335,7 +2368,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2335
2368
|
sx: { height: "auto", padding: 0 }
|
|
2336
2369
|
}
|
|
2337
2370
|
},
|
|
2338
|
-
/* @__PURE__ */
|
|
2371
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
2339
2372
|
Picker,
|
|
2340
2373
|
{
|
|
2341
2374
|
value: value || "",
|
|
@@ -2350,10 +2383,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2350
2383
|
|
|
2351
2384
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
|
|
2352
2385
|
function ColorInput2(props) {
|
|
2353
|
-
return /* @__PURE__ */
|
|
2386
|
+
return /* @__PURE__ */ React58__default.default.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
|
|
2354
2387
|
}
|
|
2355
2388
|
function NullableColorInput(props) {
|
|
2356
|
-
return /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ React58__default.default.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
|
|
2357
2390
|
}
|
|
2358
2391
|
|
|
2359
2392
|
// src/editor/blocks/helpers/font-family.ts
|
|
@@ -2406,13 +2439,13 @@ var FONT_FAMILIES = [
|
|
|
2406
2439
|
];
|
|
2407
2440
|
|
|
2408
2441
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
|
|
2409
|
-
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */
|
|
2442
|
+
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React58__default.default.createElement(material.MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
|
|
2410
2443
|
function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
2411
|
-
const [value, setValue] =
|
|
2412
|
-
|
|
2444
|
+
const [value, setValue] = React58.useState(defaultValue != null ? defaultValue : "inherit");
|
|
2445
|
+
React58.useEffect(() => {
|
|
2413
2446
|
setValue(defaultValue != null ? defaultValue : "inherit");
|
|
2414
2447
|
}, [defaultValue]);
|
|
2415
|
-
return /* @__PURE__ */
|
|
2448
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2416
2449
|
material.TextField,
|
|
2417
2450
|
{
|
|
2418
2451
|
select: true,
|
|
@@ -2425,23 +2458,23 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
|
2425
2458
|
onChange(v === null ? null : v);
|
|
2426
2459
|
}
|
|
2427
2460
|
},
|
|
2428
|
-
/* @__PURE__ */
|
|
2461
|
+
/* @__PURE__ */ React58__default.default.createElement(material.MenuItem, { value: "inherit" }, "Match email settings"),
|
|
2429
2462
|
OPTIONS
|
|
2430
2463
|
);
|
|
2431
2464
|
}
|
|
2432
2465
|
function FontSizeInput({ label, defaultValue, onChange }) {
|
|
2433
|
-
const [value, setValue] =
|
|
2434
|
-
|
|
2466
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
2467
|
+
React58.useEffect(() => {
|
|
2435
2468
|
setValue(defaultValue);
|
|
2436
2469
|
}, [defaultValue]);
|
|
2437
2470
|
const handleChange = (value2) => {
|
|
2438
2471
|
setValue(value2);
|
|
2439
2472
|
onChange(value2);
|
|
2440
2473
|
};
|
|
2441
|
-
return /* @__PURE__ */
|
|
2474
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React58__default.default.createElement(
|
|
2442
2475
|
RawSliderInput,
|
|
2443
2476
|
{
|
|
2444
|
-
iconLabel: /* @__PURE__ */
|
|
2477
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.TextFieldsOutlined, { sx: { fontSize: 16 } }),
|
|
2445
2478
|
value,
|
|
2446
2479
|
setValue: handleChange,
|
|
2447
2480
|
units: "px",
|
|
@@ -2452,11 +2485,11 @@ function FontSizeInput({ label, defaultValue, onChange }) {
|
|
|
2452
2485
|
));
|
|
2453
2486
|
}
|
|
2454
2487
|
function FontWeightInput({ label, defaultValue, onChange }) {
|
|
2455
|
-
const [value, setValue] =
|
|
2456
|
-
|
|
2488
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
2489
|
+
React58.useEffect(() => {
|
|
2457
2490
|
setValue(defaultValue);
|
|
2458
2491
|
}, [defaultValue]);
|
|
2459
|
-
return /* @__PURE__ */
|
|
2492
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2460
2493
|
RadioGroupInput,
|
|
2461
2494
|
{
|
|
2462
2495
|
label,
|
|
@@ -2466,12 +2499,69 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2466
2499
|
onChange(fontWeight);
|
|
2467
2500
|
}
|
|
2468
2501
|
},
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2502
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "normal" }, "Regular"),
|
|
2503
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "bold" }, "Bold")
|
|
2471
2504
|
);
|
|
2472
2505
|
}
|
|
2506
|
+
function LetterSpacingInput({ label, defaultValue, onChange }) {
|
|
2507
|
+
const handleChange = (ev) => {
|
|
2508
|
+
const raw = ev.target.value.trim();
|
|
2509
|
+
if (raw === "") {
|
|
2510
|
+
onChange(null);
|
|
2511
|
+
return;
|
|
2512
|
+
}
|
|
2513
|
+
const value = parseFloat(raw);
|
|
2514
|
+
onChange(isNaN(value) ? null : value);
|
|
2515
|
+
};
|
|
2516
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2517
|
+
material.TextField,
|
|
2518
|
+
{
|
|
2519
|
+
fullWidth: true,
|
|
2520
|
+
onChange: handleChange,
|
|
2521
|
+
defaultValue: defaultValue != null ? defaultValue : "",
|
|
2522
|
+
label,
|
|
2523
|
+
variant: "standard",
|
|
2524
|
+
placeholder: "normal",
|
|
2525
|
+
size: "small",
|
|
2526
|
+
type: "number",
|
|
2527
|
+
inputProps: { step: 0.5 },
|
|
2528
|
+
InputProps: {
|
|
2529
|
+
startAdornment: /* @__PURE__ */ React58__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SpaceBarOutlined, { sx: { fontSize: 16 } })),
|
|
2530
|
+
endAdornment: /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
));
|
|
2534
|
+
}
|
|
2535
|
+
function LineHeightInput({ label, defaultValue, onChange }) {
|
|
2536
|
+
const handleChange = (ev) => {
|
|
2537
|
+
const raw = ev.target.value.trim();
|
|
2538
|
+
if (raw === "") {
|
|
2539
|
+
onChange(null);
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
const value = parseFloat(raw);
|
|
2543
|
+
onChange(isNaN(value) ? null : value);
|
|
2544
|
+
};
|
|
2545
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2546
|
+
material.TextField,
|
|
2547
|
+
{
|
|
2548
|
+
fullWidth: true,
|
|
2549
|
+
onChange: handleChange,
|
|
2550
|
+
defaultValue: defaultValue != null ? defaultValue : "",
|
|
2551
|
+
label,
|
|
2552
|
+
variant: "standard",
|
|
2553
|
+
placeholder: "default",
|
|
2554
|
+
size: "small",
|
|
2555
|
+
type: "number",
|
|
2556
|
+
inputProps: { step: 0.1 },
|
|
2557
|
+
InputProps: {
|
|
2558
|
+
startAdornment: /* @__PURE__ */ React58__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FormatLineSpacingOutlined, { sx: { fontSize: 16 } }))
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
));
|
|
2562
|
+
}
|
|
2473
2563
|
function PaddingInput({ label, defaultValue, onChange }) {
|
|
2474
|
-
const [value, setValue] =
|
|
2564
|
+
const [value, setValue] = React58.useState(() => {
|
|
2475
2565
|
if (defaultValue) {
|
|
2476
2566
|
return defaultValue;
|
|
2477
2567
|
}
|
|
@@ -2489,10 +2579,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2489
2579
|
setValue(v);
|
|
2490
2580
|
onChange(v);
|
|
2491
2581
|
}
|
|
2492
|
-
return /* @__PURE__ */
|
|
2582
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React58__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React58__default.default.createElement(
|
|
2493
2583
|
RawSliderInput,
|
|
2494
2584
|
{
|
|
2495
|
-
iconLabel: /* @__PURE__ */
|
|
2585
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
|
|
2496
2586
|
value: value.top,
|
|
2497
2587
|
setValue: (num) => handleChange("top", num),
|
|
2498
2588
|
units: "px",
|
|
@@ -2501,10 +2591,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2501
2591
|
max: 80,
|
|
2502
2592
|
marks: true
|
|
2503
2593
|
}
|
|
2504
|
-
), /* @__PURE__ */
|
|
2594
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2505
2595
|
RawSliderInput,
|
|
2506
2596
|
{
|
|
2507
|
-
iconLabel: /* @__PURE__ */
|
|
2597
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
|
|
2508
2598
|
value: value.bottom,
|
|
2509
2599
|
setValue: (num) => handleChange("bottom", num),
|
|
2510
2600
|
units: "px",
|
|
@@ -2513,10 +2603,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2513
2603
|
max: 80,
|
|
2514
2604
|
marks: true
|
|
2515
2605
|
}
|
|
2516
|
-
), /* @__PURE__ */
|
|
2606
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2517
2607
|
RawSliderInput,
|
|
2518
2608
|
{
|
|
2519
|
-
iconLabel: /* @__PURE__ */
|
|
2609
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
|
|
2520
2610
|
value: value.left,
|
|
2521
2611
|
setValue: (num) => handleChange("left", num),
|
|
2522
2612
|
units: "px",
|
|
@@ -2525,10 +2615,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2525
2615
|
max: 80,
|
|
2526
2616
|
marks: true
|
|
2527
2617
|
}
|
|
2528
|
-
), /* @__PURE__ */
|
|
2618
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2529
2619
|
RawSliderInput,
|
|
2530
2620
|
{
|
|
2531
|
-
iconLabel: /* @__PURE__ */
|
|
2621
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
|
|
2532
2622
|
value: value.right,
|
|
2533
2623
|
setValue: (num) => handleChange("right", num),
|
|
2534
2624
|
units: "px",
|
|
@@ -2540,11 +2630,11 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2540
2630
|
));
|
|
2541
2631
|
}
|
|
2542
2632
|
function TextAlignInput({ label, defaultValue, onChange }) {
|
|
2543
|
-
const [value, setValue] =
|
|
2544
|
-
|
|
2633
|
+
const [value, setValue] = React58.useState(defaultValue != null ? defaultValue : "left");
|
|
2634
|
+
React58.useEffect(() => {
|
|
2545
2635
|
setValue(defaultValue != null ? defaultValue : "left");
|
|
2546
2636
|
}, [defaultValue]);
|
|
2547
|
-
return /* @__PURE__ */
|
|
2637
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2548
2638
|
RadioGroupInput,
|
|
2549
2639
|
{
|
|
2550
2640
|
label,
|
|
@@ -2554,9 +2644,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2554
2644
|
onChange(value2);
|
|
2555
2645
|
}
|
|
2556
2646
|
},
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "left" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FormatAlignLeftOutlined, { fontSize: "small" })),
|
|
2648
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "center" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FormatAlignCenterOutlined, { fontSize: "small" })),
|
|
2649
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "right" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FormatAlignRightOutlined, { fontSize: "small" }))
|
|
2560
2650
|
);
|
|
2561
2651
|
}
|
|
2562
2652
|
|
|
@@ -2569,14 +2659,14 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2569
2659
|
};
|
|
2570
2660
|
switch (name) {
|
|
2571
2661
|
case "backgroundColor":
|
|
2572
|
-
return /* @__PURE__ */
|
|
2662
|
+
return /* @__PURE__ */ React58__default.default.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
|
|
2573
2663
|
case "borderColor":
|
|
2574
|
-
return /* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ React58__default.default.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
|
|
2575
2665
|
case "borderRadius":
|
|
2576
|
-
return /* @__PURE__ */
|
|
2666
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2577
2667
|
SliderInput,
|
|
2578
2668
|
{
|
|
2579
|
-
iconLabel: /* @__PURE__ */
|
|
2669
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.RoundedCornerOutlined, null),
|
|
2580
2670
|
units: "px",
|
|
2581
2671
|
step: 4,
|
|
2582
2672
|
marks: true,
|
|
@@ -2588,29 +2678,33 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2588
2678
|
}
|
|
2589
2679
|
);
|
|
2590
2680
|
case "color":
|
|
2591
|
-
return /* @__PURE__ */
|
|
2681
|
+
return /* @__PURE__ */ React58__default.default.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
|
|
2592
2682
|
case "fontFamily":
|
|
2593
|
-
return /* @__PURE__ */
|
|
2683
|
+
return /* @__PURE__ */ React58__default.default.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
|
|
2594
2684
|
case "fontSize":
|
|
2595
|
-
return /* @__PURE__ */
|
|
2685
|
+
return /* @__PURE__ */ React58__default.default.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
|
|
2596
2686
|
case "fontWeight":
|
|
2597
|
-
return /* @__PURE__ */
|
|
2687
|
+
return /* @__PURE__ */ React58__default.default.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
|
|
2688
|
+
case "lineHeight":
|
|
2689
|
+
return /* @__PURE__ */ React58__default.default.createElement(LineHeightInput, { label: "Line height", defaultValue, onChange: handleChange });
|
|
2690
|
+
case "letterSpacing":
|
|
2691
|
+
return /* @__PURE__ */ React58__default.default.createElement(LetterSpacingInput, { label: "Letter spacing", defaultValue, onChange: handleChange });
|
|
2598
2692
|
case "textAlign":
|
|
2599
|
-
return /* @__PURE__ */
|
|
2693
|
+
return /* @__PURE__ */ React58__default.default.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
|
|
2600
2694
|
case "padding":
|
|
2601
|
-
return /* @__PURE__ */
|
|
2695
|
+
return /* @__PURE__ */ React58__default.default.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
|
|
2602
2696
|
}
|
|
2603
2697
|
}
|
|
2604
2698
|
|
|
2605
2699
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
|
|
2606
2700
|
function MultiStylePropertyPanel({ names, value, onChange }) {
|
|
2607
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, names.map((name) => /* @__PURE__ */ React58__default.default.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
|
|
2608
2702
|
}
|
|
2609
2703
|
|
|
2610
2704
|
// src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
|
|
2611
2705
|
function AvatarSidebarPanel({ data, setData }) {
|
|
2612
2706
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2613
|
-
const [, setErrors] =
|
|
2707
|
+
const [, setErrors] = React58.useState(null);
|
|
2614
2708
|
const updateData = (d) => {
|
|
2615
2709
|
const res = AvatarPropsSchema.safeParse(d);
|
|
2616
2710
|
if (res.success) {
|
|
@@ -2624,11 +2718,11 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2624
2718
|
const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
|
|
2625
2719
|
const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
|
|
2626
2720
|
const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
|
|
2627
|
-
return /* @__PURE__ */
|
|
2721
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2628
2722
|
SliderInput,
|
|
2629
2723
|
{
|
|
2630
2724
|
label: "Size",
|
|
2631
|
-
iconLabel: /* @__PURE__ */
|
|
2725
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
2632
2726
|
units: "px",
|
|
2633
2727
|
step: 3,
|
|
2634
2728
|
min: 32,
|
|
@@ -2638,7 +2732,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2638
2732
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
|
|
2639
2733
|
}
|
|
2640
2734
|
}
|
|
2641
|
-
), /* @__PURE__ */
|
|
2735
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2642
2736
|
RadioGroupInput,
|
|
2643
2737
|
{
|
|
2644
2738
|
label: "Shape",
|
|
@@ -2647,10 +2741,10 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2647
2741
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
|
|
2648
2742
|
}
|
|
2649
2743
|
},
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
), /* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "circle" }, "Circle"),
|
|
2745
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "square" }, "Square"),
|
|
2746
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded")
|
|
2747
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2654
2748
|
TextInput,
|
|
2655
2749
|
{
|
|
2656
2750
|
label: "Image URL",
|
|
@@ -2659,7 +2753,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2659
2753
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
|
|
2660
2754
|
}
|
|
2661
2755
|
}
|
|
2662
|
-
), /* @__PURE__ */
|
|
2756
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2663
2757
|
TextInput,
|
|
2664
2758
|
{
|
|
2665
2759
|
label: "Alt text",
|
|
@@ -2668,7 +2762,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2668
2762
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
|
|
2669
2763
|
}
|
|
2670
2764
|
}
|
|
2671
|
-
), /* @__PURE__ */
|
|
2765
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2672
2766
|
MultiStylePropertyPanel,
|
|
2673
2767
|
{
|
|
2674
2768
|
names: ["textAlign", "padding"],
|
|
@@ -2679,7 +2773,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2679
2773
|
}
|
|
2680
2774
|
function ButtonSidebarPanel({ data, setData }) {
|
|
2681
2775
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2682
|
-
const [, setErrors] =
|
|
2776
|
+
const [, setErrors] = React58.useState(null);
|
|
2683
2777
|
const updateData = (d) => {
|
|
2684
2778
|
const res = ButtonPropsSchema.safeParse(d);
|
|
2685
2779
|
if (res.success) {
|
|
@@ -2696,68 +2790,77 @@ function ButtonSidebarPanel({ data, setData }) {
|
|
|
2696
2790
|
const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
|
|
2697
2791
|
const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
|
|
2698
2792
|
const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
|
|
2699
|
-
return /* @__PURE__ */
|
|
2793
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2700
2794
|
TextInput,
|
|
2701
2795
|
{
|
|
2702
2796
|
label: "Text",
|
|
2703
2797
|
defaultValue: text,
|
|
2704
2798
|
onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
|
|
2705
2799
|
}
|
|
2706
|
-
), /* @__PURE__ */
|
|
2800
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2707
2801
|
TextInput,
|
|
2708
2802
|
{
|
|
2709
2803
|
label: "Url",
|
|
2710
2804
|
defaultValue: url,
|
|
2711
2805
|
onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
|
|
2712
2806
|
}
|
|
2713
|
-
), /* @__PURE__ */
|
|
2807
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2714
2808
|
RadioGroupInput,
|
|
2715
2809
|
{
|
|
2716
2810
|
label: "Width",
|
|
2717
2811
|
defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
|
|
2718
2812
|
onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
|
|
2719
2813
|
},
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
), /* @__PURE__ */
|
|
2814
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "FULL_WIDTH" }, "Full"),
|
|
2815
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "AUTO" }, "Auto")
|
|
2816
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2723
2817
|
RadioGroupInput,
|
|
2724
2818
|
{
|
|
2725
2819
|
label: "Size",
|
|
2726
2820
|
defaultValue: size,
|
|
2727
2821
|
onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
|
|
2728
2822
|
},
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
), /* @__PURE__ */
|
|
2823
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "x-small" }, "Xs"),
|
|
2824
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "small" }, "Sm"),
|
|
2825
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "medium" }, "Md"),
|
|
2826
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "large" }, "Lg")
|
|
2827
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2734
2828
|
RadioGroupInput,
|
|
2735
2829
|
{
|
|
2736
2830
|
label: "Style",
|
|
2737
2831
|
defaultValue: buttonStyle,
|
|
2738
2832
|
onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
|
|
2739
2833
|
},
|
|
2740
|
-
/* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
/* @__PURE__ */
|
|
2743
|
-
), /* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "rectangle" }, "Rectangle"),
|
|
2835
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded"),
|
|
2836
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "pill" }, "Pill")
|
|
2837
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2744
2838
|
ColorInput2,
|
|
2745
2839
|
{
|
|
2746
2840
|
label: "Text color",
|
|
2747
2841
|
defaultValue: buttonTextColor,
|
|
2748
2842
|
onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
|
|
2749
2843
|
}
|
|
2750
|
-
), /* @__PURE__ */
|
|
2844
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2751
2845
|
ColorInput2,
|
|
2752
2846
|
{
|
|
2753
2847
|
label: "Button color",
|
|
2754
2848
|
defaultValue: buttonBackgroundColor,
|
|
2755
2849
|
onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
|
|
2756
2850
|
}
|
|
2757
|
-
), /* @__PURE__ */
|
|
2851
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2758
2852
|
MultiStylePropertyPanel,
|
|
2759
2853
|
{
|
|
2760
|
-
names: [
|
|
2854
|
+
names: [
|
|
2855
|
+
"backgroundColor",
|
|
2856
|
+
"fontFamily",
|
|
2857
|
+
"fontSize",
|
|
2858
|
+
"fontWeight",
|
|
2859
|
+
"lineHeight",
|
|
2860
|
+
"letterSpacing",
|
|
2861
|
+
"textAlign",
|
|
2862
|
+
"padding"
|
|
2863
|
+
],
|
|
2761
2864
|
value: data.style,
|
|
2762
2865
|
onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
|
|
2763
2866
|
}
|
|
@@ -2780,7 +2883,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2780
2883
|
const value = parseInt(ev.target.value);
|
|
2781
2884
|
onChange(isNaN(value) ? null : value);
|
|
2782
2885
|
};
|
|
2783
|
-
return /* @__PURE__ */
|
|
2886
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
2784
2887
|
material.TextField,
|
|
2785
2888
|
{
|
|
2786
2889
|
fullWidth: true,
|
|
@@ -2791,7 +2894,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2791
2894
|
placeholder: "auto",
|
|
2792
2895
|
size: "small",
|
|
2793
2896
|
InputProps: {
|
|
2794
|
-
endAdornment: /* @__PURE__ */
|
|
2897
|
+
endAdornment: /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2795
2898
|
}
|
|
2796
2899
|
}
|
|
2797
2900
|
);
|
|
@@ -2799,7 +2902,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2799
2902
|
|
|
2800
2903
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/column-widths-input.tsx
|
|
2801
2904
|
function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
2802
|
-
const [currentValue, setCurrentValue] =
|
|
2905
|
+
const [currentValue, setCurrentValue] = React58.useState(() => {
|
|
2803
2906
|
if (defaultValue) {
|
|
2804
2907
|
return defaultValue;
|
|
2805
2908
|
}
|
|
@@ -2813,7 +2916,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2813
2916
|
};
|
|
2814
2917
|
let column3 = null;
|
|
2815
2918
|
{
|
|
2816
|
-
column3 = /* @__PURE__ */
|
|
2919
|
+
column3 = /* @__PURE__ */ React58__default.default.createElement(
|
|
2817
2920
|
TextDimensionInput,
|
|
2818
2921
|
{
|
|
2819
2922
|
label: "Column 3",
|
|
@@ -2824,7 +2927,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2824
2927
|
}
|
|
2825
2928
|
);
|
|
2826
2929
|
}
|
|
2827
|
-
return /* @__PURE__ */
|
|
2930
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2828
2931
|
TextDimensionInput,
|
|
2829
2932
|
{
|
|
2830
2933
|
label: "Column 1",
|
|
@@ -2833,7 +2936,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2833
2936
|
setIndexValue(0, v);
|
|
2834
2937
|
}
|
|
2835
2938
|
}
|
|
2836
|
-
), /* @__PURE__ */
|
|
2939
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2837
2940
|
TextDimensionInput,
|
|
2838
2941
|
{
|
|
2839
2942
|
label: "Column 2",
|
|
@@ -2848,7 +2951,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2848
2951
|
// src/app/inspector-drawer/configuration-panel/input-panels/columns-container-sidebar-panel.tsx
|
|
2849
2952
|
function ColumnsContainerPanel({ data, setData }) {
|
|
2850
2953
|
var _a, _b, _c, _d, _e, _f;
|
|
2851
|
-
const [, setErrors] =
|
|
2954
|
+
const [, setErrors] = React58.useState(null);
|
|
2852
2955
|
const updateData = (d) => {
|
|
2853
2956
|
const res = columns_container_props_schema_default2.safeParse(d);
|
|
2854
2957
|
if (res.success) {
|
|
@@ -2858,7 +2961,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2858
2961
|
setErrors(res.error);
|
|
2859
2962
|
}
|
|
2860
2963
|
};
|
|
2861
|
-
return /* @__PURE__ */
|
|
2964
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2862
2965
|
RadioGroupInput,
|
|
2863
2966
|
{
|
|
2864
2967
|
label: "Number of columns",
|
|
@@ -2867,9 +2970,9 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2867
2970
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
|
|
2868
2971
|
}
|
|
2869
2972
|
},
|
|
2870
|
-
/* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
), /* @__PURE__ */
|
|
2973
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "2" }, "2"),
|
|
2974
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "3" }, "3")
|
|
2975
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2873
2976
|
ColumnWidthsInput,
|
|
2874
2977
|
{
|
|
2875
2978
|
defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
|
|
@@ -2877,11 +2980,11 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2877
2980
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
|
|
2878
2981
|
}
|
|
2879
2982
|
}
|
|
2880
|
-
), /* @__PURE__ */
|
|
2983
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2881
2984
|
SliderInput,
|
|
2882
2985
|
{
|
|
2883
2986
|
label: "Columns gap",
|
|
2884
|
-
iconLabel: /* @__PURE__ */
|
|
2987
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SpaceBarOutlined, { sx: { color: "text.secondary" } }),
|
|
2885
2988
|
units: "px",
|
|
2886
2989
|
step: 4,
|
|
2887
2990
|
marks: true,
|
|
@@ -2890,7 +2993,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2890
2993
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
|
|
2891
2994
|
onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
|
|
2892
2995
|
}
|
|
2893
|
-
), /* @__PURE__ */
|
|
2996
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2894
2997
|
RadioGroupInput,
|
|
2895
2998
|
{
|
|
2896
2999
|
label: "Alignment",
|
|
@@ -2899,10 +3002,10 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2899
3002
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
|
|
2900
3003
|
}
|
|
2901
3004
|
},
|
|
2902
|
-
/* @__PURE__ */
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
), /* @__PURE__ */
|
|
3005
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "top" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3006
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "middle" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3007
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "bottom" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3008
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2906
3009
|
MultiStylePropertyPanel,
|
|
2907
3010
|
{
|
|
2908
3011
|
names: ["backgroundColor", "padding"],
|
|
@@ -2921,7 +3024,7 @@ var container_props_schema_default = ContainerPropsSchema3;
|
|
|
2921
3024
|
|
|
2922
3025
|
// src/app/inspector-drawer/configuration-panel/input-panels/container-sidebar-panel.tsx
|
|
2923
3026
|
function ContainerSidebarPanel({ data, setData }) {
|
|
2924
|
-
const [, setErrors] =
|
|
3027
|
+
const [, setErrors] = React58.useState(null);
|
|
2925
3028
|
const updateData = (d) => {
|
|
2926
3029
|
const res = container_props_schema_default.safeParse(d);
|
|
2927
3030
|
if (res.success) {
|
|
@@ -2931,7 +3034,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2931
3034
|
setErrors(res.error);
|
|
2932
3035
|
}
|
|
2933
3036
|
};
|
|
2934
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2935
3038
|
MultiStylePropertyPanel,
|
|
2936
3039
|
{
|
|
2937
3040
|
names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
|
|
@@ -2942,7 +3045,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2942
3045
|
}
|
|
2943
3046
|
function DividerSidebarPanel({ data, setData }) {
|
|
2944
3047
|
var _a, _b, _c, _d;
|
|
2945
|
-
const [, setErrors] =
|
|
3048
|
+
const [, setErrors] = React58.useState(null);
|
|
2946
3049
|
const updateData = (d) => {
|
|
2947
3050
|
const res = DividerPropsSchema.safeParse(d);
|
|
2948
3051
|
if (res.success) {
|
|
@@ -2954,18 +3057,18 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2954
3057
|
};
|
|
2955
3058
|
const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
|
|
2956
3059
|
const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
|
|
2957
|
-
return /* @__PURE__ */
|
|
3060
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
2958
3061
|
ColorInput2,
|
|
2959
3062
|
{
|
|
2960
3063
|
label: "Color",
|
|
2961
3064
|
defaultValue: lineColor,
|
|
2962
3065
|
onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
|
|
2963
3066
|
}
|
|
2964
|
-
), /* @__PURE__ */
|
|
3067
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2965
3068
|
SliderInput,
|
|
2966
3069
|
{
|
|
2967
3070
|
label: "Height",
|
|
2968
|
-
iconLabel: /* @__PURE__ */
|
|
3071
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
2969
3072
|
units: "px",
|
|
2970
3073
|
step: 1,
|
|
2971
3074
|
min: 1,
|
|
@@ -2973,7 +3076,7 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2973
3076
|
defaultValue: lineHeight,
|
|
2974
3077
|
onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
|
|
2975
3078
|
}
|
|
2976
|
-
), /* @__PURE__ */
|
|
3079
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
2977
3080
|
MultiStylePropertyPanel,
|
|
2978
3081
|
{
|
|
2979
3082
|
names: ["backgroundColor", "padding"],
|
|
@@ -2996,7 +3099,8 @@ var FONT_FAMILY_SCHEMA7 = zod.z.enum([
|
|
|
2996
3099
|
]).nullable().optional();
|
|
2997
3100
|
var TemplateVariableSchema2 = zod.z.object({
|
|
2998
3101
|
name: zod.z.string(),
|
|
2999
|
-
description: zod.z.string().optional().nullable()
|
|
3102
|
+
description: zod.z.string().optional().nullable(),
|
|
3103
|
+
sampleValue: zod.z.string().optional().nullable()
|
|
3000
3104
|
});
|
|
3001
3105
|
var EmailLayoutPropsSchema2 = zod.z.object({
|
|
3002
3106
|
backdropColor: COLOR_SCHEMA10,
|
|
@@ -3012,15 +3116,15 @@ var EmailLayoutPropsSchema2 = zod.z.object({
|
|
|
3012
3116
|
});
|
|
3013
3117
|
var email_layout_props_schema_default = EmailLayoutPropsSchema2;
|
|
3014
3118
|
function BooleanInput({ label, defaultValue, onChange }) {
|
|
3015
|
-
const [value, setValue] =
|
|
3016
|
-
|
|
3119
|
+
const [value, setValue] = React58.useState(defaultValue);
|
|
3120
|
+
React58.useEffect(() => {
|
|
3017
3121
|
setValue(defaultValue);
|
|
3018
3122
|
}, [defaultValue]);
|
|
3019
|
-
return /* @__PURE__ */
|
|
3123
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
3020
3124
|
material.FormControlLabel,
|
|
3021
3125
|
{
|
|
3022
3126
|
label,
|
|
3023
|
-
control: /* @__PURE__ */
|
|
3127
|
+
control: /* @__PURE__ */ React58__default.default.createElement(
|
|
3024
3128
|
material.Switch,
|
|
3025
3129
|
{
|
|
3026
3130
|
checked: value,
|
|
@@ -3037,7 +3141,7 @@ function BooleanInput({ label, defaultValue, onChange }) {
|
|
|
3037
3141
|
// src/app/inspector-drawer/configuration-panel/input-panels/email-layout-sidebar-panel.tsx
|
|
3038
3142
|
function EmailLayoutSidebarFields({ data, setData }) {
|
|
3039
3143
|
var _a, _b, _c, _d, _e, _f;
|
|
3040
|
-
const [, setErrors] =
|
|
3144
|
+
const [, setErrors] = React58.useState(null);
|
|
3041
3145
|
const updateData = (d) => {
|
|
3042
3146
|
const res = email_layout_props_schema_default.safeParse(d);
|
|
3043
3147
|
if (res.success) {
|
|
@@ -3048,38 +3152,38 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3048
3152
|
}
|
|
3049
3153
|
};
|
|
3050
3154
|
const backdropDisabled = (_a = data.backdropDisabled) != null ? _a : false;
|
|
3051
|
-
return /* @__PURE__ */
|
|
3155
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3052
3156
|
BooleanInput,
|
|
3053
3157
|
{
|
|
3054
3158
|
label: "Disable backdrop",
|
|
3055
3159
|
defaultValue: backdropDisabled,
|
|
3056
3160
|
onChange: (backdropDisabled2) => updateData(__spreadProps(__spreadValues({}, data), { backdropDisabled: backdropDisabled2 }))
|
|
3057
3161
|
}
|
|
3058
|
-
), !backdropDisabled && /* @__PURE__ */
|
|
3162
|
+
), !backdropDisabled && /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
3059
3163
|
ColorInput2,
|
|
3060
3164
|
{
|
|
3061
3165
|
label: "Backdrop color",
|
|
3062
3166
|
defaultValue: (_b = data.backdropColor) != null ? _b : "#F5F5F5",
|
|
3063
3167
|
onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
|
|
3064
3168
|
}
|
|
3065
|
-
), /* @__PURE__ */
|
|
3169
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3066
3170
|
ColorInput2,
|
|
3067
3171
|
{
|
|
3068
3172
|
label: "Canvas color",
|
|
3069
3173
|
defaultValue: (_c = data.canvasColor) != null ? _c : "#FFFFFF",
|
|
3070
3174
|
onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
|
|
3071
3175
|
}
|
|
3072
|
-
), /* @__PURE__ */
|
|
3176
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3073
3177
|
NullableColorInput,
|
|
3074
3178
|
{
|
|
3075
3179
|
label: "Canvas border color",
|
|
3076
3180
|
defaultValue: (_d = data.borderColor) != null ? _d : null,
|
|
3077
3181
|
onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
|
|
3078
3182
|
}
|
|
3079
|
-
), /* @__PURE__ */
|
|
3183
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3080
3184
|
SliderInput,
|
|
3081
3185
|
{
|
|
3082
|
-
iconLabel: /* @__PURE__ */
|
|
3186
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.RoundedCornerOutlined, null),
|
|
3083
3187
|
units: "px",
|
|
3084
3188
|
step: 4,
|
|
3085
3189
|
marks: true,
|
|
@@ -3089,14 +3193,14 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3089
3193
|
defaultValue: (_e = data.borderRadius) != null ? _e : 0,
|
|
3090
3194
|
onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
|
|
3091
3195
|
}
|
|
3092
|
-
)), /* @__PURE__ */
|
|
3196
|
+
)), /* @__PURE__ */ React58__default.default.createElement(
|
|
3093
3197
|
NullableFontFamily,
|
|
3094
3198
|
{
|
|
3095
3199
|
label: "Font family",
|
|
3096
3200
|
defaultValue: "MODERN_SANS",
|
|
3097
3201
|
onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
|
|
3098
3202
|
}
|
|
3099
|
-
), /* @__PURE__ */
|
|
3203
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3100
3204
|
ColorInput2,
|
|
3101
3205
|
{
|
|
3102
3206
|
label: "Text color",
|
|
@@ -3107,7 +3211,7 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3107
3211
|
}
|
|
3108
3212
|
function HeadingSidebarPanel({ data, setData }) {
|
|
3109
3213
|
var _a, _b, _c, _d;
|
|
3110
|
-
const [, setErrors] =
|
|
3214
|
+
const [, setErrors] = React58.useState(null);
|
|
3111
3215
|
const updateData = (d) => {
|
|
3112
3216
|
const res = HeadingPropsSchema.safeParse(d);
|
|
3113
3217
|
if (res.success) {
|
|
@@ -3117,7 +3221,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3117
3221
|
setErrors(res.error);
|
|
3118
3222
|
}
|
|
3119
3223
|
};
|
|
3120
|
-
return /* @__PURE__ */
|
|
3224
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3121
3225
|
TextInput,
|
|
3122
3226
|
{
|
|
3123
3227
|
label: "Content",
|
|
@@ -3127,7 +3231,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3127
3231
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
|
|
3128
3232
|
}
|
|
3129
3233
|
}
|
|
3130
|
-
), /* @__PURE__ */
|
|
3234
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3131
3235
|
RadioGroupInput,
|
|
3132
3236
|
{
|
|
3133
3237
|
label: "Level",
|
|
@@ -3136,13 +3240,22 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3136
3240
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
|
|
3137
3241
|
}
|
|
3138
3242
|
},
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3142
|
-
), /* @__PURE__ */
|
|
3243
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "h1" }, "H1"),
|
|
3244
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "h2" }, "H2"),
|
|
3245
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "h3" }, "H3")
|
|
3246
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3143
3247
|
MultiStylePropertyPanel,
|
|
3144
3248
|
{
|
|
3145
|
-
names: [
|
|
3249
|
+
names: [
|
|
3250
|
+
"color",
|
|
3251
|
+
"backgroundColor",
|
|
3252
|
+
"fontFamily",
|
|
3253
|
+
"fontWeight",
|
|
3254
|
+
"lineHeight",
|
|
3255
|
+
"letterSpacing",
|
|
3256
|
+
"textAlign",
|
|
3257
|
+
"padding"
|
|
3258
|
+
],
|
|
3146
3259
|
value: data.style,
|
|
3147
3260
|
onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
|
|
3148
3261
|
}
|
|
@@ -3150,7 +3263,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3150
3263
|
}
|
|
3151
3264
|
function HtmlSidebarPanel({ data, setData }) {
|
|
3152
3265
|
var _a, _b;
|
|
3153
|
-
const [, setErrors] =
|
|
3266
|
+
const [, setErrors] = React58.useState(null);
|
|
3154
3267
|
const updateData = (d) => {
|
|
3155
3268
|
const res = HtmlPropsSchema.safeParse(d);
|
|
3156
3269
|
if (res.success) {
|
|
@@ -3160,7 +3273,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3160
3273
|
setErrors(res.error);
|
|
3161
3274
|
}
|
|
3162
3275
|
};
|
|
3163
|
-
return /* @__PURE__ */
|
|
3276
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3164
3277
|
TextInput,
|
|
3165
3278
|
{
|
|
3166
3279
|
label: "Content",
|
|
@@ -3168,7 +3281,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3168
3281
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
|
|
3169
3282
|
onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
|
|
3170
3283
|
}
|
|
3171
|
-
), /* @__PURE__ */
|
|
3284
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3172
3285
|
MultiStylePropertyPanel,
|
|
3173
3286
|
{
|
|
3174
3287
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
|
|
@@ -3177,9 +3290,160 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3177
3290
|
}
|
|
3178
3291
|
));
|
|
3179
3292
|
}
|
|
3293
|
+
function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
3294
|
+
const { loadImages, deleteImage } = useImageCallbacks();
|
|
3295
|
+
const [images, setImages] = React58.useState(null);
|
|
3296
|
+
const [error, setError] = React58.useState(null);
|
|
3297
|
+
const [query, setQuery] = React58.useState("");
|
|
3298
|
+
const [busy, setBusy] = React58.useState(false);
|
|
3299
|
+
const refresh = () => __async(null, null, function* () {
|
|
3300
|
+
if (!loadImages) return;
|
|
3301
|
+
setBusy(true);
|
|
3302
|
+
setError(null);
|
|
3303
|
+
try {
|
|
3304
|
+
const list = yield loadImages();
|
|
3305
|
+
setImages(list);
|
|
3306
|
+
} catch (e) {
|
|
3307
|
+
setError(e instanceof Error ? e.message : "Failed to load images");
|
|
3308
|
+
} finally {
|
|
3309
|
+
setBusy(false);
|
|
3310
|
+
}
|
|
3311
|
+
});
|
|
3312
|
+
React58.useEffect(() => {
|
|
3313
|
+
if (open) {
|
|
3314
|
+
setQuery("");
|
|
3315
|
+
void refresh();
|
|
3316
|
+
}
|
|
3317
|
+
}, [open]);
|
|
3318
|
+
const filtered = React58.useMemo(() => {
|
|
3319
|
+
if (!images) return null;
|
|
3320
|
+
const q = query.trim().toLowerCase();
|
|
3321
|
+
if (!q) return images;
|
|
3322
|
+
return images.filter((img) => {
|
|
3323
|
+
var _a;
|
|
3324
|
+
const haystack = `${(_a = img.alt) != null ? _a : ""} ${img.url}`.toLowerCase();
|
|
3325
|
+
return haystack.includes(q);
|
|
3326
|
+
});
|
|
3327
|
+
}, [images, query]);
|
|
3328
|
+
const handleDelete = (url) => __async(null, null, function* () {
|
|
3329
|
+
if (!deleteImage) return;
|
|
3330
|
+
const ok = window.confirm("Delete this image from the library?");
|
|
3331
|
+
if (!ok) return;
|
|
3332
|
+
setBusy(true);
|
|
3333
|
+
try {
|
|
3334
|
+
yield deleteImage(url);
|
|
3335
|
+
yield refresh();
|
|
3336
|
+
} catch (e) {
|
|
3337
|
+
setError(e instanceof Error ? e.message : "Failed to delete image");
|
|
3338
|
+
setBusy(false);
|
|
3339
|
+
}
|
|
3340
|
+
});
|
|
3341
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Dialog, { open, onClose, maxWidth: "md", fullWidth: true }, /* @__PURE__ */ React58__default.default.createElement(material.DialogTitle, null, "Image library"), /* @__PURE__ */ React58__default.default.createElement(material.DialogContent, { dividers: true }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3342
|
+
material.TextField,
|
|
3343
|
+
{
|
|
3344
|
+
fullWidth: true,
|
|
3345
|
+
size: "small",
|
|
3346
|
+
placeholder: "Search by alt text or URL",
|
|
3347
|
+
value: query,
|
|
3348
|
+
onChange: (e) => setQuery(e.target.value),
|
|
3349
|
+
autoFocus: true,
|
|
3350
|
+
InputProps: {
|
|
3351
|
+
startAdornment: /* @__PURE__ */ React58__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SearchOutlined, { fontSize: "small" }))
|
|
3352
|
+
},
|
|
3353
|
+
sx: { mb: 2 }
|
|
3354
|
+
}
|
|
3355
|
+
), error && /* @__PURE__ */ React58__default.default.createElement(material.Alert, { severity: "error", sx: { mb: 2 } }, error), busy && !images && /* @__PURE__ */ React58__default.default.createElement(material.Stack, { alignItems: "center", sx: { py: 4 } }, /* @__PURE__ */ React58__default.default.createElement(material.CircularProgress, { size: 28 })), filtered && filtered.length === 0 && /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", textAlign: "center", py: 4 } }, query ? "No images match your search." : "No images in the library yet."), filtered && filtered.length > 0 && /* @__PURE__ */ React58__default.default.createElement(
|
|
3356
|
+
material.Box,
|
|
3357
|
+
{
|
|
3358
|
+
sx: {
|
|
3359
|
+
display: "grid",
|
|
3360
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(140px, 1fr))",
|
|
3361
|
+
gap: 1.5
|
|
3362
|
+
}
|
|
3363
|
+
},
|
|
3364
|
+
filtered.map((img) => /* @__PURE__ */ React58__default.default.createElement(
|
|
3365
|
+
ImageTile,
|
|
3366
|
+
{
|
|
3367
|
+
key: img.url,
|
|
3368
|
+
image: img,
|
|
3369
|
+
onPick: () => onPick(img),
|
|
3370
|
+
onDelete: deleteImage ? () => handleDelete(img.url) : void 0
|
|
3371
|
+
}
|
|
3372
|
+
))
|
|
3373
|
+
)), /* @__PURE__ */ React58__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React58__default.default.createElement(material.Button, { onClick: onClose }, "Close")));
|
|
3374
|
+
}
|
|
3375
|
+
function ImageTile({
|
|
3376
|
+
image,
|
|
3377
|
+
onPick,
|
|
3378
|
+
onDelete
|
|
3379
|
+
}) {
|
|
3380
|
+
var _a, _b;
|
|
3381
|
+
const src = (_a = image.thumbnailUrl) != null ? _a : image.url;
|
|
3382
|
+
const label = image.alt || image.url.split("/").pop() || "image";
|
|
3383
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
3384
|
+
material.Box,
|
|
3385
|
+
{
|
|
3386
|
+
sx: {
|
|
3387
|
+
position: "relative",
|
|
3388
|
+
borderRadius: 1,
|
|
3389
|
+
border: 1,
|
|
3390
|
+
borderColor: "divider",
|
|
3391
|
+
overflow: "hidden",
|
|
3392
|
+
cursor: "pointer",
|
|
3393
|
+
transition: "border-color 120ms",
|
|
3394
|
+
"&:hover": { borderColor: "primary.main" },
|
|
3395
|
+
"&:hover .delete-btn": { opacity: 1 }
|
|
3396
|
+
},
|
|
3397
|
+
onClick: onPick
|
|
3398
|
+
},
|
|
3399
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
3400
|
+
material.Box,
|
|
3401
|
+
{
|
|
3402
|
+
component: "img",
|
|
3403
|
+
src,
|
|
3404
|
+
alt: (_b = image.alt) != null ? _b : "",
|
|
3405
|
+
sx: { display: "block", width: "100%", aspectRatio: "1 / 1", objectFit: "cover", backgroundColor: "#f5f5f5" }
|
|
3406
|
+
}
|
|
3407
|
+
),
|
|
3408
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { p: 0.75, fontSize: 11, color: "text.secondary", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, label),
|
|
3409
|
+
onDelete && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Delete from library" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3410
|
+
material.IconButton,
|
|
3411
|
+
{
|
|
3412
|
+
size: "small",
|
|
3413
|
+
className: "delete-btn",
|
|
3414
|
+
onClick: (e) => {
|
|
3415
|
+
e.stopPropagation();
|
|
3416
|
+
onDelete();
|
|
3417
|
+
},
|
|
3418
|
+
sx: {
|
|
3419
|
+
position: "absolute",
|
|
3420
|
+
top: 4,
|
|
3421
|
+
right: 4,
|
|
3422
|
+
opacity: 0,
|
|
3423
|
+
backgroundColor: "rgba(255,255,255,0.85)",
|
|
3424
|
+
transition: "opacity 120ms",
|
|
3425
|
+
"&:hover": { backgroundColor: "rgba(255,255,255,0.95)" }
|
|
3426
|
+
},
|
|
3427
|
+
"aria-label": "Delete image"
|
|
3428
|
+
},
|
|
3429
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DeleteOutline, { fontSize: "small" })
|
|
3430
|
+
))
|
|
3431
|
+
);
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
// src/app/inspector-drawer/configuration-panel/input-panels/image-sidebar-panel.tsx
|
|
3435
|
+
function isHttpUrl(value) {
|
|
3436
|
+
if (!value) return false;
|
|
3437
|
+
return /^http:\/\//i.test(value.trim());
|
|
3438
|
+
}
|
|
3180
3439
|
function ImageSidebarPanel({ data, setData }) {
|
|
3181
3440
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3182
|
-
const [, setErrors] =
|
|
3441
|
+
const [, setErrors] = React58.useState(null);
|
|
3442
|
+
const { uploadImage, loadImages } = useImageCallbacks();
|
|
3443
|
+
const fileInputRef = React58.useRef(null);
|
|
3444
|
+
const [uploading, setUploading] = React58.useState(false);
|
|
3445
|
+
const [uploadError, setUploadError] = React58.useState(null);
|
|
3446
|
+
const [libraryOpen, setLibraryOpen] = React58.useState(false);
|
|
3183
3447
|
const updateData = (d) => {
|
|
3184
3448
|
const res = ImagePropsSchema.safeParse(d);
|
|
3185
3449
|
if (res.success) {
|
|
@@ -3189,24 +3453,88 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3189
3453
|
setErrors(res.error);
|
|
3190
3454
|
}
|
|
3191
3455
|
};
|
|
3192
|
-
|
|
3456
|
+
const applyUploadedImage = (uploaded) => {
|
|
3457
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
3458
|
+
updateData(__spreadProps(__spreadValues({}, data), {
|
|
3459
|
+
props: __spreadProps(__spreadValues({}, data.props), {
|
|
3460
|
+
url: uploaded.url,
|
|
3461
|
+
width: (_c2 = (_b2 = uploaded.width) != null ? _b2 : (_a2 = data.props) == null ? void 0 : _a2.width) != null ? _c2 : null,
|
|
3462
|
+
height: (_f2 = (_e2 = uploaded.height) != null ? _e2 : (_d2 = data.props) == null ? void 0 : _d2.height) != null ? _f2 : null,
|
|
3463
|
+
alt: (_i2 = (_h2 = uploaded.alt) != null ? _h2 : (_g2 = data.props) == null ? void 0 : _g2.alt) != null ? _i2 : ""
|
|
3464
|
+
})
|
|
3465
|
+
}));
|
|
3466
|
+
};
|
|
3467
|
+
const handleFile = (file) => __async(null, null, function* () {
|
|
3468
|
+
if (!uploadImage) return;
|
|
3469
|
+
setUploading(true);
|
|
3470
|
+
setUploadError(null);
|
|
3471
|
+
try {
|
|
3472
|
+
const uploaded = yield uploadImage(file);
|
|
3473
|
+
applyUploadedImage(uploaded);
|
|
3474
|
+
} catch (e) {
|
|
3475
|
+
setUploadError(e instanceof Error ? e.message : "Upload failed");
|
|
3476
|
+
} finally {
|
|
3477
|
+
setUploading(false);
|
|
3478
|
+
}
|
|
3479
|
+
});
|
|
3480
|
+
const url = (_b = (_a = data.props) == null ? void 0 : _a.url) != null ? _b : "";
|
|
3481
|
+
const showHttpWarning = isHttpUrl(url);
|
|
3482
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Image block" }, (uploadImage || loadImages) && /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, uploadImage && /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
3483
|
+
material.Button,
|
|
3484
|
+
{
|
|
3485
|
+
fullWidth: true,
|
|
3486
|
+
variant: "outlined",
|
|
3487
|
+
size: "small",
|
|
3488
|
+
startIcon: uploading ? /* @__PURE__ */ React58__default.default.createElement(material.CircularProgress, { size: 14 }) : /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.CloudUploadOutlined, { fontSize: "small" }),
|
|
3489
|
+
disabled: uploading,
|
|
3490
|
+
onClick: () => {
|
|
3491
|
+
var _a2;
|
|
3492
|
+
return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
3493
|
+
}
|
|
3494
|
+
},
|
|
3495
|
+
uploading ? "Uploading\u2026" : "Upload"
|
|
3496
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3497
|
+
"input",
|
|
3498
|
+
{
|
|
3499
|
+
ref: fileInputRef,
|
|
3500
|
+
type: "file",
|
|
3501
|
+
accept: "image/*",
|
|
3502
|
+
hidden: true,
|
|
3503
|
+
onChange: (e) => __async(null, null, function* () {
|
|
3504
|
+
var _a2;
|
|
3505
|
+
const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
|
|
3506
|
+
e.target.value = "";
|
|
3507
|
+
if (file) yield handleFile(file);
|
|
3508
|
+
})
|
|
3509
|
+
}
|
|
3510
|
+
)), loadImages && /* @__PURE__ */ React58__default.default.createElement(
|
|
3511
|
+
material.Button,
|
|
3512
|
+
{
|
|
3513
|
+
fullWidth: true,
|
|
3514
|
+
variant: "outlined",
|
|
3515
|
+
size: "small",
|
|
3516
|
+
startIcon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.CollectionsOutlined, { fontSize: "small" }),
|
|
3517
|
+
onClick: () => setLibraryOpen(true)
|
|
3518
|
+
},
|
|
3519
|
+
"Library"
|
|
3520
|
+
)), uploadError && /* @__PURE__ */ React58__default.default.createElement(material.Alert, { severity: "error", onClose: () => setUploadError(null), sx: { mt: 1 } }, uploadError), /* @__PURE__ */ React58__default.default.createElement(
|
|
3193
3521
|
TextInput,
|
|
3194
3522
|
{
|
|
3195
3523
|
label: "Source URL",
|
|
3196
|
-
defaultValue:
|
|
3524
|
+
defaultValue: url,
|
|
3197
3525
|
onChange: (v) => {
|
|
3198
|
-
const
|
|
3199
|
-
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url }) }));
|
|
3526
|
+
const next = v.trim().length === 0 ? null : v.trim();
|
|
3527
|
+
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: next }) }));
|
|
3200
3528
|
}
|
|
3201
3529
|
}
|
|
3202
|
-
), /* @__PURE__ */
|
|
3530
|
+
), showHttpWarning && /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { mt: -1, mb: 1, display: "flex", alignItems: "flex-start", gap: 0.75 } }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ErrorOutlineOutlined, { fontSize: "small", sx: { color: "warning.main", mt: "2px" } }), /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { fontSize: 12, color: "warning.dark" } }, "Non-HTTPS URL: Gmail and other clients strip mixed content. Use https:// for reliable delivery.")), /* @__PURE__ */ React58__default.default.createElement(
|
|
3203
3531
|
TextInput,
|
|
3204
3532
|
{
|
|
3205
3533
|
label: "Alt text",
|
|
3206
3534
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
|
|
3207
3535
|
onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
|
|
3208
3536
|
}
|
|
3209
|
-
), /* @__PURE__ */
|
|
3537
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3210
3538
|
TextInput,
|
|
3211
3539
|
{
|
|
3212
3540
|
label: "Click through URL",
|
|
@@ -3216,42 +3544,52 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3216
3544
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
|
|
3217
3545
|
}
|
|
3218
3546
|
}
|
|
3219
|
-
), /* @__PURE__ */
|
|
3547
|
+
), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3220
3548
|
TextDimensionInput,
|
|
3221
3549
|
{
|
|
3222
3550
|
label: "Width",
|
|
3223
3551
|
defaultValue: (_g = data.props) == null ? void 0 : _g.width,
|
|
3224
3552
|
onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
|
|
3225
3553
|
}
|
|
3226
|
-
), /* @__PURE__ */
|
|
3554
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3227
3555
|
TextDimensionInput,
|
|
3228
3556
|
{
|
|
3229
3557
|
label: "Height",
|
|
3230
3558
|
defaultValue: (_h = data.props) == null ? void 0 : _h.height,
|
|
3231
3559
|
onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
|
|
3232
3560
|
}
|
|
3233
|
-
)), /* @__PURE__ */
|
|
3561
|
+
)), /* @__PURE__ */ React58__default.default.createElement(
|
|
3234
3562
|
RadioGroupInput,
|
|
3235
3563
|
{
|
|
3236
3564
|
label: "Alignment",
|
|
3237
3565
|
defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
|
|
3238
3566
|
onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
|
|
3239
3567
|
},
|
|
3240
|
-
/* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3242
|
-
/* @__PURE__ */
|
|
3243
|
-
), /* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "top" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3569
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "middle" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3570
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "bottom" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3571
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3244
3572
|
MultiStylePropertyPanel,
|
|
3245
3573
|
{
|
|
3246
3574
|
names: ["backgroundColor", "textAlign", "padding"],
|
|
3247
3575
|
value: data.style,
|
|
3248
3576
|
onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
|
|
3249
3577
|
}
|
|
3578
|
+
), loadImages && /* @__PURE__ */ React58__default.default.createElement(
|
|
3579
|
+
ImageLibraryDialog,
|
|
3580
|
+
{
|
|
3581
|
+
open: libraryOpen,
|
|
3582
|
+
onClose: () => setLibraryOpen(false),
|
|
3583
|
+
onPick: (image) => {
|
|
3584
|
+
applyUploadedImage(image);
|
|
3585
|
+
setLibraryOpen(false);
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3250
3588
|
));
|
|
3251
3589
|
}
|
|
3252
3590
|
function SignatureSidebarPanel({ data, setData }) {
|
|
3253
3591
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
3254
|
-
const [, setErrors] =
|
|
3592
|
+
const [, setErrors] = React58.useState(null);
|
|
3255
3593
|
const updateData = (d) => {
|
|
3256
3594
|
const res = SignaturePropsSchema.safeParse(d);
|
|
3257
3595
|
if (res.success) {
|
|
@@ -3276,74 +3614,74 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3276
3614
|
const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
|
|
3277
3615
|
const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
|
|
3278
3616
|
const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
|
|
3279
|
-
return /* @__PURE__ */
|
|
3617
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3280
3618
|
TextInput,
|
|
3281
3619
|
{
|
|
3282
3620
|
label: "Greeting",
|
|
3283
3621
|
defaultValue: greeting,
|
|
3284
3622
|
onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
|
|
3285
3623
|
}
|
|
3286
|
-
), /* @__PURE__ */
|
|
3624
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3287
3625
|
TextInput,
|
|
3288
3626
|
{
|
|
3289
3627
|
label: "Name",
|
|
3290
3628
|
defaultValue: name,
|
|
3291
3629
|
onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
|
|
3292
3630
|
}
|
|
3293
|
-
), /* @__PURE__ */
|
|
3631
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3294
3632
|
TextInput,
|
|
3295
3633
|
{
|
|
3296
3634
|
label: "Title",
|
|
3297
3635
|
defaultValue: title,
|
|
3298
3636
|
onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
|
|
3299
3637
|
}
|
|
3300
|
-
), /* @__PURE__ */
|
|
3638
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3301
3639
|
TextInput,
|
|
3302
3640
|
{
|
|
3303
3641
|
label: "Company",
|
|
3304
3642
|
defaultValue: company,
|
|
3305
3643
|
onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
|
|
3306
3644
|
}
|
|
3307
|
-
), /* @__PURE__ */
|
|
3645
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3308
3646
|
TextInput,
|
|
3309
3647
|
{
|
|
3310
3648
|
label: "Address",
|
|
3311
3649
|
defaultValue: address,
|
|
3312
3650
|
onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
|
|
3313
3651
|
}
|
|
3314
|
-
), /* @__PURE__ */
|
|
3652
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3315
3653
|
TextInput,
|
|
3316
3654
|
{
|
|
3317
3655
|
label: "Email",
|
|
3318
3656
|
defaultValue: email,
|
|
3319
3657
|
onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
|
|
3320
3658
|
}
|
|
3321
|
-
), /* @__PURE__ */
|
|
3659
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3322
3660
|
TextInput,
|
|
3323
3661
|
{
|
|
3324
3662
|
label: "Phone",
|
|
3325
3663
|
defaultValue: phone,
|
|
3326
3664
|
onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
|
|
3327
3665
|
}
|
|
3328
|
-
), /* @__PURE__ */
|
|
3666
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3329
3667
|
TextInput,
|
|
3330
3668
|
{
|
|
3331
3669
|
label: "Website",
|
|
3332
3670
|
defaultValue: website,
|
|
3333
3671
|
onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
|
|
3334
3672
|
}
|
|
3335
|
-
), /* @__PURE__ */
|
|
3673
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3336
3674
|
TextInput,
|
|
3337
3675
|
{
|
|
3338
3676
|
label: "Image URL",
|
|
3339
3677
|
defaultValue: imageUrl,
|
|
3340
3678
|
onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
|
|
3341
3679
|
}
|
|
3342
|
-
), /* @__PURE__ */
|
|
3680
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3343
3681
|
SliderInput,
|
|
3344
3682
|
{
|
|
3345
3683
|
label: "Image size",
|
|
3346
|
-
iconLabel: /* @__PURE__ */
|
|
3684
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
3347
3685
|
units: "px",
|
|
3348
3686
|
step: 4,
|
|
3349
3687
|
min: 32,
|
|
@@ -3351,47 +3689,47 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3351
3689
|
defaultValue: imageSize,
|
|
3352
3690
|
onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
|
|
3353
3691
|
}
|
|
3354
|
-
), /* @__PURE__ */
|
|
3692
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3355
3693
|
RadioGroupInput,
|
|
3356
3694
|
{
|
|
3357
3695
|
label: "Image shape",
|
|
3358
3696
|
defaultValue: imageShape,
|
|
3359
3697
|
onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
|
|
3360
3698
|
},
|
|
3361
|
-
/* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
), /* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "circle" }, "Circle"),
|
|
3700
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "square" }, "Square"),
|
|
3701
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded")
|
|
3702
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3365
3703
|
RadioGroupInput,
|
|
3366
3704
|
{
|
|
3367
3705
|
label: "Layout",
|
|
3368
3706
|
defaultValue: layout,
|
|
3369
3707
|
onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
|
|
3370
3708
|
},
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
/* @__PURE__ */
|
|
3373
|
-
), /* @__PURE__ */
|
|
3709
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "horizontal" }, "Horizontal"),
|
|
3710
|
+
/* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "vertical" }, "Vertical")
|
|
3711
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3374
3712
|
ColorInput2,
|
|
3375
3713
|
{
|
|
3376
3714
|
label: "Name color",
|
|
3377
3715
|
defaultValue: nameColor,
|
|
3378
3716
|
onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
|
|
3379
3717
|
}
|
|
3380
|
-
), /* @__PURE__ */
|
|
3718
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3381
3719
|
ColorInput2,
|
|
3382
3720
|
{
|
|
3383
3721
|
label: "Text color",
|
|
3384
3722
|
defaultValue: textColor,
|
|
3385
3723
|
onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
|
|
3386
3724
|
}
|
|
3387
|
-
), /* @__PURE__ */
|
|
3725
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3388
3726
|
ColorInput2,
|
|
3389
3727
|
{
|
|
3390
3728
|
label: "Link color",
|
|
3391
3729
|
defaultValue: linkColor,
|
|
3392
3730
|
onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
|
|
3393
3731
|
}
|
|
3394
|
-
), /* @__PURE__ */
|
|
3732
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3395
3733
|
MultiStylePropertyPanel,
|
|
3396
3734
|
{
|
|
3397
3735
|
names: ["backgroundColor", "fontFamily", "padding"],
|
|
@@ -3402,7 +3740,7 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3402
3740
|
}
|
|
3403
3741
|
function SpacerSidebarPanel({ data, setData }) {
|
|
3404
3742
|
var _a, _b;
|
|
3405
|
-
const [, setErrors] =
|
|
3743
|
+
const [, setErrors] = React58.useState(null);
|
|
3406
3744
|
const updateData = (d) => {
|
|
3407
3745
|
const res = SpacerPropsSchema.safeParse(d);
|
|
3408
3746
|
if (res.success) {
|
|
@@ -3412,11 +3750,11 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3412
3750
|
setErrors(res.error);
|
|
3413
3751
|
}
|
|
3414
3752
|
};
|
|
3415
|
-
return /* @__PURE__ */
|
|
3753
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3416
3754
|
SliderInput,
|
|
3417
3755
|
{
|
|
3418
3756
|
label: "Height",
|
|
3419
|
-
iconLabel: /* @__PURE__ */
|
|
3757
|
+
iconLabel: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
3420
3758
|
units: "px",
|
|
3421
3759
|
step: 4,
|
|
3422
3760
|
min: 4,
|
|
@@ -3428,7 +3766,7 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3428
3766
|
}
|
|
3429
3767
|
function TextSidebarPanel({ data, setData }) {
|
|
3430
3768
|
var _a, _b, _c, _d;
|
|
3431
|
-
const [, setErrors] =
|
|
3769
|
+
const [, setErrors] = React58.useState(null);
|
|
3432
3770
|
const updateData = (d) => {
|
|
3433
3771
|
const res = TextPropsSchema.safeParse(d);
|
|
3434
3772
|
if (res.success) {
|
|
@@ -3438,7 +3776,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3438
3776
|
setErrors(res.error);
|
|
3439
3777
|
}
|
|
3440
3778
|
};
|
|
3441
|
-
return /* @__PURE__ */
|
|
3779
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3442
3780
|
TextInput,
|
|
3443
3781
|
{
|
|
3444
3782
|
label: "Content",
|
|
@@ -3446,17 +3784,27 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3446
3784
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
|
|
3447
3785
|
onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
|
|
3448
3786
|
}
|
|
3449
|
-
), /* @__PURE__ */
|
|
3787
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3450
3788
|
BooleanInput,
|
|
3451
3789
|
{
|
|
3452
3790
|
label: "Markdown",
|
|
3453
3791
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
|
|
3454
3792
|
onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
|
|
3455
3793
|
}
|
|
3456
|
-
), /* @__PURE__ */
|
|
3794
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3457
3795
|
MultiStylePropertyPanel,
|
|
3458
3796
|
{
|
|
3459
|
-
names: [
|
|
3797
|
+
names: [
|
|
3798
|
+
"color",
|
|
3799
|
+
"backgroundColor",
|
|
3800
|
+
"fontFamily",
|
|
3801
|
+
"fontSize",
|
|
3802
|
+
"fontWeight",
|
|
3803
|
+
"lineHeight",
|
|
3804
|
+
"letterSpacing",
|
|
3805
|
+
"textAlign",
|
|
3806
|
+
"padding"
|
|
3807
|
+
],
|
|
3460
3808
|
value: data.style,
|
|
3461
3809
|
onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
|
|
3462
3810
|
}
|
|
@@ -3465,7 +3813,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3465
3813
|
|
|
3466
3814
|
// src/app/inspector-drawer/configuration-panel/index.tsx
|
|
3467
3815
|
function renderMessage(val) {
|
|
3468
|
-
return /* @__PURE__ */
|
|
3816
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { color: "text.secondary" }, val));
|
|
3469
3817
|
}
|
|
3470
3818
|
function ConfigurationPanel() {
|
|
3471
3819
|
const document2 = useDocument();
|
|
@@ -3481,55 +3829,55 @@ function ConfigurationPanel() {
|
|
|
3481
3829
|
const { data, type } = block;
|
|
3482
3830
|
switch (type) {
|
|
3483
3831
|
case "Avatar":
|
|
3484
|
-
return /* @__PURE__ */
|
|
3832
|
+
return /* @__PURE__ */ React58__default.default.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3485
3833
|
case "Button":
|
|
3486
|
-
return /* @__PURE__ */
|
|
3834
|
+
return /* @__PURE__ */ React58__default.default.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3487
3835
|
case "ColumnsContainer":
|
|
3488
|
-
return /* @__PURE__ */
|
|
3836
|
+
return /* @__PURE__ */ React58__default.default.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3489
3837
|
case "Container":
|
|
3490
|
-
return /* @__PURE__ */
|
|
3838
|
+
return /* @__PURE__ */ React58__default.default.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3491
3839
|
case "Divider":
|
|
3492
|
-
return /* @__PURE__ */
|
|
3840
|
+
return /* @__PURE__ */ React58__default.default.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3493
3841
|
case "Heading":
|
|
3494
|
-
return /* @__PURE__ */
|
|
3842
|
+
return /* @__PURE__ */ React58__default.default.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3495
3843
|
case "Html":
|
|
3496
|
-
return /* @__PURE__ */
|
|
3844
|
+
return /* @__PURE__ */ React58__default.default.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3497
3845
|
case "Image":
|
|
3498
|
-
return /* @__PURE__ */
|
|
3846
|
+
return /* @__PURE__ */ React58__default.default.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3499
3847
|
case "EmailLayout":
|
|
3500
|
-
return /* @__PURE__ */
|
|
3848
|
+
return /* @__PURE__ */ React58__default.default.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3501
3849
|
case "Spacer":
|
|
3502
|
-
return /* @__PURE__ */
|
|
3850
|
+
return /* @__PURE__ */ React58__default.default.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3503
3851
|
case "Signature":
|
|
3504
|
-
return /* @__PURE__ */
|
|
3852
|
+
return /* @__PURE__ */ React58__default.default.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3505
3853
|
case "Text":
|
|
3506
|
-
return /* @__PURE__ */
|
|
3854
|
+
return /* @__PURE__ */ React58__default.default.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3507
3855
|
default:
|
|
3508
|
-
return /* @__PURE__ */
|
|
3856
|
+
return /* @__PURE__ */ React58__default.default.createElement("pre", null, JSON.stringify(block, null, " "));
|
|
3509
3857
|
}
|
|
3510
3858
|
}
|
|
3511
3859
|
function StylesPanel() {
|
|
3512
3860
|
const block = useDocument().root;
|
|
3513
3861
|
if (!block) {
|
|
3514
|
-
return /* @__PURE__ */
|
|
3862
|
+
return /* @__PURE__ */ React58__default.default.createElement("p", null, "Block not found");
|
|
3515
3863
|
}
|
|
3516
3864
|
const { data, type } = block;
|
|
3517
3865
|
if (type !== "EmailLayout") {
|
|
3518
3866
|
throw new Error('Expected "root" element to be of type EmailLayout');
|
|
3519
3867
|
}
|
|
3520
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ React58__default.default.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
|
|
3521
3869
|
}
|
|
3522
3870
|
function TemplateDownloadButton() {
|
|
3523
3871
|
const doc = useDocument();
|
|
3524
|
-
const href =
|
|
3872
|
+
const href = React58.useMemo(() => {
|
|
3525
3873
|
return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
|
|
3526
3874
|
}, [doc]);
|
|
3527
|
-
return /* @__PURE__ */
|
|
3875
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
3528
3876
|
material.Button,
|
|
3529
3877
|
{
|
|
3530
3878
|
variant: "outlined",
|
|
3531
3879
|
color: "primary",
|
|
3532
|
-
startIcon: /* @__PURE__ */
|
|
3880
|
+
startIcon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FileDownloadOutlined, null),
|
|
3533
3881
|
href,
|
|
3534
3882
|
download: "emailTemplate.json",
|
|
3535
3883
|
fullWidth: true
|
|
@@ -3561,9 +3909,9 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3561
3909
|
}
|
|
3562
3910
|
};
|
|
3563
3911
|
if (!currentTemplateId) {
|
|
3564
|
-
return /* @__PURE__ */
|
|
3912
|
+
return /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected");
|
|
3565
3913
|
}
|
|
3566
|
-
return /* @__PURE__ */
|
|
3914
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React58__default.default.createElement(
|
|
3567
3915
|
material.Typography,
|
|
3568
3916
|
{
|
|
3569
3917
|
variant: "body2",
|
|
@@ -3576,110 +3924,449 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3576
3924
|
}
|
|
3577
3925
|
},
|
|
3578
3926
|
"Save functionality is disabled. To enable saving, provide the necessary callback functions."
|
|
3579
|
-
), persistenceEnabled && /* @__PURE__ */
|
|
3927
|
+
), persistenceEnabled && /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
3580
3928
|
material.Button,
|
|
3581
3929
|
{
|
|
3582
3930
|
variant: "outlined",
|
|
3583
3931
|
color: "primary",
|
|
3584
|
-
startIcon: /* @__PURE__ */
|
|
3932
|
+
startIcon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ContentCopyOutlined, null),
|
|
3585
3933
|
onClick: handleCopyToSamples,
|
|
3586
3934
|
fullWidth: true,
|
|
3587
3935
|
disabled: !copyTemplate
|
|
3588
3936
|
},
|
|
3589
3937
|
"Save as Sample Template"
|
|
3590
|
-
), /* @__PURE__ */
|
|
3938
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
3591
3939
|
material.Button,
|
|
3592
3940
|
{
|
|
3593
3941
|
variant: "outlined",
|
|
3594
3942
|
color: "error",
|
|
3595
|
-
startIcon: /* @__PURE__ */
|
|
3943
|
+
startIcon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DeleteOutlined, null),
|
|
3596
3944
|
onClick: handleDelete,
|
|
3597
3945
|
fullWidth: true,
|
|
3598
3946
|
disabled: !deleteTemplate
|
|
3599
3947
|
},
|
|
3600
3948
|
"Delete Template"
|
|
3601
|
-
)))), persistenceEnabled && /* @__PURE__ */
|
|
3949
|
+
)))), persistenceEnabled && /* @__PURE__ */ React58__default.default.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 2 }, /* @__PURE__ */ React58__default.default.createElement(TemplateDownloadButton, null))));
|
|
3602
3950
|
}
|
|
3951
|
+
|
|
3952
|
+
// src/app/variables/variable-utils.ts
|
|
3603
3953
|
var VARIABLE_NAME_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3954
|
+
var MAX_VARIABLE_NAME_LENGTH = 64;
|
|
3955
|
+
var RESERVED_VARIABLE_NAMES = /* @__PURE__ */ new Set(["this", "true", "false", "null", "undefined"]);
|
|
3956
|
+
var HANDLEBARS_KEYWORDS = /* @__PURE__ */ new Set(["if", "each", "unless", "else", "with"]);
|
|
3957
|
+
function validateVariableName(name, siblings, indexBeingEdited) {
|
|
3958
|
+
const trimmed = name.trim();
|
|
3959
|
+
if (!trimmed) return "Name is required";
|
|
3960
|
+
if (trimmed.length > MAX_VARIABLE_NAME_LENGTH) return `Max ${MAX_VARIABLE_NAME_LENGTH} characters`;
|
|
3961
|
+
if (!VARIABLE_NAME_RE.test(trimmed)) return "Use letters, digits, underscore; start with a letter or underscore";
|
|
3962
|
+
if (RESERVED_VARIABLE_NAMES.has(trimmed)) return "Reserved word; pick another name";
|
|
3963
|
+
const duplicate = siblings.some((v, i) => i !== indexBeingEdited && v.name === trimmed);
|
|
3608
3964
|
if (duplicate) return "Already declared";
|
|
3609
3965
|
return null;
|
|
3610
3966
|
}
|
|
3967
|
+
var TOKEN_ROOT_RE = /\{\{\s*(?:#(?:if|each|unless|with)\s+)?([a-zA-Z_][a-zA-Z0-9_]*)(?:\.[\w.]+)?\s*\}\}/g;
|
|
3968
|
+
function extractTokenRoots(text) {
|
|
3969
|
+
if (!text) return [];
|
|
3970
|
+
const roots = /* @__PURE__ */ new Set();
|
|
3971
|
+
for (const m of text.matchAll(TOKEN_ROOT_RE)) {
|
|
3972
|
+
const name = m[1];
|
|
3973
|
+
if (RESERVED_VARIABLE_NAMES.has(name) || HANDLEBARS_KEYWORDS.has(name)) continue;
|
|
3974
|
+
roots.add(name);
|
|
3975
|
+
}
|
|
3976
|
+
return [...roots];
|
|
3977
|
+
}
|
|
3978
|
+
function forEachTextFieldInDocument(doc, visit) {
|
|
3979
|
+
var _a, _b;
|
|
3980
|
+
const root = doc.root;
|
|
3981
|
+
if (root && root.type === "EmailLayout" && typeof ((_a = root.data) == null ? void 0 : _a.subject) === "string") {
|
|
3982
|
+
visit(root.data.subject);
|
|
3983
|
+
}
|
|
3984
|
+
for (const [id, block] of Object.entries(doc)) {
|
|
3985
|
+
if (id === "root" || !block || typeof block !== "object") continue;
|
|
3986
|
+
const type = block.type;
|
|
3987
|
+
const props = (_b = block.data) == null ? void 0 : _b.props;
|
|
3988
|
+
if (!props) continue;
|
|
3989
|
+
if ((type === "Text" || type === "Heading" || type === "Button") && typeof props.text === "string") {
|
|
3990
|
+
visit(props.text);
|
|
3991
|
+
} else if (type === "Html" && typeof props.contents === "string") {
|
|
3992
|
+
visit(props.contents);
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
function collectTokenUsage(doc) {
|
|
3997
|
+
const usage = /* @__PURE__ */ new Map();
|
|
3998
|
+
forEachTextFieldInDocument(doc, (value) => {
|
|
3999
|
+
var _a;
|
|
4000
|
+
for (const root of extractTokenRoots(value)) {
|
|
4001
|
+
usage.set(root, ((_a = usage.get(root)) != null ? _a : 0) + 1);
|
|
4002
|
+
}
|
|
4003
|
+
});
|
|
4004
|
+
return usage;
|
|
4005
|
+
}
|
|
4006
|
+
function escapeRegex(name) {
|
|
4007
|
+
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4008
|
+
}
|
|
4009
|
+
function buildRenameReplacers(oldName, newName) {
|
|
4010
|
+
const esc = escapeRegex(oldName);
|
|
4011
|
+
const simple = new RegExp(`\\{\\{\\s*${esc}(\\.[\\w.]+)?\\s*\\}\\}`, "g");
|
|
4012
|
+
const helper = new RegExp(`(\\{\\{\\s*#(?:if|each|unless|with)\\s+)${esc}(\\.[\\w.]+)?(\\s*\\}\\})`, "g");
|
|
4013
|
+
return (text) => text.replace(helper, `$1${newName}$2$3`).replace(simple, `{{${newName}$1}}`);
|
|
4014
|
+
}
|
|
4015
|
+
function buildRenamePatch(doc, oldName, newName) {
|
|
4016
|
+
var _a;
|
|
4017
|
+
if (oldName === newName) return {};
|
|
4018
|
+
const rewrite = buildRenameReplacers(oldName, newName);
|
|
4019
|
+
const patch = {};
|
|
4020
|
+
const root = doc.root;
|
|
4021
|
+
if (root && root.type === "EmailLayout") {
|
|
4022
|
+
const layoutData = root.data;
|
|
4023
|
+
const oldSubject = (_a = layoutData.subject) != null ? _a : "";
|
|
4024
|
+
const newSubject = rewrite(oldSubject);
|
|
4025
|
+
if (newSubject !== oldSubject) {
|
|
4026
|
+
patch.root = __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, layoutData), { subject: newSubject }) });
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
for (const [id, block] of Object.entries(doc)) {
|
|
4030
|
+
if (id === "root" || !block || typeof block !== "object") continue;
|
|
4031
|
+
const type = block.type;
|
|
4032
|
+
const data = block.data;
|
|
4033
|
+
const props = data == null ? void 0 : data.props;
|
|
4034
|
+
if (!props) continue;
|
|
4035
|
+
if ((type === "Text" || type === "Heading" || type === "Button") && typeof props.text === "string") {
|
|
4036
|
+
const nextText = rewrite(props.text);
|
|
4037
|
+
if (nextText !== props.text) {
|
|
4038
|
+
patch[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, props), { text: nextText }) }) });
|
|
4039
|
+
}
|
|
4040
|
+
} else if (type === "Html" && typeof props.contents === "string") {
|
|
4041
|
+
const nextContents = rewrite(props.contents);
|
|
4042
|
+
if (nextContents !== props.contents) {
|
|
4043
|
+
patch[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, props), { contents: nextContents }) }) });
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
return patch;
|
|
4048
|
+
}
|
|
4049
|
+
function substituteSampleValues(text, samples) {
|
|
4050
|
+
if (!text) return text;
|
|
4051
|
+
let out = text;
|
|
4052
|
+
out = out.replace(
|
|
4053
|
+
/\{\{\s*#(?:if|each|unless|with)\s+[^}]*\}\}/g,
|
|
4054
|
+
""
|
|
4055
|
+
);
|
|
4056
|
+
out = out.replace(/\{\{\s*\/(?:if|each|unless|with)\s*\}\}/g, "");
|
|
4057
|
+
out = out.replace(/\{\{\s*else\s*\}\}/g, "");
|
|
4058
|
+
out = out.replace(TOKEN_ROOT_RE, (match, root) => {
|
|
4059
|
+
var _a;
|
|
4060
|
+
if (!samples.has(root)) return match;
|
|
4061
|
+
return (_a = samples.get(root)) != null ? _a : "";
|
|
4062
|
+
});
|
|
4063
|
+
return out;
|
|
4064
|
+
}
|
|
4065
|
+
function buildSampleValueMap(variables) {
|
|
4066
|
+
const m = /* @__PURE__ */ new Map();
|
|
4067
|
+
if (!variables) return m;
|
|
4068
|
+
for (const v of variables) {
|
|
4069
|
+
if (v.name && typeof v.sampleValue === "string" && v.sampleValue.length > 0) {
|
|
4070
|
+
m.set(v.name, v.sampleValue);
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
return m;
|
|
4074
|
+
}
|
|
4075
|
+
function applySampleValuesToDocument(doc, samples) {
|
|
4076
|
+
if (samples.size === 0) return doc;
|
|
4077
|
+
const next = __spreadValues({}, doc);
|
|
4078
|
+
const root = doc.root;
|
|
4079
|
+
if (root && root.type === "EmailLayout") {
|
|
4080
|
+
const layoutData = root.data;
|
|
4081
|
+
if (typeof layoutData.subject === "string") {
|
|
4082
|
+
const newSubject = substituteSampleValues(layoutData.subject, samples);
|
|
4083
|
+
if (newSubject !== layoutData.subject) {
|
|
4084
|
+
next.root = __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, layoutData), { subject: newSubject }) });
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
for (const [id, block] of Object.entries(doc)) {
|
|
4089
|
+
if (id === "root" || !block || typeof block !== "object") continue;
|
|
4090
|
+
const type = block.type;
|
|
4091
|
+
const data = block.data;
|
|
4092
|
+
const props = data == null ? void 0 : data.props;
|
|
4093
|
+
if (!props) continue;
|
|
4094
|
+
if ((type === "Text" || type === "Heading" || type === "Button") && typeof props.text === "string") {
|
|
4095
|
+
const newText = substituteSampleValues(props.text, samples);
|
|
4096
|
+
if (newText !== props.text) {
|
|
4097
|
+
next[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, props), { text: newText }) }) });
|
|
4098
|
+
}
|
|
4099
|
+
} else if (type === "Html" && typeof props.contents === "string") {
|
|
4100
|
+
const newContents = substituteSampleValues(props.contents, samples);
|
|
4101
|
+
if (newContents !== props.contents) {
|
|
4102
|
+
next[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, props), { contents: newContents }) }) });
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
return next;
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
// src/app/inspector-drawer/variables-panel.tsx
|
|
4110
|
+
function toPersistShape(v) {
|
|
4111
|
+
return {
|
|
4112
|
+
name: v.name,
|
|
4113
|
+
description: v.description ? v.description : void 0,
|
|
4114
|
+
sampleValue: v.sampleValue ? v.sampleValue : void 0
|
|
4115
|
+
};
|
|
4116
|
+
}
|
|
3611
4117
|
function VariablesPanel() {
|
|
3612
4118
|
var _a;
|
|
3613
4119
|
const document2 = useDocument();
|
|
4120
|
+
const lastFocused = useLastFocusedEditable();
|
|
3614
4121
|
const root = document2.root;
|
|
3615
4122
|
if (!root || root.type !== "EmailLayout") {
|
|
3616
|
-
return /* @__PURE__ */
|
|
4123
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React58__default.default.createElement(material.Alert, { severity: "info" }, "Open a template to manage variables."));
|
|
3617
4124
|
}
|
|
3618
4125
|
const data = root.data;
|
|
3619
4126
|
const variables = ((_a = data.variables) != null ? _a : []).map((v) => {
|
|
3620
|
-
var _a2;
|
|
4127
|
+
var _a2, _b;
|
|
3621
4128
|
return {
|
|
3622
4129
|
name: v.name,
|
|
3623
|
-
description: (_a2 = v.description) != null ? _a2 : ""
|
|
4130
|
+
description: (_a2 = v.description) != null ? _a2 : "",
|
|
4131
|
+
sampleValue: (_b = v.sampleValue) != null ? _b : ""
|
|
3624
4132
|
};
|
|
3625
4133
|
});
|
|
3626
|
-
const
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
4134
|
+
const usage = React58.useMemo(() => collectTokenUsage(document2), [document2]);
|
|
4135
|
+
const declaredNames = React58.useMemo(() => new Set(variables.map((v) => v.name)), [variables]);
|
|
4136
|
+
const undeclared = React58.useMemo(
|
|
4137
|
+
() => [...usage.keys()].filter((n) => n && !declaredNames.has(n)),
|
|
4138
|
+
[usage, declaredNames]
|
|
4139
|
+
);
|
|
4140
|
+
const writeVariables = (next, extraPatch = {}) => {
|
|
4141
|
+
var _a2;
|
|
4142
|
+
const baseRoot = (_a2 = extraPatch.root) != null ? _a2 : root;
|
|
4143
|
+
const newRoot = __spreadProps(__spreadValues({}, baseRoot), {
|
|
4144
|
+
data: __spreadProps(__spreadValues({}, baseRoot.data), {
|
|
4145
|
+
variables: next.map(toPersistShape)
|
|
3635
4146
|
})
|
|
3636
4147
|
});
|
|
4148
|
+
setDocument(__spreadProps(__spreadValues({}, extraPatch), { root: newRoot }));
|
|
3637
4149
|
};
|
|
3638
4150
|
const updateAt = (index, patch) => {
|
|
3639
4151
|
const next = variables.map((v, i) => i === index ? __spreadValues(__spreadValues({}, v), patch) : v);
|
|
3640
|
-
|
|
4152
|
+
writeVariables(next);
|
|
3641
4153
|
};
|
|
3642
4154
|
const add = () => {
|
|
3643
|
-
|
|
4155
|
+
writeVariables([...variables, { name: "", description: "", sampleValue: "" }]);
|
|
4156
|
+
};
|
|
4157
|
+
const addFromToken = (name) => {
|
|
4158
|
+
writeVariables([...variables, { name, description: "", sampleValue: "" }]);
|
|
3644
4159
|
};
|
|
3645
4160
|
const removeAt = (index) => {
|
|
3646
|
-
|
|
4161
|
+
var _a2;
|
|
4162
|
+
const v = variables[index];
|
|
4163
|
+
const usageCount = v.name ? (_a2 = usage.get(v.name)) != null ? _a2 : 0 : 0;
|
|
4164
|
+
if (usageCount > 0) {
|
|
4165
|
+
const ok = window.confirm(
|
|
4166
|
+
`"${v.name}" is still referenced in the body (${usageCount} occurrence${usageCount === 1 ? "" : "s"}). Delete anyway?`
|
|
4167
|
+
);
|
|
4168
|
+
if (!ok) return;
|
|
4169
|
+
}
|
|
4170
|
+
writeVariables(variables.filter((_, i) => i !== index));
|
|
4171
|
+
};
|
|
4172
|
+
const commitRename = (index, newName) => {
|
|
4173
|
+
const oldName = variables[index].name;
|
|
4174
|
+
const trimmed = newName.trim();
|
|
4175
|
+
if (trimmed === oldName) return;
|
|
4176
|
+
const error = validateVariableName(trimmed, variables, index);
|
|
4177
|
+
if (error) return;
|
|
4178
|
+
const patch = oldName ? buildRenamePatch(document2, oldName, trimmed) : {};
|
|
4179
|
+
const next = variables.map((v, i) => i === index ? __spreadProps(__spreadValues({}, v), { name: trimmed }) : v);
|
|
4180
|
+
writeVariables(next, patch);
|
|
3647
4181
|
};
|
|
3648
|
-
|
|
4182
|
+
const canInsert = Boolean(
|
|
4183
|
+
lastFocused && (lastFocused.field === "subject" || lastFocused.blockId && document2[lastFocused.blockId])
|
|
4184
|
+
);
|
|
4185
|
+
const insertIntoFocused = (name) => {
|
|
4186
|
+
var _a2, _b, _c;
|
|
4187
|
+
const focused = getLastFocusedEditable();
|
|
4188
|
+
if (!focused) return;
|
|
4189
|
+
const token = `{{${name}}}`;
|
|
4190
|
+
if (focused.field === "subject") {
|
|
4191
|
+
const layoutData = root.data;
|
|
4192
|
+
const current2 = (_a2 = layoutData.subject) != null ? _a2 : "";
|
|
4193
|
+
const next2 = current2.slice(0, focused.selectionStart) + token + current2.slice(focused.selectionEnd);
|
|
4194
|
+
setDocument({
|
|
4195
|
+
root: __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, layoutData), { subject: next2 }) })
|
|
4196
|
+
});
|
|
4197
|
+
return;
|
|
4198
|
+
}
|
|
4199
|
+
const block = document2[focused.blockId];
|
|
4200
|
+
if (!block) return;
|
|
4201
|
+
const blockData = block.data;
|
|
4202
|
+
const props = (_b = blockData == null ? void 0 : blockData.props) != null ? _b : {};
|
|
4203
|
+
const field = focused.field;
|
|
4204
|
+
const current = (_c = props[field]) != null ? _c : "";
|
|
4205
|
+
const next = current.slice(0, focused.selectionStart) + token + current.slice(focused.selectionEnd);
|
|
4206
|
+
setDocument({
|
|
4207
|
+
[focused.blockId]: __spreadProps(__spreadValues({}, block), {
|
|
4208
|
+
data: __spreadProps(__spreadValues({}, blockData), { props: __spreadProps(__spreadValues({}, props), { [field]: next }) })
|
|
4209
|
+
})
|
|
4210
|
+
});
|
|
4211
|
+
};
|
|
4212
|
+
const copy = (name) => __async(null, null, function* () {
|
|
4213
|
+
try {
|
|
4214
|
+
yield navigator.clipboard.writeText(`{{${name}}}`);
|
|
4215
|
+
} catch (e) {
|
|
4216
|
+
}
|
|
4217
|
+
});
|
|
4218
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { mb: 1 } }, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "subtitle1", sx: { fontWeight: 600 } }, "Variables"), /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Add variable" }, /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { size: "small", onClick: add, "aria-label": "Add variable" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })))), /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mb: 2 } }, "Declared variables travel with the template. Reference them in subject and body as", " ", /* @__PURE__ */ React58__default.default.createElement(material.Box, { component: "code", sx: { fontFamily: "monospace" } }, "{{name}}"), ". In Preview mode, tokens render with the sample values below."), undeclared.length > 0 && /* @__PURE__ */ React58__default.default.createElement(material.Alert, { severity: "warning", sx: { mb: 2 } }, /* @__PURE__ */ React58__default.default.createElement(material.AlertTitle, { sx: { fontSize: 13 } }, "Undeclared in body"), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, useFlexGap: true, flexWrap: "wrap" }, undeclared.map((name) => /* @__PURE__ */ React58__default.default.createElement(
|
|
4219
|
+
material.Chip,
|
|
4220
|
+
{
|
|
4221
|
+
key: name,
|
|
4222
|
+
size: "small",
|
|
4223
|
+
label: name,
|
|
4224
|
+
onClick: () => addFromToken(name),
|
|
4225
|
+
onDelete: () => addFromToken(name),
|
|
4226
|
+
deleteIcon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AddOutlined, null),
|
|
4227
|
+
sx: { fontFamily: "monospace" }
|
|
4228
|
+
}
|
|
4229
|
+
))), /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mt: 0.5 } }, "Click a token to declare it.")), variables.length === 0 ? /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary" } }, "No variables declared. Click + to add one.") : /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 2 }, variables.map((v, i) => {
|
|
3649
4230
|
var _a2;
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
material.TextField,
|
|
4231
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
4232
|
+
VariableRow,
|
|
3653
4233
|
{
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
4234
|
+
key: i,
|
|
4235
|
+
index: i,
|
|
4236
|
+
variable: v,
|
|
4237
|
+
siblings: variables,
|
|
4238
|
+
usageCount: v.name ? (_a2 = usage.get(v.name)) != null ? _a2 : 0 : 0,
|
|
4239
|
+
canInsert,
|
|
4240
|
+
onCommitRename: (name) => commitRename(i, name),
|
|
4241
|
+
onChangeDescription: (description) => updateAt(i, { description }),
|
|
4242
|
+
onChangeSampleValue: (sampleValue) => updateAt(i, { sampleValue }),
|
|
4243
|
+
onRemove: () => removeAt(i),
|
|
4244
|
+
onInsert: () => v.name && insertIntoFocused(v.name),
|
|
4245
|
+
onCopy: () => v.name && copy(v.name)
|
|
3661
4246
|
}
|
|
3662
|
-
)
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
4247
|
+
);
|
|
4248
|
+
})));
|
|
4249
|
+
}
|
|
4250
|
+
function VariableRow({
|
|
4251
|
+
index,
|
|
4252
|
+
variable,
|
|
4253
|
+
siblings,
|
|
4254
|
+
usageCount,
|
|
4255
|
+
canInsert,
|
|
4256
|
+
onCommitRename,
|
|
4257
|
+
onChangeDescription,
|
|
4258
|
+
onChangeSampleValue,
|
|
4259
|
+
onRemove,
|
|
4260
|
+
onInsert,
|
|
4261
|
+
onCopy
|
|
4262
|
+
}) {
|
|
4263
|
+
var _a, _b;
|
|
4264
|
+
const [draftName, setDraftName] = React58.useState(variable.name);
|
|
4265
|
+
const [isEditing, setIsEditing] = React58.useState(false);
|
|
4266
|
+
React58.useEffect(() => {
|
|
4267
|
+
if (!isEditing) setDraftName(variable.name);
|
|
4268
|
+
}, [variable.name, isEditing]);
|
|
4269
|
+
const nameError = validateVariableName(draftName, siblings, index);
|
|
4270
|
+
const unused = Boolean(variable.name) && usageCount === 0;
|
|
4271
|
+
const hasName = Boolean(variable.name);
|
|
4272
|
+
const commit = () => {
|
|
4273
|
+
setIsEditing(false);
|
|
4274
|
+
if (nameError) {
|
|
4275
|
+
setDraftName(variable.name);
|
|
4276
|
+
return;
|
|
4277
|
+
}
|
|
4278
|
+
if (draftName.trim() !== variable.name) {
|
|
4279
|
+
onCommitRename(draftName.trim());
|
|
4280
|
+
}
|
|
4281
|
+
};
|
|
4282
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 0.75, sx: { pb: 1, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
4283
|
+
material.TextField,
|
|
4284
|
+
{
|
|
4285
|
+
label: "Name",
|
|
4286
|
+
size: "small",
|
|
4287
|
+
fullWidth: true,
|
|
4288
|
+
value: draftName,
|
|
4289
|
+
onChange: (e) => {
|
|
4290
|
+
setDraftName(e.target.value);
|
|
4291
|
+
setIsEditing(true);
|
|
3669
4292
|
},
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
4293
|
+
onFocus: () => setIsEditing(true),
|
|
4294
|
+
onBlur: commit,
|
|
4295
|
+
onKeyDown: (e) => {
|
|
4296
|
+
if (e.key === "Enter") {
|
|
4297
|
+
e.target.blur();
|
|
4298
|
+
} else if (e.key === "Escape") {
|
|
4299
|
+
setDraftName(variable.name);
|
|
4300
|
+
setIsEditing(false);
|
|
4301
|
+
e.target.blur();
|
|
4302
|
+
}
|
|
4303
|
+
},
|
|
4304
|
+
error: Boolean(nameError),
|
|
4305
|
+
helperText: nameError != null ? nameError : " "
|
|
4306
|
+
}
|
|
4307
|
+
), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 0.25, sx: { mt: 0.5 } }, /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Copy {{name}}" }, /* @__PURE__ */ React58__default.default.createElement("span", null, /* @__PURE__ */ React58__default.default.createElement(
|
|
4308
|
+
material.IconButton,
|
|
4309
|
+
{
|
|
4310
|
+
size: "small",
|
|
4311
|
+
onClick: onCopy,
|
|
4312
|
+
disabled: !hasName,
|
|
4313
|
+
"aria-label": `Copy ${variable.name || "variable"} token`
|
|
4314
|
+
},
|
|
4315
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" })
|
|
4316
|
+
))), /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: canInsert ? "Insert at cursor" : "Focus a text field first" }, /* @__PURE__ */ React58__default.default.createElement("span", null, /* @__PURE__ */ React58__default.default.createElement(
|
|
4317
|
+
material.IconButton,
|
|
4318
|
+
{
|
|
4319
|
+
size: "small",
|
|
4320
|
+
onClick: onInsert,
|
|
4321
|
+
disabled: !hasName || !canInsert,
|
|
4322
|
+
"aria-label": `Insert ${variable.name || "variable"} at cursor`
|
|
4323
|
+
},
|
|
4324
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.InputOutlined, { fontSize: "small" })
|
|
4325
|
+
))), /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Remove" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
4326
|
+
material.IconButton,
|
|
4327
|
+
{
|
|
4328
|
+
size: "small",
|
|
4329
|
+
onClick: onRemove,
|
|
4330
|
+
"aria-label": `Remove ${variable.name || "variable"}`
|
|
4331
|
+
},
|
|
4332
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DeleteOutline, { fontSize: "small" })
|
|
4333
|
+
)))), /* @__PURE__ */ React58__default.default.createElement(
|
|
4334
|
+
material.TextField,
|
|
4335
|
+
{
|
|
4336
|
+
label: "Description",
|
|
4337
|
+
size: "small",
|
|
4338
|
+
fullWidth: true,
|
|
4339
|
+
value: (_a = variable.description) != null ? _a : "",
|
|
4340
|
+
onChange: (e) => onChangeDescription(e.target.value),
|
|
4341
|
+
placeholder: "Optional"
|
|
4342
|
+
}
|
|
4343
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
4344
|
+
material.TextField,
|
|
4345
|
+
{
|
|
4346
|
+
label: "Sample value",
|
|
4347
|
+
size: "small",
|
|
4348
|
+
fullWidth: true,
|
|
4349
|
+
value: (_b = variable.sampleValue) != null ? _b : "",
|
|
4350
|
+
onChange: (e) => onChangeSampleValue(e.target.value),
|
|
4351
|
+
placeholder: "Shown in Preview mode",
|
|
4352
|
+
InputProps: {
|
|
4353
|
+
startAdornment: /* @__PURE__ */ React58__default.default.createElement(
|
|
4354
|
+
iconsMaterial.DataObjectOutlined,
|
|
4355
|
+
{
|
|
4356
|
+
fontSize: "small",
|
|
4357
|
+
sx: { color: "text.secondary", mr: 0.75 }
|
|
4358
|
+
}
|
|
4359
|
+
)
|
|
3680
4360
|
}
|
|
3681
|
-
|
|
3682
|
-
})
|
|
4361
|
+
}
|
|
4362
|
+
), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { pt: 0.25 } }, hasName && (unused ? /* @__PURE__ */ React58__default.default.createElement(material.Chip, { size: "small", color: "warning", variant: "outlined", label: "Unused in body" }) : /* @__PURE__ */ React58__default.default.createElement(
|
|
4363
|
+
material.Chip,
|
|
4364
|
+
{
|
|
4365
|
+
size: "small",
|
|
4366
|
+
variant: "outlined",
|
|
4367
|
+
label: `${usageCount} ref${usageCount === 1 ? "" : "s"}`
|
|
4368
|
+
}
|
|
4369
|
+
))));
|
|
3683
4370
|
}
|
|
3684
4371
|
|
|
3685
4372
|
// src/app/inspector-drawer/index.tsx
|
|
@@ -3696,13 +4383,13 @@ function InspectorDrawer({
|
|
|
3696
4383
|
const renderCurrentSidebarPanel = () => {
|
|
3697
4384
|
switch (selectedSidebarTab) {
|
|
3698
4385
|
case "block-configuration":
|
|
3699
|
-
return /* @__PURE__ */
|
|
4386
|
+
return /* @__PURE__ */ React58__default.default.createElement(ConfigurationPanel, null);
|
|
3700
4387
|
case "styles":
|
|
3701
|
-
return /* @__PURE__ */
|
|
4388
|
+
return /* @__PURE__ */ React58__default.default.createElement(StylesPanel, null);
|
|
3702
4389
|
case "variables":
|
|
3703
|
-
return /* @__PURE__ */
|
|
4390
|
+
return /* @__PURE__ */ React58__default.default.createElement(VariablesPanel, null);
|
|
3704
4391
|
case "template-settings":
|
|
3705
|
-
return /* @__PURE__ */
|
|
4392
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
3706
4393
|
TemplatePanel,
|
|
3707
4394
|
{
|
|
3708
4395
|
deleteTemplate,
|
|
@@ -3711,7 +4398,7 @@ function InspectorDrawer({
|
|
|
3711
4398
|
);
|
|
3712
4399
|
}
|
|
3713
4400
|
};
|
|
3714
|
-
return /* @__PURE__ */
|
|
4401
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
3715
4402
|
material.Drawer,
|
|
3716
4403
|
{
|
|
3717
4404
|
variant: "persistent",
|
|
@@ -3733,7 +4420,7 @@ function InspectorDrawer({
|
|
|
3733
4420
|
width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
|
|
3734
4421
|
}
|
|
3735
4422
|
},
|
|
3736
|
-
/* @__PURE__ */
|
|
4423
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React58__default.default.createElement(material.Box, { px: 1 }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3737
4424
|
material.Tabs,
|
|
3738
4425
|
{
|
|
3739
4426
|
value: selectedSidebarTab,
|
|
@@ -3741,25 +4428,25 @@ function InspectorDrawer({
|
|
|
3741
4428
|
variant: "fullWidth",
|
|
3742
4429
|
sx: { "& .MuiTab-root": { minWidth: 0, px: 1, fontSize: 13 } }
|
|
3743
4430
|
},
|
|
3744
|
-
/* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3747
|
-
/* @__PURE__ */
|
|
4431
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Tab, { value: "styles", label: "Styles" }),
|
|
4432
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Tab, { value: "block-configuration", label: "Inspect" }),
|
|
4433
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Tab, { value: "variables", label: "Variables" }),
|
|
4434
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Tab, { value: "template-settings", label: "Settings" })
|
|
3748
4435
|
))),
|
|
3749
|
-
/* @__PURE__ */
|
|
4436
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
|
|
3750
4437
|
);
|
|
3751
4438
|
}
|
|
3752
|
-
var SnackbarContext =
|
|
4439
|
+
var SnackbarContext = React58.createContext(null);
|
|
3753
4440
|
function useSnackbar() {
|
|
3754
|
-
const context =
|
|
4441
|
+
const context = React58.useContext(SnackbarContext);
|
|
3755
4442
|
if (!context) {
|
|
3756
4443
|
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
3757
4444
|
}
|
|
3758
4445
|
return context;
|
|
3759
4446
|
}
|
|
3760
4447
|
function SnackbarProvider({ children }) {
|
|
3761
|
-
const [message, setMessage] =
|
|
3762
|
-
const [duration, setDuration] =
|
|
4448
|
+
const [message, setMessage] = React58.useState(null);
|
|
4449
|
+
const [duration, setDuration] = React58.useState(3e3);
|
|
3763
4450
|
const showMessage = (text, customDuration = 3e3) => {
|
|
3764
4451
|
setMessage(text);
|
|
3765
4452
|
setDuration(customDuration);
|
|
@@ -3767,7 +4454,7 @@ function SnackbarProvider({ children }) {
|
|
|
3767
4454
|
const handleClose = () => {
|
|
3768
4455
|
setMessage(null);
|
|
3769
4456
|
};
|
|
3770
|
-
return /* @__PURE__ */
|
|
4457
|
+
return /* @__PURE__ */ React58__default.default.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React58__default.default.createElement(
|
|
3771
4458
|
material.Snackbar,
|
|
3772
4459
|
{
|
|
3773
4460
|
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
@@ -3814,7 +4501,7 @@ function TemplateRow({
|
|
|
3814
4501
|
onDuplicateAsTemplate
|
|
3815
4502
|
}) {
|
|
3816
4503
|
const { setCurrentTemplate } = useEmailEditor();
|
|
3817
|
-
const [hover, setHover] =
|
|
4504
|
+
const [hover, setHover] = React58.useState(false);
|
|
3818
4505
|
const handleClick = () => __async(null, null, function* () {
|
|
3819
4506
|
try {
|
|
3820
4507
|
const content = yield templateLoader();
|
|
@@ -3833,7 +4520,7 @@ function TemplateRow({
|
|
|
3833
4520
|
const hasActions = Boolean(
|
|
3834
4521
|
onDuplicate || onRename || onDelete || onPromote || onDemote || onDuplicateAsTemplate
|
|
3835
4522
|
);
|
|
3836
|
-
return /* @__PURE__ */
|
|
4523
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
3837
4524
|
material.Box,
|
|
3838
4525
|
{
|
|
3839
4526
|
role: "button",
|
|
@@ -3859,7 +4546,7 @@ function TemplateRow({
|
|
|
3859
4546
|
"&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
|
|
3860
4547
|
}
|
|
3861
4548
|
},
|
|
3862
|
-
/* @__PURE__ */
|
|
4549
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", alignItems: "flex-start", spacing: 1 }, /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", alignItems: "baseline", spacing: 1, sx: { minWidth: 0 } }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3863
4550
|
material.Typography,
|
|
3864
4551
|
{
|
|
3865
4552
|
variant: "body2",
|
|
@@ -3873,14 +4560,14 @@ function TemplateRow({
|
|
|
3873
4560
|
title: template.slug
|
|
3874
4561
|
},
|
|
3875
4562
|
template.slug
|
|
3876
|
-
), updated && /* @__PURE__ */
|
|
4563
|
+
), updated && /* @__PURE__ */ React58__default.default.createElement(
|
|
3877
4564
|
material.Typography,
|
|
3878
4565
|
{
|
|
3879
4566
|
variant: "caption",
|
|
3880
4567
|
sx: { color: "text.secondary", flexShrink: 0, fontSize: "0.7rem" }
|
|
3881
4568
|
},
|
|
3882
4569
|
updated
|
|
3883
|
-
)), template.description && /* @__PURE__ */
|
|
4570
|
+
)), template.description && /* @__PURE__ */ React58__default.default.createElement(
|
|
3884
4571
|
material.Typography,
|
|
3885
4572
|
{
|
|
3886
4573
|
variant: "caption",
|
|
@@ -3894,7 +4581,7 @@ function TemplateRow({
|
|
|
3894
4581
|
}
|
|
3895
4582
|
},
|
|
3896
4583
|
template.description
|
|
3897
|
-
), template.tags && template.tags.length > 0 && /* @__PURE__ */
|
|
4584
|
+
), template.tags && template.tags.length > 0 && /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { mt: 0.5, flexWrap: "wrap", gap: 0.5 } }, template.tags.map((tag) => /* @__PURE__ */ React58__default.default.createElement(
|
|
3898
4585
|
material.Chip,
|
|
3899
4586
|
{
|
|
3900
4587
|
key: tag,
|
|
@@ -3903,7 +4590,7 @@ function TemplateRow({
|
|
|
3903
4590
|
sx: { height: 18, fontSize: "0.65rem", "& .MuiChip-label": { px: 0.75 } }
|
|
3904
4591
|
}
|
|
3905
4592
|
))))),
|
|
3906
|
-
hasActions && hover && /* @__PURE__ */
|
|
4593
|
+
hasActions && hover && /* @__PURE__ */ React58__default.default.createElement(
|
|
3907
4594
|
material.Stack,
|
|
3908
4595
|
{
|
|
3909
4596
|
direction: "row",
|
|
@@ -3919,7 +4606,7 @@ function TemplateRow({
|
|
|
3919
4606
|
p: 0.25
|
|
3920
4607
|
}
|
|
3921
4608
|
},
|
|
3922
|
-
onDuplicateAsTemplate && /* @__PURE__ */
|
|
4609
|
+
onDuplicateAsTemplate && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Duplicate as template" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3923
4610
|
material.IconButton,
|
|
3924
4611
|
{
|
|
3925
4612
|
size: "small",
|
|
@@ -3928,9 +4615,9 @@ function TemplateRow({
|
|
|
3928
4615
|
onDuplicateAsTemplate();
|
|
3929
4616
|
}
|
|
3930
4617
|
},
|
|
3931
|
-
/* @__PURE__ */
|
|
4618
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.LibraryAddOutlined, { fontSize: "small" })
|
|
3932
4619
|
)),
|
|
3933
|
-
onDuplicate && /* @__PURE__ */
|
|
4620
|
+
onDuplicate && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Duplicate" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3934
4621
|
material.IconButton,
|
|
3935
4622
|
{
|
|
3936
4623
|
size: "small",
|
|
@@ -3939,9 +4626,9 @@ function TemplateRow({
|
|
|
3939
4626
|
onDuplicate();
|
|
3940
4627
|
}
|
|
3941
4628
|
},
|
|
3942
|
-
/* @__PURE__ */
|
|
4629
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" })
|
|
3943
4630
|
)),
|
|
3944
|
-
onRename && /* @__PURE__ */
|
|
4631
|
+
onRename && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Rename" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3945
4632
|
material.IconButton,
|
|
3946
4633
|
{
|
|
3947
4634
|
size: "small",
|
|
@@ -3950,9 +4637,9 @@ function TemplateRow({
|
|
|
3950
4637
|
onRename();
|
|
3951
4638
|
}
|
|
3952
4639
|
},
|
|
3953
|
-
/* @__PURE__ */
|
|
4640
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DriveFileRenameOutlineOutlined, { fontSize: "small" })
|
|
3954
4641
|
)),
|
|
3955
|
-
onPromote && /* @__PURE__ */
|
|
4642
|
+
onPromote && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Promote to sample" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3956
4643
|
material.IconButton,
|
|
3957
4644
|
{
|
|
3958
4645
|
size: "small",
|
|
@@ -3961,9 +4648,9 @@ function TemplateRow({
|
|
|
3961
4648
|
onPromote();
|
|
3962
4649
|
}
|
|
3963
4650
|
},
|
|
3964
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FileUploadOutlined, { fontSize: "small" })
|
|
3965
4652
|
)),
|
|
3966
|
-
onDemote && /* @__PURE__ */
|
|
4653
|
+
onDemote && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Demote to template" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3967
4654
|
material.IconButton,
|
|
3968
4655
|
{
|
|
3969
4656
|
size: "small",
|
|
@@ -3972,9 +4659,9 @@ function TemplateRow({
|
|
|
3972
4659
|
onDemote();
|
|
3973
4660
|
}
|
|
3974
4661
|
},
|
|
3975
|
-
/* @__PURE__ */
|
|
4662
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FileDownloadOutlined, { fontSize: "small" })
|
|
3976
4663
|
)),
|
|
3977
|
-
onDelete && /* @__PURE__ */
|
|
4664
|
+
onDelete && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Delete" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
3978
4665
|
material.IconButton,
|
|
3979
4666
|
{
|
|
3980
4667
|
size: "small",
|
|
@@ -3983,7 +4670,7 @@ function TemplateRow({
|
|
|
3983
4670
|
onDelete();
|
|
3984
4671
|
}
|
|
3985
4672
|
},
|
|
3986
|
-
/* @__PURE__ */
|
|
4673
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DeleteOutlined, { fontSize: "small" })
|
|
3987
4674
|
))
|
|
3988
4675
|
)
|
|
3989
4676
|
);
|
|
@@ -3995,10 +4682,10 @@ function RenameDialog({
|
|
|
3995
4682
|
onClose,
|
|
3996
4683
|
onSubmit
|
|
3997
4684
|
}) {
|
|
3998
|
-
const [value, setValue] =
|
|
3999
|
-
const [error, setError] =
|
|
4000
|
-
const [submitting, setSubmitting] =
|
|
4001
|
-
|
|
4685
|
+
const [value, setValue] = React58.useState(currentSlug);
|
|
4686
|
+
const [error, setError] = React58.useState(null);
|
|
4687
|
+
const [submitting, setSubmitting] = React58.useState(false);
|
|
4688
|
+
React58.useEffect(() => {
|
|
4002
4689
|
if (open) {
|
|
4003
4690
|
setValue(currentSlug);
|
|
4004
4691
|
setError(null);
|
|
@@ -4034,7 +4721,7 @@ function RenameDialog({
|
|
|
4034
4721
|
setSubmitting(false);
|
|
4035
4722
|
}
|
|
4036
4723
|
});
|
|
4037
|
-
return /* @__PURE__ */
|
|
4724
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Dialog, { open, onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React58__default.default.createElement(material.DialogTitle, null, "Rename template"), /* @__PURE__ */ React58__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
4038
4725
|
material.TextField,
|
|
4039
4726
|
{
|
|
4040
4727
|
autoFocus: true,
|
|
@@ -4053,7 +4740,7 @@ function RenameDialog({
|
|
|
4053
4740
|
}
|
|
4054
4741
|
}
|
|
4055
4742
|
}
|
|
4056
|
-
)), /* @__PURE__ */
|
|
4743
|
+
)), /* @__PURE__ */ React58__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React58__default.default.createElement(material.Button, { onClick: onClose, disabled: submitting }, "Cancel"), /* @__PURE__ */ React58__default.default.createElement(
|
|
4057
4744
|
material.Button,
|
|
4058
4745
|
{
|
|
4059
4746
|
onClick: handleSubmit,
|
|
@@ -4071,10 +4758,10 @@ function SaveTemplateDialog({
|
|
|
4071
4758
|
defaultName = "",
|
|
4072
4759
|
error: externalError = null
|
|
4073
4760
|
}) {
|
|
4074
|
-
const [templateName, setTemplateName] =
|
|
4075
|
-
const [internalError, setInternalError] =
|
|
4076
|
-
const [isSubmitting, setIsSubmitting] =
|
|
4077
|
-
|
|
4761
|
+
const [templateName, setTemplateName] = React58.useState(defaultName);
|
|
4762
|
+
const [internalError, setInternalError] = React58.useState("");
|
|
4763
|
+
const [isSubmitting, setIsSubmitting] = React58.useState(false);
|
|
4764
|
+
React58.useEffect(() => {
|
|
4078
4765
|
if (open) {
|
|
4079
4766
|
setTemplateName(defaultName);
|
|
4080
4767
|
setInternalError("");
|
|
@@ -4122,7 +4809,7 @@ function SaveTemplateDialog({
|
|
|
4122
4809
|
setInternalError("");
|
|
4123
4810
|
onClose();
|
|
4124
4811
|
};
|
|
4125
|
-
return /* @__PURE__ */
|
|
4812
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
4126
4813
|
material.Dialog,
|
|
4127
4814
|
{
|
|
4128
4815
|
open,
|
|
@@ -4130,8 +4817,8 @@ function SaveTemplateDialog({
|
|
|
4130
4817
|
maxWidth: "sm",
|
|
4131
4818
|
fullWidth: true
|
|
4132
4819
|
},
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ React58__default.default.createElement(material.DialogTitle, null, "Save Email Template"),
|
|
4821
|
+
/* @__PURE__ */ React58__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { pt: 1 } }, /* @__PURE__ */ React58__default.default.createElement(
|
|
4135
4822
|
material.TextField,
|
|
4136
4823
|
{
|
|
4137
4824
|
autoFocus: true,
|
|
@@ -4153,7 +4840,7 @@ function SaveTemplateDialog({
|
|
|
4153
4840
|
disabled: isSubmitting
|
|
4154
4841
|
}
|
|
4155
4842
|
))),
|
|
4156
|
-
/* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ React58__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React58__default.default.createElement(material.Button, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React58__default.default.createElement(
|
|
4157
4844
|
material.Button,
|
|
4158
4845
|
{
|
|
4159
4846
|
onClick: handleSave,
|
|
@@ -4223,17 +4910,17 @@ function SamplesDrawer({
|
|
|
4223
4910
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
4224
4911
|
const { setCurrentTemplate, loadTemplate: ctxLoadTemplate } = useEmailEditor();
|
|
4225
4912
|
const { showMessage } = useSnackbar();
|
|
4226
|
-
const [samples, setSamples] =
|
|
4227
|
-
const [templates, setTemplates] =
|
|
4228
|
-
const [loadingSamples, setLoadingSamples] =
|
|
4229
|
-
const [loadingTemplates, setLoadingTemplates] =
|
|
4230
|
-
const [templatesError, setTemplatesError] =
|
|
4231
|
-
const [search, setSearch] =
|
|
4232
|
-
const [sortKey, setSortKey] =
|
|
4233
|
-
const [activeTags, setActiveTags] =
|
|
4234
|
-
const [renameTarget, setRenameTarget] =
|
|
4235
|
-
const [pendingSaveAs, setPendingSaveAs] =
|
|
4236
|
-
const [newError, setNewError] =
|
|
4913
|
+
const [samples, setSamples] = React58.useState([EMPTY_TEMPLATE]);
|
|
4914
|
+
const [templates, setTemplates] = React58.useState([]);
|
|
4915
|
+
const [loadingSamples, setLoadingSamples] = React58.useState(false);
|
|
4916
|
+
const [loadingTemplates, setLoadingTemplates] = React58.useState(false);
|
|
4917
|
+
const [templatesError, setTemplatesError] = React58.useState(null);
|
|
4918
|
+
const [search, setSearch] = React58.useState("");
|
|
4919
|
+
const [sortKey, setSortKey] = React58.useState("updatedAt");
|
|
4920
|
+
const [activeTags, setActiveTags] = React58.useState([]);
|
|
4921
|
+
const [renameTarget, setRenameTarget] = React58.useState(null);
|
|
4922
|
+
const [pendingSaveAs, setPendingSaveAs] = React58.useState(null);
|
|
4923
|
+
const [newError, setNewError] = React58.useState(null);
|
|
4237
4924
|
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
4238
4925
|
if (templateId === "empty-email") {
|
|
4239
4926
|
return empty_email_message_default;
|
|
@@ -4244,7 +4931,7 @@ function SamplesDrawer({
|
|
|
4244
4931
|
return null;
|
|
4245
4932
|
});
|
|
4246
4933
|
const withKind = (items, fallback) => items.map((item) => item.kind ? item : __spreadProps(__spreadValues({}, item), { kind: fallback }));
|
|
4247
|
-
|
|
4934
|
+
React58.useEffect(() => {
|
|
4248
4935
|
if (!enabled || !samplesDrawerOpen || !loadSamples) return;
|
|
4249
4936
|
setLoadingSamples(true);
|
|
4250
4937
|
loadSamples().then((results) => {
|
|
@@ -4270,11 +4957,11 @@ function SamplesDrawer({
|
|
|
4270
4957
|
setLoadingTemplates(false);
|
|
4271
4958
|
}
|
|
4272
4959
|
});
|
|
4273
|
-
|
|
4960
|
+
React58.useEffect(() => {
|
|
4274
4961
|
if (!enabled || !loadTemplates) return;
|
|
4275
4962
|
refreshTemplates();
|
|
4276
4963
|
}, [enabled, loadTemplates]);
|
|
4277
|
-
|
|
4964
|
+
React58.useEffect(() => {
|
|
4278
4965
|
const handler = (e) => {
|
|
4279
4966
|
const detail = e.detail;
|
|
4280
4967
|
if (Array.isArray(detail)) setTemplates(withKind(detail, "template"));
|
|
@@ -4282,7 +4969,7 @@ function SamplesDrawer({
|
|
|
4282
4969
|
window.addEventListener("templateListUpdated", handler);
|
|
4283
4970
|
return () => window.removeEventListener("templateListUpdated", handler);
|
|
4284
4971
|
}, []);
|
|
4285
|
-
const { templateRows, sampleRows } =
|
|
4972
|
+
const { templateRows, sampleRows } = React58.useMemo(() => {
|
|
4286
4973
|
const byId = /* @__PURE__ */ new Map();
|
|
4287
4974
|
for (const s of samples) byId.set(s.id, s);
|
|
4288
4975
|
for (const t of templates) byId.set(t.id, t);
|
|
@@ -4292,7 +4979,7 @@ function SamplesDrawer({
|
|
|
4292
4979
|
sampleRows: all.filter((t) => t.kind === "sample")
|
|
4293
4980
|
};
|
|
4294
4981
|
}, [samples, templates]);
|
|
4295
|
-
const allTags =
|
|
4982
|
+
const allTags = React58.useMemo(() => {
|
|
4296
4983
|
var _a2;
|
|
4297
4984
|
const set = /* @__PURE__ */ new Set();
|
|
4298
4985
|
for (const t of templateRows) {
|
|
@@ -4300,7 +4987,7 @@ function SamplesDrawer({
|
|
|
4300
4987
|
}
|
|
4301
4988
|
return Array.from(set).sort();
|
|
4302
4989
|
}, [templateRows]);
|
|
4303
|
-
const filteredTemplates =
|
|
4990
|
+
const filteredTemplates = React58.useMemo(() => {
|
|
4304
4991
|
const term = search.trim().toLowerCase();
|
|
4305
4992
|
const matchSearch = (t) => {
|
|
4306
4993
|
if (!term) return true;
|
|
@@ -4419,7 +5106,7 @@ function SamplesDrawer({
|
|
|
4419
5106
|
return null;
|
|
4420
5107
|
}
|
|
4421
5108
|
const existingSlugs = templates.map((t) => t.slug);
|
|
4422
|
-
return /* @__PURE__ */
|
|
5109
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
4423
5110
|
material.Drawer,
|
|
4424
5111
|
{
|
|
4425
5112
|
variant: "persistent",
|
|
@@ -4434,7 +5121,7 @@ function SamplesDrawer({
|
|
|
4434
5121
|
transitionDuration: { enter: enterDuration, exit: exitDuration },
|
|
4435
5122
|
sx: { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0 }
|
|
4436
5123
|
},
|
|
4437
|
-
/* @__PURE__ */
|
|
5124
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
4438
5125
|
material.Stack,
|
|
4439
5126
|
{
|
|
4440
5127
|
py: 1,
|
|
@@ -4444,16 +5131,16 @@ function SamplesDrawer({
|
|
|
4444
5131
|
spacing: 1.5,
|
|
4445
5132
|
sx: { overflowY: "auto" }
|
|
4446
5133
|
},
|
|
4447
|
-
/* @__PURE__ */
|
|
5134
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { pt: 1 } }, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "h6", component: "h1" }, "Templates"), saveAs && /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "New template" }, /* @__PURE__ */ React58__default.default.createElement(
|
|
4448
5135
|
material.IconButton,
|
|
4449
5136
|
{
|
|
4450
5137
|
size: "small",
|
|
4451
5138
|
onClick: openNewTemplateDialog,
|
|
4452
5139
|
"aria-label": "New template"
|
|
4453
5140
|
},
|
|
4454
|
-
/* @__PURE__ */
|
|
5141
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })
|
|
4455
5142
|
))),
|
|
4456
|
-
loadTemplates && /* @__PURE__ */
|
|
5143
|
+
loadTemplates && /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
4457
5144
|
material.TextField,
|
|
4458
5145
|
{
|
|
4459
5146
|
size: "small",
|
|
@@ -4461,10 +5148,10 @@ function SamplesDrawer({
|
|
|
4461
5148
|
value: search,
|
|
4462
5149
|
onChange: (e) => setSearch(e.target.value),
|
|
4463
5150
|
InputProps: {
|
|
4464
|
-
startAdornment: /* @__PURE__ */
|
|
5151
|
+
startAdornment: /* @__PURE__ */ React58__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SearchOutlined, { fontSize: "small" }))
|
|
4465
5152
|
}
|
|
4466
5153
|
}
|
|
4467
|
-
), /* @__PURE__ */
|
|
5154
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
4468
5155
|
material.TextField,
|
|
4469
5156
|
{
|
|
4470
5157
|
select: true,
|
|
@@ -4473,8 +5160,8 @@ function SamplesDrawer({
|
|
|
4473
5160
|
value: sortKey,
|
|
4474
5161
|
onChange: (e) => setSortKey(e.target.value)
|
|
4475
5162
|
},
|
|
4476
|
-
SORT_OPTIONS.map((opt) => /* @__PURE__ */
|
|
4477
|
-
), allTags.length > 0 && /* @__PURE__ */
|
|
5163
|
+
SORT_OPTIONS.map((opt) => /* @__PURE__ */ React58__default.default.createElement(material.MenuItem, { key: opt.value, value: opt.value }, opt.label))
|
|
5164
|
+
), allTags.length > 0 && /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 } }, allTags.map((tag) => /* @__PURE__ */ React58__default.default.createElement(
|
|
4478
5165
|
material.Chip,
|
|
4479
5166
|
{
|
|
4480
5167
|
key: tag,
|
|
@@ -4485,7 +5172,7 @@ function SamplesDrawer({
|
|
|
4485
5172
|
variant: activeTags.includes(tag) ? "filled" : "outlined",
|
|
4486
5173
|
onClick: () => toggleTag(tag)
|
|
4487
5174
|
}
|
|
4488
|
-
))), /* @__PURE__ */
|
|
5175
|
+
))), /* @__PURE__ */ React58__default.default.createElement(material.Box, null, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Your Templates"), loadingTemplates ? /* @__PURE__ */ React58__default.default.createElement(material.Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React58__default.default.createElement(material.CircularProgress, { size: 24 })) : templatesError ? /* @__PURE__ */ React58__default.default.createElement(material.Alert, { severity: "error", sx: { my: 1 } }, templatesError) : filteredTemplates.length > 0 ? /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredTemplates.map((template) => /* @__PURE__ */ React58__default.default.createElement(
|
|
4489
5176
|
TemplateRow,
|
|
4490
5177
|
{
|
|
4491
5178
|
key: template.id,
|
|
@@ -4497,8 +5184,8 @@ function SamplesDrawer({
|
|
|
4497
5184
|
onDelete: deleteTemplate ? () => handleDelete(template) : void 0,
|
|
4498
5185
|
onPromote: setTemplateKind ? () => handleSetKind(template, "sample") : void 0
|
|
4499
5186
|
}
|
|
4500
|
-
))) : /* @__PURE__ */
|
|
4501
|
-
/* @__PURE__ */
|
|
5187
|
+
))) : /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, templateRows.length === 0 ? "No saved templates yet" : "No templates match your filters")), /* @__PURE__ */ React58__default.default.createElement(material.Divider, null)),
|
|
5188
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, null, /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Sample Templates"), loadingSamples ? /* @__PURE__ */ React58__default.default.createElement(material.Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React58__default.default.createElement(material.CircularProgress, { size: 24 })) : sampleRows.length > 0 ? /* @__PURE__ */ React58__default.default.createElement(material.Stack, { spacing: 0.25, sx: { width: "100%" } }, sampleRows.map((sample) => /* @__PURE__ */ React58__default.default.createElement(
|
|
4502
5189
|
TemplateRow,
|
|
4503
5190
|
{
|
|
4504
5191
|
key: sample.id,
|
|
@@ -4508,9 +5195,9 @@ function SamplesDrawer({
|
|
|
4508
5195
|
onDuplicateAsTemplate: saveAs ? () => handleDuplicateAsTemplate(sample) : void 0,
|
|
4509
5196
|
onDemote: setTemplateKind && sample.id !== "empty-email" ? () => handleSetKind(sample, "template") : void 0
|
|
4510
5197
|
}
|
|
4511
|
-
))) : /* @__PURE__ */
|
|
5198
|
+
))) : /* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, "No samples available"))
|
|
4512
5199
|
)
|
|
4513
|
-
), renameTarget && /* @__PURE__ */
|
|
5200
|
+
), renameTarget && /* @__PURE__ */ React58__default.default.createElement(
|
|
4514
5201
|
RenameDialog,
|
|
4515
5202
|
{
|
|
4516
5203
|
open: !!renameTarget,
|
|
@@ -4519,7 +5206,7 @@ function SamplesDrawer({
|
|
|
4519
5206
|
onClose: () => setRenameTarget(null),
|
|
4520
5207
|
onSubmit: handleRenameSubmit
|
|
4521
5208
|
}
|
|
4522
|
-
), /* @__PURE__ */
|
|
5209
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
4523
5210
|
SaveTemplateDialog,
|
|
4524
5211
|
{
|
|
4525
5212
|
open: !!pendingSaveAs,
|
|
@@ -4546,7 +5233,7 @@ var ICON_SX = {
|
|
|
4546
5233
|
borderColor: "cadet.300"
|
|
4547
5234
|
};
|
|
4548
5235
|
function BlockTypeButton({ label, icon, onClick }) {
|
|
4549
|
-
return /* @__PURE__ */
|
|
5236
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
4550
5237
|
material.Button,
|
|
4551
5238
|
{
|
|
4552
5239
|
sx: BUTTON_SX2,
|
|
@@ -4555,14 +5242,14 @@ function BlockTypeButton({ label, icon, onClick }) {
|
|
|
4555
5242
|
onClick();
|
|
4556
5243
|
}
|
|
4557
5244
|
},
|
|
4558
|
-
/* @__PURE__ */
|
|
4559
|
-
/* @__PURE__ */
|
|
5245
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: ICON_SX }, icon),
|
|
5246
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Typography, { variant: "body2" }, label)
|
|
4560
5247
|
);
|
|
4561
5248
|
}
|
|
4562
5249
|
var BUTTONS = [
|
|
4563
5250
|
{
|
|
4564
5251
|
label: "Heading",
|
|
4565
|
-
icon: /* @__PURE__ */
|
|
5252
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.HMobiledataOutlined, null),
|
|
4566
5253
|
block: () => ({
|
|
4567
5254
|
type: "Heading",
|
|
4568
5255
|
data: {
|
|
@@ -4575,7 +5262,7 @@ var BUTTONS = [
|
|
|
4575
5262
|
},
|
|
4576
5263
|
{
|
|
4577
5264
|
label: "Text",
|
|
4578
|
-
icon: /* @__PURE__ */
|
|
5265
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.NotesOutlined, null),
|
|
4579
5266
|
block: () => ({
|
|
4580
5267
|
type: "Text",
|
|
4581
5268
|
data: {
|
|
@@ -4589,7 +5276,7 @@ var BUTTONS = [
|
|
|
4589
5276
|
},
|
|
4590
5277
|
{
|
|
4591
5278
|
label: "Button",
|
|
4592
|
-
icon: /* @__PURE__ */
|
|
5279
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SmartButtonOutlined, null),
|
|
4593
5280
|
block: () => ({
|
|
4594
5281
|
type: "Button",
|
|
4595
5282
|
data: {
|
|
@@ -4603,7 +5290,7 @@ var BUTTONS = [
|
|
|
4603
5290
|
},
|
|
4604
5291
|
{
|
|
4605
5292
|
label: "Image",
|
|
4606
|
-
icon: /* @__PURE__ */
|
|
5293
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ImageOutlined, null),
|
|
4607
5294
|
block: () => ({
|
|
4608
5295
|
type: "Image",
|
|
4609
5296
|
data: {
|
|
@@ -4619,7 +5306,7 @@ var BUTTONS = [
|
|
|
4619
5306
|
},
|
|
4620
5307
|
{
|
|
4621
5308
|
label: "Avatar",
|
|
4622
|
-
icon: /* @__PURE__ */
|
|
5309
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AccountCircleOutlined, null),
|
|
4623
5310
|
block: () => ({
|
|
4624
5311
|
type: "Avatar",
|
|
4625
5312
|
data: {
|
|
@@ -4633,7 +5320,7 @@ var BUTTONS = [
|
|
|
4633
5320
|
},
|
|
4634
5321
|
{
|
|
4635
5322
|
label: "Personal Signature",
|
|
4636
|
-
icon: /* @__PURE__ */
|
|
5323
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ContactMailOutlined, null),
|
|
4637
5324
|
block: () => ({
|
|
4638
5325
|
type: "Signature",
|
|
4639
5326
|
data: {
|
|
@@ -4655,7 +5342,7 @@ var BUTTONS = [
|
|
|
4655
5342
|
},
|
|
4656
5343
|
{
|
|
4657
5344
|
label: "Company Signature",
|
|
4658
|
-
icon: /* @__PURE__ */
|
|
5345
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.BusinessOutlined, null),
|
|
4659
5346
|
block: () => ({
|
|
4660
5347
|
type: "Signature",
|
|
4661
5348
|
data: {
|
|
@@ -4675,7 +5362,7 @@ var BUTTONS = [
|
|
|
4675
5362
|
},
|
|
4676
5363
|
{
|
|
4677
5364
|
label: "Divider",
|
|
4678
|
-
icon: /* @__PURE__ */
|
|
5365
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.HorizontalRuleOutlined, null),
|
|
4679
5366
|
block: () => ({
|
|
4680
5367
|
type: "Divider",
|
|
4681
5368
|
data: {
|
|
@@ -4688,7 +5375,7 @@ var BUTTONS = [
|
|
|
4688
5375
|
},
|
|
4689
5376
|
{
|
|
4690
5377
|
label: "Spacer",
|
|
4691
|
-
icon: /* @__PURE__ */
|
|
5378
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.Crop32Outlined, null),
|
|
4692
5379
|
block: () => ({
|
|
4693
5380
|
type: "Spacer",
|
|
4694
5381
|
data: {}
|
|
@@ -4696,7 +5383,7 @@ var BUTTONS = [
|
|
|
4696
5383
|
},
|
|
4697
5384
|
{
|
|
4698
5385
|
label: "Html",
|
|
4699
|
-
icon: /* @__PURE__ */
|
|
5386
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.HtmlOutlined, null),
|
|
4700
5387
|
block: () => ({
|
|
4701
5388
|
type: "Html",
|
|
4702
5389
|
data: {
|
|
@@ -4711,7 +5398,7 @@ var BUTTONS = [
|
|
|
4711
5398
|
},
|
|
4712
5399
|
{
|
|
4713
5400
|
label: "Columns",
|
|
4714
|
-
icon: /* @__PURE__ */
|
|
5401
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ViewColumnOutlined, null),
|
|
4715
5402
|
block: () => ({
|
|
4716
5403
|
type: "ColumnsContainer",
|
|
4717
5404
|
data: {
|
|
@@ -4726,7 +5413,7 @@ var BUTTONS = [
|
|
|
4726
5413
|
},
|
|
4727
5414
|
{
|
|
4728
5415
|
label: "Container",
|
|
4729
|
-
icon: /* @__PURE__ */
|
|
5416
|
+
icon: /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.LibraryAddOutlined, null),
|
|
4730
5417
|
block: () => ({
|
|
4731
5418
|
type: "Container",
|
|
4732
5419
|
data: {
|
|
@@ -4750,7 +5437,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4750
5437
|
if (anchorEl === null) {
|
|
4751
5438
|
return null;
|
|
4752
5439
|
}
|
|
4753
|
-
return /* @__PURE__ */
|
|
5440
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
4754
5441
|
material.Menu,
|
|
4755
5442
|
{
|
|
4756
5443
|
open: true,
|
|
@@ -4759,12 +5446,12 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4759
5446
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
4760
5447
|
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
4761
5448
|
},
|
|
4762
|
-
/* @__PURE__ */
|
|
5449
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React58__default.default.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
|
|
4763
5450
|
);
|
|
4764
5451
|
}
|
|
4765
5452
|
function DividerButton({ buttonElement, onClick }) {
|
|
4766
|
-
const [visible, setVisible] =
|
|
4767
|
-
|
|
5453
|
+
const [visible, setVisible] = React58.useState(false);
|
|
5454
|
+
React58.useEffect(() => {
|
|
4768
5455
|
function listener({ clientX, clientY }) {
|
|
4769
5456
|
if (!buttonElement) {
|
|
4770
5457
|
return;
|
|
@@ -4786,7 +5473,7 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4786
5473
|
window.removeEventListener("mousemove", listener);
|
|
4787
5474
|
};
|
|
4788
5475
|
}, [buttonElement, setVisible]);
|
|
4789
|
-
return /* @__PURE__ */
|
|
5476
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Fade, { in: visible }, /* @__PURE__ */ React58__default.default.createElement(
|
|
4790
5477
|
material.IconButton,
|
|
4791
5478
|
{
|
|
4792
5479
|
size: "small",
|
|
@@ -4809,11 +5496,11 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4809
5496
|
onClick();
|
|
4810
5497
|
}
|
|
4811
5498
|
},
|
|
4812
|
-
/* @__PURE__ */
|
|
5499
|
+
/* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })
|
|
4813
5500
|
));
|
|
4814
5501
|
}
|
|
4815
5502
|
function PlaceholderButton({ onClick }) {
|
|
4816
|
-
return /* @__PURE__ */
|
|
5503
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
4817
5504
|
material.ButtonBase,
|
|
4818
5505
|
{
|
|
4819
5506
|
onClick: (ev) => {
|
|
@@ -4829,7 +5516,7 @@ function PlaceholderButton({ onClick }) {
|
|
|
4829
5516
|
bgcolor: "rgba(0,0,0, 0.05)"
|
|
4830
5517
|
}
|
|
4831
5518
|
},
|
|
4832
|
-
/* @__PURE__ */
|
|
5519
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
4833
5520
|
iconsMaterial.AddOutlined,
|
|
4834
5521
|
{
|
|
4835
5522
|
sx: {
|
|
@@ -4846,19 +5533,19 @@ function PlaceholderButton({ onClick }) {
|
|
|
4846
5533
|
|
|
4847
5534
|
// src/editor/blocks/helpers/editor-children-ids/add-block-menu/index.tsx
|
|
4848
5535
|
function AddBlockButton({ onSelect, placeholder }) {
|
|
4849
|
-
const [menuAnchorEl, setMenuAnchorEl] =
|
|
4850
|
-
const [buttonElement, setButtonElement] =
|
|
5536
|
+
const [menuAnchorEl, setMenuAnchorEl] = React58.useState(null);
|
|
5537
|
+
const [buttonElement, setButtonElement] = React58.useState(null);
|
|
4851
5538
|
const handleButtonClick = () => {
|
|
4852
5539
|
setMenuAnchorEl(buttonElement);
|
|
4853
5540
|
};
|
|
4854
5541
|
const renderButton2 = () => {
|
|
4855
5542
|
if (placeholder) {
|
|
4856
|
-
return /* @__PURE__ */
|
|
5543
|
+
return /* @__PURE__ */ React58__default.default.createElement(PlaceholderButton, { onClick: handleButtonClick });
|
|
4857
5544
|
} else {
|
|
4858
|
-
return /* @__PURE__ */
|
|
5545
|
+
return /* @__PURE__ */ React58__default.default.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
|
|
4859
5546
|
}
|
|
4860
5547
|
};
|
|
4861
|
-
return /* @__PURE__ */
|
|
5548
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React58__default.default.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
|
|
4862
5549
|
}
|
|
4863
5550
|
|
|
4864
5551
|
// src/editor/blocks/helpers/editor-children-ids/index.tsx
|
|
@@ -4885,9 +5572,9 @@ function EditorChildrenIds({ childrenIds, onChange }) {
|
|
|
4885
5572
|
});
|
|
4886
5573
|
};
|
|
4887
5574
|
if (!childrenIds || childrenIds.length === 0) {
|
|
4888
|
-
return /* @__PURE__ */
|
|
5575
|
+
return /* @__PURE__ */ React58__default.default.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock });
|
|
4889
5576
|
}
|
|
4890
|
-
return /* @__PURE__ */
|
|
5577
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React58__default.default.createElement(React58.Fragment, { key: childId }, /* @__PURE__ */ React58__default.default.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), /* @__PURE__ */ React58__default.default.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React58__default.default.createElement(AddBlockButton, { onSelect: appendBlock }));
|
|
4891
5578
|
}
|
|
4892
5579
|
|
|
4893
5580
|
// src/editor/blocks/columns-container/columns-container-editor.tsx
|
|
@@ -4914,15 +5601,15 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
4914
5601
|
});
|
|
4915
5602
|
setSelectedBlockId(blockId);
|
|
4916
5603
|
};
|
|
4917
|
-
return /* @__PURE__ */
|
|
5604
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
4918
5605
|
columns_container_default,
|
|
4919
5606
|
{
|
|
4920
5607
|
props: restProps,
|
|
4921
5608
|
style,
|
|
4922
5609
|
columns: [
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
/* @__PURE__ */
|
|
4925
|
-
/* @__PURE__ */
|
|
5610
|
+
/* @__PURE__ */ React58__default.default.createElement(EditorChildrenIds, { childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds, onChange: (change) => updateColumn(0, change) }),
|
|
5611
|
+
/* @__PURE__ */ React58__default.default.createElement(EditorChildrenIds, { childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds, onChange: (change) => updateColumn(1, change) }),
|
|
5612
|
+
/* @__PURE__ */ React58__default.default.createElement(EditorChildrenIds, { childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds, onChange: (change) => updateColumn(2, change) })
|
|
4926
5613
|
]
|
|
4927
5614
|
}
|
|
4928
5615
|
);
|
|
@@ -4932,7 +5619,7 @@ function ContainerEditor({ style, props }) {
|
|
|
4932
5619
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
4933
5620
|
const document2 = useDocument();
|
|
4934
5621
|
const currentBlockId = useCurrentBlockId();
|
|
4935
|
-
return /* @__PURE__ */
|
|
5622
|
+
return /* @__PURE__ */ React58__default.default.createElement(container_default, { style }, /* @__PURE__ */ React58__default.default.createElement(
|
|
4936
5623
|
EditorChildrenIds,
|
|
4937
5624
|
{
|
|
4938
5625
|
childrenIds,
|
|
@@ -5038,7 +5725,7 @@ function EmailLayoutEditor(props) {
|
|
|
5038
5725
|
const document2 = useDocument();
|
|
5039
5726
|
const currentBlockId = useCurrentBlockId();
|
|
5040
5727
|
const selectedBlockId = useSelectedBlockId();
|
|
5041
|
-
const handleDelete =
|
|
5728
|
+
const handleDelete = React58.useCallback((e) => {
|
|
5042
5729
|
var _a2, _b2, _c2;
|
|
5043
5730
|
if (e.key !== "Delete" && e.key !== "Backspace") return;
|
|
5044
5731
|
if (!selectedBlockId) return;
|
|
@@ -5069,7 +5756,7 @@ function EmailLayoutEditor(props) {
|
|
|
5069
5756
|
delete nDocument[selectedBlockId];
|
|
5070
5757
|
resetDocument(nDocument);
|
|
5071
5758
|
}, [selectedBlockId, document2]);
|
|
5072
|
-
const handleCopy =
|
|
5759
|
+
const handleCopy = React58.useCallback((e) => {
|
|
5073
5760
|
if (!(e.metaKey || e.ctrlKey) || e.key !== "c") return;
|
|
5074
5761
|
if (!selectedBlockId) return;
|
|
5075
5762
|
const target = e.target;
|
|
@@ -5082,7 +5769,7 @@ function EmailLayoutEditor(props) {
|
|
|
5082
5769
|
const payload = JSON.stringify({ __emailEditorBlocks: true, rootBlockId: selectedBlockId, blocks });
|
|
5083
5770
|
navigator.clipboard.writeText(payload);
|
|
5084
5771
|
}, [selectedBlockId, document2]);
|
|
5085
|
-
const handlePaste =
|
|
5772
|
+
const handlePaste = React58.useCallback((e) => __async(null, null, function* () {
|
|
5086
5773
|
var _a2;
|
|
5087
5774
|
const target = e.target;
|
|
5088
5775
|
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
@@ -5113,7 +5800,7 @@ function EmailLayoutEditor(props) {
|
|
|
5113
5800
|
resetDocument(doc);
|
|
5114
5801
|
setSelectedBlockId(newRootId);
|
|
5115
5802
|
}), [document2, childrenIds, selectedBlockId, currentBlockId]);
|
|
5116
|
-
|
|
5803
|
+
React58.useEffect(() => {
|
|
5117
5804
|
window.addEventListener("keydown", handleDelete);
|
|
5118
5805
|
window.addEventListener("keydown", handleCopy);
|
|
5119
5806
|
window.addEventListener("paste", handlePaste);
|
|
@@ -5132,7 +5819,7 @@ function EmailLayoutEditor(props) {
|
|
|
5132
5819
|
lineHeight: "1.5",
|
|
5133
5820
|
margin: "0"
|
|
5134
5821
|
};
|
|
5135
|
-
const editorChildren = /* @__PURE__ */
|
|
5822
|
+
const editorChildren = /* @__PURE__ */ React58__default.default.createElement(
|
|
5136
5823
|
EditorChildrenIds,
|
|
5137
5824
|
{
|
|
5138
5825
|
childrenIds,
|
|
@@ -5151,7 +5838,7 @@ function EmailLayoutEditor(props) {
|
|
|
5151
5838
|
}
|
|
5152
5839
|
);
|
|
5153
5840
|
if (props.backdropDisabled) {
|
|
5154
|
-
return /* @__PURE__ */
|
|
5841
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
5155
5842
|
"div",
|
|
5156
5843
|
{
|
|
5157
5844
|
onClick: () => {
|
|
@@ -5164,10 +5851,10 @@ function EmailLayoutEditor(props) {
|
|
|
5164
5851
|
minHeight: "100%"
|
|
5165
5852
|
})
|
|
5166
5853
|
},
|
|
5167
|
-
/* @__PURE__ */
|
|
5854
|
+
/* @__PURE__ */ React58__default.default.createElement("div", { style: { maxWidth: "600px" } }, editorChildren)
|
|
5168
5855
|
);
|
|
5169
5856
|
}
|
|
5170
|
-
return /* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
5171
5858
|
"div",
|
|
5172
5859
|
{
|
|
5173
5860
|
onClick: () => {
|
|
@@ -5180,7 +5867,7 @@ function EmailLayoutEditor(props) {
|
|
|
5180
5867
|
minHeight: "100%"
|
|
5181
5868
|
})
|
|
5182
5869
|
},
|
|
5183
|
-
/* @__PURE__ */
|
|
5870
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
5184
5871
|
"table",
|
|
5185
5872
|
{
|
|
5186
5873
|
align: "center",
|
|
@@ -5204,7 +5891,7 @@ function EmailLayoutEditor(props) {
|
|
|
5204
5891
|
cellPadding: "0",
|
|
5205
5892
|
border: 0
|
|
5206
5893
|
},
|
|
5207
|
-
/* @__PURE__ */
|
|
5894
|
+
/* @__PURE__ */ React58__default.default.createElement("tbody", null, /* @__PURE__ */ React58__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React58__default.default.createElement("td", null, editorChildren)))
|
|
5208
5895
|
)
|
|
5209
5896
|
);
|
|
5210
5897
|
}
|
|
@@ -5363,13 +6050,13 @@ function TuneMenu({ blockId }) {
|
|
|
5363
6050
|
resetDocument(nDocument);
|
|
5364
6051
|
setSelectedBlockId(blockId);
|
|
5365
6052
|
};
|
|
5366
|
-
return /* @__PURE__ */
|
|
6053
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, null, /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Move up", placement: "left-start" }, /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Move down", placement: "left-start" }, /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Copy block", placement: "left-start" }, /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Delete", placement: "left-start" }, /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DeleteOutlined, { fontSize: "small" })))));
|
|
5367
6054
|
}
|
|
5368
6055
|
|
|
5369
6056
|
// src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
|
|
5370
6057
|
function EditorBlockWrapper({ children }) {
|
|
5371
6058
|
const selectedBlockId = useSelectedBlockId();
|
|
5372
|
-
const [mouseInside, setMouseInside] =
|
|
6059
|
+
const [mouseInside, setMouseInside] = React58.useState(false);
|
|
5373
6060
|
const blockId = useCurrentBlockId();
|
|
5374
6061
|
let outline;
|
|
5375
6062
|
if (selectedBlockId === blockId) {
|
|
@@ -5381,9 +6068,9 @@ function EditorBlockWrapper({ children }) {
|
|
|
5381
6068
|
if (selectedBlockId !== blockId) {
|
|
5382
6069
|
return null;
|
|
5383
6070
|
}
|
|
5384
|
-
return /* @__PURE__ */
|
|
6071
|
+
return /* @__PURE__ */ React58__default.default.createElement(TuneMenu, { blockId });
|
|
5385
6072
|
};
|
|
5386
|
-
return /* @__PURE__ */
|
|
6073
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
5387
6074
|
material.Box,
|
|
5388
6075
|
{
|
|
5389
6076
|
sx: {
|
|
@@ -5469,8 +6156,8 @@ function ButtonEditor({ style, props }) {
|
|
|
5469
6156
|
const fullWidth = (_b = props == null ? void 0 : props.fullWidth) != null ? _b : ButtonPropsDefaults.fullWidth;
|
|
5470
6157
|
const buttonTextColor = (_c = props == null ? void 0 : props.buttonTextColor) != null ? _c : ButtonPropsDefaults.buttonTextColor;
|
|
5471
6158
|
const buttonBackgroundColor = (_d = props == null ? void 0 : props.buttonBackgroundColor) != null ? _d : ButtonPropsDefaults.buttonBackgroundColor;
|
|
5472
|
-
const [localText, setLocalText] =
|
|
5473
|
-
|
|
6159
|
+
const [localText, setLocalText] = React58.useState(text);
|
|
6160
|
+
React58.useEffect(() => {
|
|
5474
6161
|
setLocalText(text);
|
|
5475
6162
|
}, [text]);
|
|
5476
6163
|
const padding = getButtonSizePadding2(props);
|
|
@@ -5513,18 +6200,34 @@ function ButtonEditor({ style, props }) {
|
|
|
5513
6200
|
width: fullWidth ? "100%" : void 0,
|
|
5514
6201
|
textAlign: "center"
|
|
5515
6202
|
});
|
|
5516
|
-
|
|
6203
|
+
const trackFocus = (e) => {
|
|
6204
|
+
var _a2, _b2;
|
|
6205
|
+
const el = e.currentTarget;
|
|
6206
|
+
setLastFocusedEditable({
|
|
6207
|
+
blockId,
|
|
6208
|
+
field: "text",
|
|
6209
|
+
selectionStart: (_a2 = el.selectionStart) != null ? _a2 : el.value.length,
|
|
6210
|
+
selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
|
|
6211
|
+
});
|
|
6212
|
+
};
|
|
6213
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React58__default.default.createElement(
|
|
5517
6214
|
"input",
|
|
5518
6215
|
{
|
|
5519
6216
|
type: "text",
|
|
5520
6217
|
value: localText,
|
|
5521
6218
|
onChange: handleTextChange,
|
|
5522
|
-
|
|
5523
|
-
|
|
6219
|
+
onFocus: trackFocus,
|
|
6220
|
+
onSelect: trackFocus,
|
|
6221
|
+
onKeyUp: trackFocus,
|
|
6222
|
+
onClick: (e) => {
|
|
6223
|
+
e.stopPropagation();
|
|
6224
|
+
trackFocus(e);
|
|
6225
|
+
},
|
|
6226
|
+
style: inputStyle
|
|
5524
6227
|
}
|
|
5525
6228
|
));
|
|
5526
6229
|
}
|
|
5527
|
-
return /* @__PURE__ */
|
|
6230
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React58__default.default.createElement("span", { style: linkStyle }, /* @__PURE__ */ React58__default.default.createElement("span", null, text)));
|
|
5528
6231
|
}
|
|
5529
6232
|
function getFontFamily9(fontFamily) {
|
|
5530
6233
|
switch (fontFamily) {
|
|
@@ -5588,17 +6291,17 @@ function getFontSize2(level) {
|
|
|
5588
6291
|
}
|
|
5589
6292
|
}
|
|
5590
6293
|
function HeadingEditor({ style, props }) {
|
|
5591
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6294
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5592
6295
|
const blockId = useCurrentBlockId();
|
|
5593
6296
|
const selectedBlockId = useSelectedBlockId();
|
|
5594
6297
|
const document2 = useDocument();
|
|
5595
6298
|
const isSelected = selectedBlockId === blockId;
|
|
5596
6299
|
const level = (_a = props == null ? void 0 : props.level) != null ? _a : HeadingPropsDefaults.level;
|
|
5597
6300
|
const textContent = (_b = props == null ? void 0 : props.text) != null ? _b : HeadingPropsDefaults.text;
|
|
5598
|
-
const [localText, setLocalText] =
|
|
6301
|
+
const [localText, setLocalText] = React58.useState(textContent);
|
|
5599
6302
|
const rootBlock = document2.root;
|
|
5600
6303
|
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily9(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
5601
|
-
|
|
6304
|
+
React58.useEffect(() => {
|
|
5602
6305
|
setLocalText(textContent);
|
|
5603
6306
|
}, [textContent]);
|
|
5604
6307
|
const fontFamily = getFontFamily9(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
@@ -5606,7 +6309,9 @@ function HeadingEditor({ style, props }) {
|
|
|
5606
6309
|
color: (_c = style == null ? void 0 : style.color) != null ? _c : void 0,
|
|
5607
6310
|
backgroundColor: (_d = style == null ? void 0 : style.backgroundColor) != null ? _d : void 0,
|
|
5608
6311
|
fontWeight: (_e = style == null ? void 0 : style.fontWeight) != null ? _e : "bold",
|
|
5609
|
-
|
|
6312
|
+
lineHeight: (_f = style == null ? void 0 : style.lineHeight) != null ? _f : void 0,
|
|
6313
|
+
letterSpacing: (style == null ? void 0 : style.letterSpacing) != null ? `${style.letterSpacing}px` : void 0,
|
|
6314
|
+
textAlign: (_g = style == null ? void 0 : style.textAlign) != null ? _g : void 0,
|
|
5610
6315
|
margin: 0,
|
|
5611
6316
|
fontFamily,
|
|
5612
6317
|
fontSize: getFontSize2(level),
|
|
@@ -5620,7 +6325,7 @@ function HeadingEditor({ style, props }) {
|
|
|
5620
6325
|
resize: "none",
|
|
5621
6326
|
backgroundColor: "transparent",
|
|
5622
6327
|
overflow: "hidden",
|
|
5623
|
-
lineHeight: "inherit",
|
|
6328
|
+
lineHeight: (_h = hStyle.lineHeight) != null ? _h : "inherit",
|
|
5624
6329
|
margin: 0,
|
|
5625
6330
|
display: "block",
|
|
5626
6331
|
width: "100%"
|
|
@@ -5646,27 +6351,43 @@ function HeadingEditor({ style, props }) {
|
|
|
5646
6351
|
element.style.height = `${element.scrollHeight}px`;
|
|
5647
6352
|
}
|
|
5648
6353
|
};
|
|
6354
|
+
const trackFocus = (e) => {
|
|
6355
|
+
var _a2, _b2;
|
|
6356
|
+
const el = e.currentTarget;
|
|
6357
|
+
setLastFocusedEditable({
|
|
6358
|
+
blockId,
|
|
6359
|
+
field: "text",
|
|
6360
|
+
selectionStart: (_a2 = el.selectionStart) != null ? _a2 : el.value.length,
|
|
6361
|
+
selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
|
|
6362
|
+
});
|
|
6363
|
+
};
|
|
5649
6364
|
if (isSelected) {
|
|
5650
|
-
return /* @__PURE__ */
|
|
6365
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
5651
6366
|
"textarea",
|
|
5652
6367
|
{
|
|
5653
6368
|
value: localText,
|
|
5654
6369
|
onChange: handleTextChange,
|
|
6370
|
+
onFocus: trackFocus,
|
|
6371
|
+
onSelect: trackFocus,
|
|
6372
|
+
onKeyUp: trackFocus,
|
|
6373
|
+
onClick: (e) => {
|
|
6374
|
+
e.stopPropagation();
|
|
6375
|
+
trackFocus(e);
|
|
6376
|
+
},
|
|
5655
6377
|
style: textareaStyle,
|
|
5656
6378
|
rows: 1,
|
|
5657
6379
|
onInput: (e) => adjustTextareaHeight(e.target),
|
|
5658
|
-
ref: (el) => el && adjustTextareaHeight(el)
|
|
5659
|
-
onClick: (e) => e.stopPropagation()
|
|
6380
|
+
ref: (el) => el && adjustTextareaHeight(el)
|
|
5660
6381
|
}
|
|
5661
6382
|
);
|
|
5662
6383
|
}
|
|
5663
6384
|
switch (level) {
|
|
5664
6385
|
case "h1":
|
|
5665
|
-
return /* @__PURE__ */
|
|
6386
|
+
return /* @__PURE__ */ React58__default.default.createElement("h1", { style: hStyle }, textContent);
|
|
5666
6387
|
case "h2":
|
|
5667
|
-
return /* @__PURE__ */
|
|
6388
|
+
return /* @__PURE__ */ React58__default.default.createElement("h2", { style: hStyle }, textContent);
|
|
5668
6389
|
case "h3":
|
|
5669
|
-
return /* @__PURE__ */
|
|
6390
|
+
return /* @__PURE__ */ React58__default.default.createElement("h3", { style: hStyle }, textContent);
|
|
5670
6391
|
}
|
|
5671
6392
|
}
|
|
5672
6393
|
function HtmlEditor({ style, props }) {
|
|
@@ -5675,8 +6396,8 @@ function HtmlEditor({ style, props }) {
|
|
|
5675
6396
|
const selectedBlockId = useSelectedBlockId();
|
|
5676
6397
|
const isSelected = selectedBlockId === blockId;
|
|
5677
6398
|
const contents = (_a = props == null ? void 0 : props.contents) != null ? _a : "";
|
|
5678
|
-
const [localContents, setLocalContents] =
|
|
5679
|
-
|
|
6399
|
+
const [localContents, setLocalContents] = React58.useState(contents);
|
|
6400
|
+
React58.useEffect(() => {
|
|
5680
6401
|
setLocalContents(contents);
|
|
5681
6402
|
}, [contents]);
|
|
5682
6403
|
const cssStyle = {
|
|
@@ -5721,23 +6442,39 @@ function HtmlEditor({ style, props }) {
|
|
|
5721
6442
|
margin: 0,
|
|
5722
6443
|
backgroundColor: "transparent"
|
|
5723
6444
|
});
|
|
5724
|
-
|
|
6445
|
+
const trackFocus = (e) => {
|
|
6446
|
+
var _a2, _b2;
|
|
6447
|
+
const el = e.currentTarget;
|
|
6448
|
+
setLastFocusedEditable({
|
|
6449
|
+
blockId,
|
|
6450
|
+
field: "contents",
|
|
6451
|
+
selectionStart: (_a2 = el.selectionStart) != null ? _a2 : el.value.length,
|
|
6452
|
+
selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
|
|
6453
|
+
});
|
|
6454
|
+
};
|
|
6455
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: cssStyle }, /* @__PURE__ */ React58__default.default.createElement(
|
|
5725
6456
|
"textarea",
|
|
5726
6457
|
{
|
|
5727
6458
|
value: localContents,
|
|
5728
6459
|
onChange: handleChange,
|
|
6460
|
+
onFocus: trackFocus,
|
|
6461
|
+
onSelect: trackFocus,
|
|
6462
|
+
onKeyUp: trackFocus,
|
|
6463
|
+
onClick: (e) => {
|
|
6464
|
+
e.stopPropagation();
|
|
6465
|
+
trackFocus(e);
|
|
6466
|
+
},
|
|
5729
6467
|
style: textareaStyle,
|
|
5730
6468
|
rows: 3,
|
|
5731
6469
|
onInput: (e) => adjustTextareaHeight(e.target),
|
|
5732
|
-
ref: (el) => el && adjustTextareaHeight(el)
|
|
5733
|
-
onClick: (e) => e.stopPropagation()
|
|
6470
|
+
ref: (el) => el && adjustTextareaHeight(el)
|
|
5734
6471
|
}
|
|
5735
6472
|
));
|
|
5736
6473
|
}
|
|
5737
6474
|
if (!contents) {
|
|
5738
|
-
return /* @__PURE__ */
|
|
6475
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: cssStyle });
|
|
5739
6476
|
}
|
|
5740
|
-
return /* @__PURE__ */
|
|
6477
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
|
|
5741
6478
|
}
|
|
5742
6479
|
function getImageBorderRadius2(shape, size) {
|
|
5743
6480
|
switch (shape) {
|
|
@@ -5770,36 +6507,36 @@ function SignatureEditor({ style, props }) {
|
|
|
5770
6507
|
const nameColor = (_m = props == null ? void 0 : props.nameColor) != null ? _m : SignaturePropsDefaults.nameColor;
|
|
5771
6508
|
const textColor = (_n = props == null ? void 0 : props.textColor) != null ? _n : SignaturePropsDefaults.textColor;
|
|
5772
6509
|
const linkColor = (_o = props == null ? void 0 : props.linkColor) != null ? _o : SignaturePropsDefaults.linkColor;
|
|
5773
|
-
const [localGreeting, setLocalGreeting] =
|
|
5774
|
-
const [localName, setLocalName] =
|
|
5775
|
-
const [localTitle, setLocalTitle] =
|
|
5776
|
-
const [localCompany, setLocalCompany] =
|
|
5777
|
-
const [localAddress, setLocalAddress] =
|
|
5778
|
-
const [localEmail, setLocalEmail] =
|
|
5779
|
-
const [localPhone, setLocalPhone] =
|
|
5780
|
-
const [localWebsite, setLocalWebsite] =
|
|
5781
|
-
|
|
6510
|
+
const [localGreeting, setLocalGreeting] = React58.useState(greeting);
|
|
6511
|
+
const [localName, setLocalName] = React58.useState(name);
|
|
6512
|
+
const [localTitle, setLocalTitle] = React58.useState(title);
|
|
6513
|
+
const [localCompany, setLocalCompany] = React58.useState(company);
|
|
6514
|
+
const [localAddress, setLocalAddress] = React58.useState(address);
|
|
6515
|
+
const [localEmail, setLocalEmail] = React58.useState(email);
|
|
6516
|
+
const [localPhone, setLocalPhone] = React58.useState(phone);
|
|
6517
|
+
const [localWebsite, setLocalWebsite] = React58.useState(website);
|
|
6518
|
+
React58.useEffect(() => {
|
|
5782
6519
|
setLocalGreeting(greeting);
|
|
5783
6520
|
}, [greeting]);
|
|
5784
|
-
|
|
6521
|
+
React58.useEffect(() => {
|
|
5785
6522
|
setLocalName(name);
|
|
5786
6523
|
}, [name]);
|
|
5787
|
-
|
|
6524
|
+
React58.useEffect(() => {
|
|
5788
6525
|
setLocalTitle(title);
|
|
5789
6526
|
}, [title]);
|
|
5790
|
-
|
|
6527
|
+
React58.useEffect(() => {
|
|
5791
6528
|
setLocalCompany(company);
|
|
5792
6529
|
}, [company]);
|
|
5793
|
-
|
|
6530
|
+
React58.useEffect(() => {
|
|
5794
6531
|
setLocalAddress(address);
|
|
5795
6532
|
}, [address]);
|
|
5796
|
-
|
|
6533
|
+
React58.useEffect(() => {
|
|
5797
6534
|
setLocalEmail(email);
|
|
5798
6535
|
}, [email]);
|
|
5799
|
-
|
|
6536
|
+
React58.useEffect(() => {
|
|
5800
6537
|
setLocalPhone(phone);
|
|
5801
6538
|
}, [phone]);
|
|
5802
|
-
|
|
6539
|
+
React58.useEffect(() => {
|
|
5803
6540
|
setLocalWebsite(website);
|
|
5804
6541
|
}, [website]);
|
|
5805
6542
|
const updateProps = (updates) => {
|
|
@@ -5852,7 +6589,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5852
6589
|
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
5853
6590
|
padding: (style == null ? void 0 : style.padding) ? `${style.padding.top}px ${style.padding.right}px ${style.padding.bottom}px ${style.padding.left}px` : void 0
|
|
5854
6591
|
};
|
|
5855
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
6592
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React58__default.default.createElement(
|
|
5856
6593
|
"img",
|
|
5857
6594
|
{
|
|
5858
6595
|
src: imageUrl,
|
|
@@ -5870,7 +6607,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5870
6607
|
}
|
|
5871
6608
|
}
|
|
5872
6609
|
) : null;
|
|
5873
|
-
const greetingElement = isSelected ? /* @__PURE__ */
|
|
6610
|
+
const greetingElement = isSelected ? /* @__PURE__ */ React58__default.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React58__default.default.createElement(
|
|
5874
6611
|
"input",
|
|
5875
6612
|
{
|
|
5876
6613
|
value: localGreeting,
|
|
@@ -5881,8 +6618,8 @@ function SignatureEditor({ style, props }) {
|
|
|
5881
6618
|
placeholder: "Greeting (e.g. Best regards,)",
|
|
5882
6619
|
style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
|
|
5883
6620
|
}
|
|
5884
|
-
)) : greeting ? /* @__PURE__ */
|
|
5885
|
-
const textContent = isSelected ? /* @__PURE__ */
|
|
6621
|
+
)) : greeting ? /* @__PURE__ */ React58__default.default.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
6622
|
+
const textContent = isSelected ? /* @__PURE__ */ React58__default.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React58__default.default.createElement(
|
|
5886
6623
|
"input",
|
|
5887
6624
|
{
|
|
5888
6625
|
value: localName,
|
|
@@ -5893,7 +6630,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5893
6630
|
placeholder: "Name",
|
|
5894
6631
|
style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
|
|
5895
6632
|
}
|
|
5896
|
-
), /* @__PURE__ */
|
|
6633
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
5897
6634
|
"input",
|
|
5898
6635
|
{
|
|
5899
6636
|
value: localTitle,
|
|
@@ -5904,7 +6641,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5904
6641
|
placeholder: "Title",
|
|
5905
6642
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5906
6643
|
}
|
|
5907
|
-
), /* @__PURE__ */
|
|
6644
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
5908
6645
|
"input",
|
|
5909
6646
|
{
|
|
5910
6647
|
value: localCompany,
|
|
@@ -5915,7 +6652,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5915
6652
|
placeholder: "Company",
|
|
5916
6653
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5917
6654
|
}
|
|
5918
|
-
), /* @__PURE__ */
|
|
6655
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
5919
6656
|
"input",
|
|
5920
6657
|
{
|
|
5921
6658
|
value: localAddress,
|
|
@@ -5926,7 +6663,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5926
6663
|
placeholder: "Address",
|
|
5927
6664
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5928
6665
|
}
|
|
5929
|
-
), /* @__PURE__ */
|
|
6666
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
5930
6667
|
"input",
|
|
5931
6668
|
{
|
|
5932
6669
|
value: localEmail,
|
|
@@ -5937,7 +6674,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5937
6674
|
placeholder: "Email",
|
|
5938
6675
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
|
|
5939
6676
|
}
|
|
5940
|
-
), /* @__PURE__ */
|
|
6677
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
5941
6678
|
"input",
|
|
5942
6679
|
{
|
|
5943
6680
|
value: localPhone,
|
|
@@ -5948,7 +6685,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5948
6685
|
placeholder: "Phone",
|
|
5949
6686
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5950
6687
|
}
|
|
5951
|
-
), /* @__PURE__ */
|
|
6688
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
5952
6689
|
"input",
|
|
5953
6690
|
{
|
|
5954
6691
|
value: localWebsite,
|
|
@@ -5959,11 +6696,11 @@ function SignatureEditor({ style, props }) {
|
|
|
5959
6696
|
placeholder: "Website",
|
|
5960
6697
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5961
6698
|
}
|
|
5962
|
-
)) : /* @__PURE__ */
|
|
6699
|
+
)) : /* @__PURE__ */ React58__default.default.createElement("div", null, name && /* @__PURE__ */ React58__default.default.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React58__default.default.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React58__default.default.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React58__default.default.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React58__default.default.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React58__default.default.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React58__default.default.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React58__default.default.createElement("p", { style: detailStyle }, "Click to edit signature"));
|
|
5963
6700
|
if (layout === "vertical") {
|
|
5964
|
-
return /* @__PURE__ */
|
|
6701
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React58__default.default.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
5965
6702
|
}
|
|
5966
|
-
return /* @__PURE__ */
|
|
6703
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React58__default.default.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React58__default.default.createElement("tbody", null, /* @__PURE__ */ React58__default.default.createElement("tr", null, imageElement && /* @__PURE__ */ React58__default.default.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React58__default.default.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
5967
6704
|
}
|
|
5968
6705
|
function getFontFamily10(fontFamily) {
|
|
5969
6706
|
switch (fontFamily) {
|
|
@@ -6017,17 +6754,17 @@ function getPadding13(padding) {
|
|
|
6017
6754
|
return void 0;
|
|
6018
6755
|
}
|
|
6019
6756
|
function TextEditor({ style, props }) {
|
|
6020
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6757
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
6021
6758
|
const blockId = useCurrentBlockId();
|
|
6022
6759
|
const selectedBlockId = useSelectedBlockId();
|
|
6023
6760
|
const document2 = useDocument();
|
|
6024
6761
|
const isSelected = selectedBlockId === blockId;
|
|
6025
6762
|
const textContent = (_a = props == null ? void 0 : props.text) != null ? _a : TextPropsDefaults.text;
|
|
6026
|
-
const [localText, setLocalText] =
|
|
6763
|
+
const [localText, setLocalText] = React58.useState(textContent);
|
|
6027
6764
|
const isMarkdown = (_b = props == null ? void 0 : props.markdown) != null ? _b : false;
|
|
6028
6765
|
const rootBlock = document2.root;
|
|
6029
6766
|
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily10(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
6030
|
-
|
|
6767
|
+
React58.useEffect(() => {
|
|
6031
6768
|
setLocalText(textContent);
|
|
6032
6769
|
}, [textContent]);
|
|
6033
6770
|
const fontFamily = getFontFamily10(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
@@ -6037,7 +6774,9 @@ function TextEditor({ style, props }) {
|
|
|
6037
6774
|
fontSize: (_e = style == null ? void 0 : style.fontSize) != null ? _e : void 0,
|
|
6038
6775
|
fontFamily,
|
|
6039
6776
|
fontWeight: (_f = style == null ? void 0 : style.fontWeight) != null ? _f : void 0,
|
|
6040
|
-
|
|
6777
|
+
lineHeight: (_g = style == null ? void 0 : style.lineHeight) != null ? _g : void 0,
|
|
6778
|
+
letterSpacing: (style == null ? void 0 : style.letterSpacing) != null ? `${style.letterSpacing}px` : void 0,
|
|
6779
|
+
textAlign: (_h = style == null ? void 0 : style.textAlign) != null ? _h : void 0,
|
|
6041
6780
|
padding: getPadding13(style == null ? void 0 : style.padding),
|
|
6042
6781
|
width: "100%",
|
|
6043
6782
|
minHeight: "1em"
|
|
@@ -6048,7 +6787,7 @@ function TextEditor({ style, props }) {
|
|
|
6048
6787
|
resize: "none",
|
|
6049
6788
|
backgroundColor: "transparent",
|
|
6050
6789
|
overflow: "hidden",
|
|
6051
|
-
lineHeight: "inherit",
|
|
6790
|
+
lineHeight: (_i = wStyle.lineHeight) != null ? _i : "inherit",
|
|
6052
6791
|
margin: 0,
|
|
6053
6792
|
display: "block",
|
|
6054
6793
|
width: "100%",
|
|
@@ -6077,51 +6816,67 @@ function TextEditor({ style, props }) {
|
|
|
6077
6816
|
element.style.height = `${element.scrollHeight}px`;
|
|
6078
6817
|
}
|
|
6079
6818
|
};
|
|
6819
|
+
const trackFocus = (e) => {
|
|
6820
|
+
var _a2, _b2;
|
|
6821
|
+
const el = e.currentTarget;
|
|
6822
|
+
setLastFocusedEditable({
|
|
6823
|
+
blockId,
|
|
6824
|
+
field: "text",
|
|
6825
|
+
selectionStart: (_a2 = el.selectionStart) != null ? _a2 : el.value.length,
|
|
6826
|
+
selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
|
|
6827
|
+
});
|
|
6828
|
+
};
|
|
6080
6829
|
if (isSelected) {
|
|
6081
|
-
return /* @__PURE__ */
|
|
6830
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
6082
6831
|
"textarea",
|
|
6083
6832
|
{
|
|
6084
6833
|
value: localText,
|
|
6085
6834
|
onChange: handleTextChange,
|
|
6835
|
+
onFocus: trackFocus,
|
|
6836
|
+
onSelect: trackFocus,
|
|
6837
|
+
onKeyUp: trackFocus,
|
|
6838
|
+
onClick: (e) => {
|
|
6839
|
+
e.stopPropagation();
|
|
6840
|
+
trackFocus(e);
|
|
6841
|
+
},
|
|
6086
6842
|
style: textareaStyle,
|
|
6087
6843
|
rows: 1,
|
|
6088
6844
|
onInput: (e) => adjustTextareaHeight(e.target),
|
|
6089
|
-
ref: (el) => el && adjustTextareaHeight(el)
|
|
6090
|
-
onClick: (e) => e.stopPropagation()
|
|
6845
|
+
ref: (el) => el && adjustTextareaHeight(el)
|
|
6091
6846
|
}
|
|
6092
6847
|
);
|
|
6093
6848
|
}
|
|
6094
6849
|
if (isMarkdown) {
|
|
6095
|
-
return /* @__PURE__ */
|
|
6850
|
+
return /* @__PURE__ */ React58__default.default.createElement(EmailMarkdown, { style: wStyle, markdown: textContent });
|
|
6096
6851
|
}
|
|
6097
|
-
return /* @__PURE__ */
|
|
6852
|
+
return /* @__PURE__ */ React58__default.default.createElement("div", { style: wStyle }, textContent);
|
|
6098
6853
|
}
|
|
6099
6854
|
|
|
6100
6855
|
// src/editor/core.tsx
|
|
6101
6856
|
var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
6102
6857
|
Avatar: {
|
|
6103
6858
|
schema: AvatarPropsSchema,
|
|
6104
|
-
Component: (props) => /* @__PURE__ */
|
|
6859
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(avatar_default, __spreadValues({}, props)))
|
|
6105
6860
|
},
|
|
6106
6861
|
Button: {
|
|
6107
6862
|
schema: ButtonPropsSchema,
|
|
6108
|
-
Component: (props) => /* @__PURE__ */
|
|
6863
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(ButtonEditor, __spreadValues({}, props)))
|
|
6109
6864
|
},
|
|
6110
6865
|
Container: {
|
|
6111
6866
|
schema: container_props_schema_default,
|
|
6112
|
-
Component: (props) => /* @__PURE__ */
|
|
6867
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(ContainerEditor, __spreadValues({}, props)))
|
|
6113
6868
|
},
|
|
6114
6869
|
ColumnsContainer: {
|
|
6115
6870
|
schema: columns_container_props_schema_default2,
|
|
6116
|
-
Component: (props) => /* @__PURE__ */
|
|
6871
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
|
|
6117
6872
|
},
|
|
6118
6873
|
Heading: {
|
|
6119
6874
|
schema: HeadingPropsSchema,
|
|
6120
|
-
Component: (props) => /* @__PURE__ */
|
|
6875
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(HeadingEditor, __spreadValues({}, props)))
|
|
6121
6876
|
},
|
|
6122
6877
|
Html: {
|
|
6123
6878
|
schema: HtmlPropsSchema,
|
|
6124
|
-
Component: (props) => /* @__PURE__ */
|
|
6879
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(HtmlEditor, __spreadValues({}, props)))
|
|
6125
6880
|
},
|
|
6126
6881
|
Image: {
|
|
6127
6882
|
schema: ImagePropsSchema,
|
|
@@ -6133,28 +6888,28 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
6133
6888
|
linkHref: null
|
|
6134
6889
|
})
|
|
6135
6890
|
});
|
|
6136
|
-
return /* @__PURE__ */
|
|
6891
|
+
return /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(image_default, __spreadValues({}, props)));
|
|
6137
6892
|
}
|
|
6138
6893
|
},
|
|
6139
6894
|
Text: {
|
|
6140
6895
|
schema: TextPropsSchema,
|
|
6141
|
-
Component: (props) => /* @__PURE__ */
|
|
6896
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(TextEditor, __spreadValues({}, props)))
|
|
6142
6897
|
},
|
|
6143
6898
|
EmailLayout: {
|
|
6144
6899
|
schema: email_layout_props_schema_default,
|
|
6145
|
-
Component: (p) => /* @__PURE__ */
|
|
6900
|
+
Component: (p) => /* @__PURE__ */ React58__default.default.createElement(EmailLayoutEditor, __spreadValues({}, p))
|
|
6146
6901
|
},
|
|
6147
6902
|
Spacer: {
|
|
6148
6903
|
schema: SpacerPropsSchema,
|
|
6149
|
-
Component: (props) => /* @__PURE__ */
|
|
6904
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(spacer_default, __spreadValues({}, props)))
|
|
6150
6905
|
},
|
|
6151
6906
|
Divider: {
|
|
6152
6907
|
schema: DividerPropsSchema,
|
|
6153
|
-
Component: (props) => /* @__PURE__ */
|
|
6908
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(divider_default, __spreadValues({}, props)))
|
|
6154
6909
|
},
|
|
6155
6910
|
Signature: {
|
|
6156
6911
|
schema: SignaturePropsSchema,
|
|
6157
|
-
Component: (props) => /* @__PURE__ */
|
|
6912
|
+
Component: (props) => /* @__PURE__ */ React58__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58__default.default.createElement(SignatureEditor, __spreadValues({}, props)))
|
|
6158
6913
|
}
|
|
6159
6914
|
});
|
|
6160
6915
|
var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
|
|
@@ -6162,15 +6917,15 @@ var EditorBlockSchema = buildBlockConfigurationSchema(EDITOR_DICTIONARY);
|
|
|
6162
6917
|
zod.z.record(zod.z.string(), EditorBlockSchema);
|
|
6163
6918
|
|
|
6164
6919
|
// src/editor/editor-block.tsx
|
|
6165
|
-
var EditorBlockContext =
|
|
6166
|
-
var useCurrentBlockId = () =>
|
|
6920
|
+
var EditorBlockContext = React58.createContext(null);
|
|
6921
|
+
var useCurrentBlockId = () => React58.useContext(EditorBlockContext);
|
|
6167
6922
|
function EditorBlock({ id }) {
|
|
6168
6923
|
const document2 = useDocument();
|
|
6169
6924
|
const block = document2[id];
|
|
6170
6925
|
if (!block) {
|
|
6171
6926
|
throw new Error("Could not find block");
|
|
6172
6927
|
}
|
|
6173
|
-
return /* @__PURE__ */
|
|
6928
|
+
return /* @__PURE__ */ React58__default.default.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React58__default.default.createElement(EditorBlock2, __spreadValues({}, block)));
|
|
6174
6929
|
}
|
|
6175
6930
|
function ToggleInspectorPanelButton() {
|
|
6176
6931
|
const inspectorDrawerOpen = useInspectorDrawerOpen();
|
|
@@ -6178,20 +6933,20 @@ function ToggleInspectorPanelButton() {
|
|
|
6178
6933
|
toggleInspectorDrawerOpen();
|
|
6179
6934
|
};
|
|
6180
6935
|
if (inspectorDrawerOpen) {
|
|
6181
|
-
return /* @__PURE__ */
|
|
6936
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: handleClick }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.LastPageOutlined, { fontSize: "small" }));
|
|
6182
6937
|
}
|
|
6183
|
-
return /* @__PURE__ */
|
|
6938
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: handleClick }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.AppRegistrationOutlined, { fontSize: "small" }));
|
|
6184
6939
|
}
|
|
6185
6940
|
function useIcon() {
|
|
6186
6941
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
6187
6942
|
if (samplesDrawerOpen) {
|
|
6188
|
-
return /* @__PURE__ */
|
|
6943
|
+
return /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.FirstPageOutlined, { fontSize: "small" });
|
|
6189
6944
|
}
|
|
6190
|
-
return /* @__PURE__ */
|
|
6945
|
+
return /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.MenuOutlined, { fontSize: "small" });
|
|
6191
6946
|
}
|
|
6192
6947
|
function ToggleSamplesPanelButton() {
|
|
6193
6948
|
const icon = useIcon();
|
|
6194
|
-
return /* @__PURE__ */
|
|
6949
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
|
|
6195
6950
|
}
|
|
6196
6951
|
function formatHtml(html2, spaces = 2) {
|
|
6197
6952
|
try {
|
|
@@ -6239,8 +6994,8 @@ function json(value) {
|
|
|
6239
6994
|
|
|
6240
6995
|
// src/app/email-canvas/helper/highlighted-code-panel.tsx
|
|
6241
6996
|
function HighlightedCodePanel({ type, value }) {
|
|
6242
|
-
const [code, setCode] =
|
|
6243
|
-
|
|
6997
|
+
const [code, setCode] = React58.useState(null);
|
|
6998
|
+
React58.useEffect(() => {
|
|
6244
6999
|
switch (type) {
|
|
6245
7000
|
case "html":
|
|
6246
7001
|
html(value).then(setCode);
|
|
@@ -6253,7 +7008,7 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
6253
7008
|
if (code === null) {
|
|
6254
7009
|
return null;
|
|
6255
7010
|
}
|
|
6256
|
-
return /* @__PURE__ */
|
|
7011
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
6257
7012
|
"pre",
|
|
6258
7013
|
{
|
|
6259
7014
|
style: {
|
|
@@ -6278,18 +7033,18 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
6278
7033
|
// src/app/email-canvas/html-panel.tsx
|
|
6279
7034
|
function HtmlPanel() {
|
|
6280
7035
|
const document2 = useDocument();
|
|
6281
|
-
const code =
|
|
6282
|
-
return /* @__PURE__ */
|
|
7036
|
+
const code = React58.useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
|
|
7037
|
+
return /* @__PURE__ */ React58__default.default.createElement(HighlightedCodePanel, { type: "html", value: code });
|
|
6283
7038
|
}
|
|
6284
7039
|
function JsonPanel() {
|
|
6285
7040
|
const document2 = useDocument();
|
|
6286
|
-
const code =
|
|
6287
|
-
return /* @__PURE__ */
|
|
7041
|
+
const code = React58.useMemo(() => JSON.stringify(document2, null, " "), [document2]);
|
|
7042
|
+
return /* @__PURE__ */ React58__default.default.createElement(HighlightedCodePanel, { type: "json", value: code });
|
|
6288
7043
|
}
|
|
6289
7044
|
function TextPanel() {
|
|
6290
7045
|
const document2 = useDocument();
|
|
6291
|
-
const text =
|
|
6292
|
-
return /* @__PURE__ */
|
|
7046
|
+
const text = React58.useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
|
|
7047
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
6293
7048
|
"pre",
|
|
6294
7049
|
{
|
|
6295
7050
|
style: {
|
|
@@ -6325,42 +7080,42 @@ function MainTabsGroup() {
|
|
|
6325
7080
|
setSelectedMainTab("editor");
|
|
6326
7081
|
}
|
|
6327
7082
|
};
|
|
6328
|
-
return /* @__PURE__ */
|
|
7083
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React58__default.default.createElement(
|
|
6329
7084
|
material.Tab,
|
|
6330
7085
|
{
|
|
6331
7086
|
value: "editor",
|
|
6332
|
-
label: /* @__PURE__ */
|
|
7087
|
+
label: /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Edit" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.EditOutlined, { fontSize: "small" }))
|
|
6333
7088
|
}
|
|
6334
|
-
), /* @__PURE__ */
|
|
7089
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6335
7090
|
material.Tab,
|
|
6336
7091
|
{
|
|
6337
7092
|
value: "preview",
|
|
6338
|
-
label: /* @__PURE__ */
|
|
7093
|
+
label: /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Preview" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.PreviewOutlined, { fontSize: "small" }))
|
|
6339
7094
|
}
|
|
6340
|
-
), /* @__PURE__ */
|
|
7095
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6341
7096
|
material.Tab,
|
|
6342
7097
|
{
|
|
6343
7098
|
value: "html",
|
|
6344
|
-
label: /* @__PURE__ */
|
|
7099
|
+
label: /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "HTML output" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.CodeOutlined, { fontSize: "small" }))
|
|
6345
7100
|
}
|
|
6346
|
-
), /* @__PURE__ */
|
|
7101
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6347
7102
|
material.Tab,
|
|
6348
7103
|
{
|
|
6349
7104
|
value: "text",
|
|
6350
|
-
label: /* @__PURE__ */
|
|
7105
|
+
label: /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SubjectOutlined, { fontSize: "small" }))
|
|
6351
7106
|
}
|
|
6352
|
-
), /* @__PURE__ */
|
|
7107
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6353
7108
|
material.Tab,
|
|
6354
7109
|
{
|
|
6355
7110
|
value: "json",
|
|
6356
|
-
label: /* @__PURE__ */
|
|
7111
|
+
label: /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "JSON output" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.DataObjectOutlined, { fontSize: "small" }))
|
|
6357
7112
|
}
|
|
6358
7113
|
));
|
|
6359
7114
|
}
|
|
6360
7115
|
function SaveButton({ loadTemplates, saveAs }) {
|
|
6361
7116
|
const { saveTemplate, currentTemplateId, currentTemplateKind, setCurrentTemplate } = useEmailEditor();
|
|
6362
7117
|
const { showMessage } = useSnackbar();
|
|
6363
|
-
const [saveDialogOpen, setSaveDialogOpen] =
|
|
7118
|
+
const [saveDialogOpen, setSaveDialogOpen] = React58.useState(false);
|
|
6364
7119
|
const document2 = useDocument();
|
|
6365
7120
|
const isSample = currentTemplateKind === "sample";
|
|
6366
7121
|
const handleSave = () => __async(null, null, function* () {
|
|
@@ -6399,7 +7154,7 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
6399
7154
|
return false;
|
|
6400
7155
|
}
|
|
6401
7156
|
});
|
|
6402
|
-
return /* @__PURE__ */
|
|
7157
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
6403
7158
|
material.IconButton,
|
|
6404
7159
|
{
|
|
6405
7160
|
onClick: handleSave,
|
|
@@ -6410,8 +7165,8 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
6410
7165
|
}
|
|
6411
7166
|
}
|
|
6412
7167
|
},
|
|
6413
|
-
/* @__PURE__ */
|
|
6414
|
-
), /* @__PURE__ */
|
|
7168
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: isSample ? "Save as new template" : "Save template" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.SaveOutlined, { fontSize: "small" }))
|
|
7169
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6415
7170
|
SaveTemplateDialog,
|
|
6416
7171
|
{
|
|
6417
7172
|
open: saveDialogOpen,
|
|
@@ -6424,9 +7179,9 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
6424
7179
|
function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
6425
7180
|
const { setCurrentTemplate, loadTemplate } = useEmailEditor();
|
|
6426
7181
|
const { showMessage } = useSnackbar();
|
|
6427
|
-
const [saveDialogOpen, setSaveDialogOpen] =
|
|
6428
|
-
const [templates, setTemplates] =
|
|
6429
|
-
const [nameError, setNameError] =
|
|
7182
|
+
const [saveDialogOpen, setSaveDialogOpen] = React58.useState(false);
|
|
7183
|
+
const [templates, setTemplates] = React58.useState([]);
|
|
7184
|
+
const [nameError, setNameError] = React58.useState(null);
|
|
6430
7185
|
const fetchTemplates = () => __async(null, null, function* () {
|
|
6431
7186
|
if (loadTemplates) {
|
|
6432
7187
|
try {
|
|
@@ -6481,7 +7236,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
6481
7236
|
}
|
|
6482
7237
|
return false;
|
|
6483
7238
|
});
|
|
6484
|
-
return /* @__PURE__ */
|
|
7239
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
6485
7240
|
material.IconButton,
|
|
6486
7241
|
{
|
|
6487
7242
|
onClick: handleNewTemplate,
|
|
@@ -6492,8 +7247,8 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
6492
7247
|
}
|
|
6493
7248
|
}
|
|
6494
7249
|
},
|
|
6495
|
-
/* @__PURE__ */
|
|
6496
|
-
), /* @__PURE__ */
|
|
7250
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "New template" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.Add, { fontSize: "small" }))
|
|
7251
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6497
7252
|
SaveTemplateDialog,
|
|
6498
7253
|
{
|
|
6499
7254
|
open: saveDialogOpen,
|
|
@@ -6520,7 +7275,18 @@ function SubjectInput() {
|
|
|
6520
7275
|
root: __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, data), { subject: value }) })
|
|
6521
7276
|
});
|
|
6522
7277
|
};
|
|
6523
|
-
|
|
7278
|
+
const trackFocus = (e) => {
|
|
7279
|
+
var _a2, _b;
|
|
7280
|
+
const target = e.target;
|
|
7281
|
+
if (!target || typeof target.value !== "string") return;
|
|
7282
|
+
setLastFocusedEditable({
|
|
7283
|
+
blockId: "subject",
|
|
7284
|
+
field: "subject",
|
|
7285
|
+
selectionStart: (_a2 = target.selectionStart) != null ? _a2 : target.value.length,
|
|
7286
|
+
selectionEnd: (_b = target.selectionEnd) != null ? _b : target.value.length
|
|
7287
|
+
});
|
|
7288
|
+
};
|
|
7289
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
6524
7290
|
material.Box,
|
|
6525
7291
|
{
|
|
6526
7292
|
sx: {
|
|
@@ -6537,19 +7303,191 @@ function SubjectInput() {
|
|
|
6537
7303
|
gap: 1.5
|
|
6538
7304
|
}
|
|
6539
7305
|
},
|
|
6540
|
-
/* @__PURE__ */
|
|
6541
|
-
/* @__PURE__ */
|
|
7306
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
|
|
7307
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
6542
7308
|
material.InputBase,
|
|
6543
7309
|
{
|
|
6544
7310
|
fullWidth: true,
|
|
6545
7311
|
placeholder: "Email subject \u2014 supports {{variables}}",
|
|
6546
7312
|
value: subject,
|
|
6547
7313
|
onChange: (e) => handleChange(e.target.value),
|
|
7314
|
+
onFocus: trackFocus,
|
|
7315
|
+
onSelect: trackFocus,
|
|
7316
|
+
onKeyUp: trackFocus,
|
|
7317
|
+
onClick: trackFocus,
|
|
6548
7318
|
sx: { fontSize: 14 }
|
|
6549
7319
|
}
|
|
6550
7320
|
)
|
|
6551
7321
|
);
|
|
6552
7322
|
}
|
|
7323
|
+
function SubjectPreview() {
|
|
7324
|
+
var _a, _b;
|
|
7325
|
+
const document2 = useDocument();
|
|
7326
|
+
const root = document2.root;
|
|
7327
|
+
if (!root || root.type !== "EmailLayout") return null;
|
|
7328
|
+
const data = root.data;
|
|
7329
|
+
const subject = (_a = data.subject) != null ? _a : "";
|
|
7330
|
+
if (!subject) return null;
|
|
7331
|
+
const samples = buildSampleValueMap((_b = data.variables) != null ? _b : []);
|
|
7332
|
+
const rendered = substituteSampleValues(subject, samples);
|
|
7333
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
7334
|
+
material.Box,
|
|
7335
|
+
{
|
|
7336
|
+
sx: {
|
|
7337
|
+
px: 3,
|
|
7338
|
+
py: 1.25,
|
|
7339
|
+
borderBottom: 1,
|
|
7340
|
+
borderColor: "divider",
|
|
7341
|
+
backgroundColor: "white",
|
|
7342
|
+
position: "sticky",
|
|
7343
|
+
top: 49,
|
|
7344
|
+
zIndex: "appBar",
|
|
7345
|
+
display: "flex",
|
|
7346
|
+
alignItems: "center",
|
|
7347
|
+
gap: 1.5
|
|
7348
|
+
}
|
|
7349
|
+
},
|
|
7350
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
|
|
7351
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { fontSize: 14 } }, rendered)
|
|
7352
|
+
);
|
|
7353
|
+
}
|
|
7354
|
+
function generateId3() {
|
|
7355
|
+
return `block-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
7356
|
+
}
|
|
7357
|
+
function buildImageBlock(uploaded) {
|
|
7358
|
+
var _a, _b, _c;
|
|
7359
|
+
return {
|
|
7360
|
+
type: "Image",
|
|
7361
|
+
data: {
|
|
7362
|
+
props: {
|
|
7363
|
+
url: uploaded.url,
|
|
7364
|
+
width: (_a = uploaded.width) != null ? _a : null,
|
|
7365
|
+
height: (_b = uploaded.height) != null ? _b : null,
|
|
7366
|
+
alt: (_c = uploaded.alt) != null ? _c : "",
|
|
7367
|
+
contentAlignment: "middle"
|
|
7368
|
+
},
|
|
7369
|
+
style: { padding: { top: 16, bottom: 16, left: 24, right: 24 } }
|
|
7370
|
+
}
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
function appendImageBlock(uploaded) {
|
|
7374
|
+
var _a;
|
|
7375
|
+
const doc = getDocument();
|
|
7376
|
+
const root = doc.root;
|
|
7377
|
+
if (!root || root.type !== "EmailLayout") return;
|
|
7378
|
+
const id = generateId3();
|
|
7379
|
+
const childrenIds = [...(_a = root.data.childrenIds) != null ? _a : [], id];
|
|
7380
|
+
setDocument({
|
|
7381
|
+
[id]: buildImageBlock(uploaded),
|
|
7382
|
+
root: __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, root.data), { childrenIds }) })
|
|
7383
|
+
});
|
|
7384
|
+
setSelectedBlockId(id);
|
|
7385
|
+
}
|
|
7386
|
+
function findImageFile(items) {
|
|
7387
|
+
var _a;
|
|
7388
|
+
if (!items) return null;
|
|
7389
|
+
const fileList = items instanceof FileList ? Array.from(items) : Array.from(items);
|
|
7390
|
+
for (const item of fileList) {
|
|
7391
|
+
const file = item instanceof File ? item : (_a = item.getAsFile) == null ? void 0 : _a.call(item);
|
|
7392
|
+
if (file && file.type.startsWith("image/")) return file;
|
|
7393
|
+
}
|
|
7394
|
+
return null;
|
|
7395
|
+
}
|
|
7396
|
+
function ImageDropPasteHandler({ enabled, children }) {
|
|
7397
|
+
const { uploadImage } = useImageCallbacks();
|
|
7398
|
+
const wrapperRef = React58.useRef(null);
|
|
7399
|
+
const dragDepth = React58.useRef(0);
|
|
7400
|
+
const [dragging, setDragging] = React58.useState(false);
|
|
7401
|
+
const [uploading, setUploading] = React58.useState(false);
|
|
7402
|
+
const active = enabled && Boolean(uploadImage);
|
|
7403
|
+
React58.useEffect(() => {
|
|
7404
|
+
if (!active || !uploadImage) return;
|
|
7405
|
+
const handlePaste = (e) => __async(null, null, function* () {
|
|
7406
|
+
var _a;
|
|
7407
|
+
const target = e.target;
|
|
7408
|
+
if ((target == null ? void 0 : target.tagName) === "INPUT" || (target == null ? void 0 : target.tagName) === "TEXTAREA" || (target == null ? void 0 : target.isContentEditable)) return;
|
|
7409
|
+
const file = findImageFile((_a = e.clipboardData) == null ? void 0 : _a.files);
|
|
7410
|
+
if (!file) return;
|
|
7411
|
+
e.preventDefault();
|
|
7412
|
+
setUploading(true);
|
|
7413
|
+
try {
|
|
7414
|
+
const uploaded = yield uploadImage(file);
|
|
7415
|
+
appendImageBlock(uploaded);
|
|
7416
|
+
} catch (e2) {
|
|
7417
|
+
} finally {
|
|
7418
|
+
setUploading(false);
|
|
7419
|
+
}
|
|
7420
|
+
});
|
|
7421
|
+
window.addEventListener("paste", handlePaste);
|
|
7422
|
+
return () => window.removeEventListener("paste", handlePaste);
|
|
7423
|
+
}, [active, uploadImage]);
|
|
7424
|
+
if (!active) return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, children);
|
|
7425
|
+
const onDragEnter = (e) => {
|
|
7426
|
+
var _a, _b;
|
|
7427
|
+
if (!Array.from((_b = (_a = e.dataTransfer) == null ? void 0 : _a.items) != null ? _b : []).some((i) => i.kind === "file")) return;
|
|
7428
|
+
dragDepth.current += 1;
|
|
7429
|
+
setDragging(true);
|
|
7430
|
+
};
|
|
7431
|
+
const onDragLeave = () => {
|
|
7432
|
+
dragDepth.current = Math.max(0, dragDepth.current - 1);
|
|
7433
|
+
if (dragDepth.current === 0) setDragging(false);
|
|
7434
|
+
};
|
|
7435
|
+
const onDragOver = (e) => {
|
|
7436
|
+
var _a, _b;
|
|
7437
|
+
if (!Array.from((_b = (_a = e.dataTransfer) == null ? void 0 : _a.items) != null ? _b : []).some((i) => i.kind === "file")) return;
|
|
7438
|
+
e.preventDefault();
|
|
7439
|
+
e.dataTransfer.dropEffect = "copy";
|
|
7440
|
+
};
|
|
7441
|
+
const onDrop = (e) => __async(null, null, function* () {
|
|
7442
|
+
var _a;
|
|
7443
|
+
dragDepth.current = 0;
|
|
7444
|
+
setDragging(false);
|
|
7445
|
+
const file = findImageFile((_a = e.dataTransfer) == null ? void 0 : _a.files);
|
|
7446
|
+
if (!file || !uploadImage) return;
|
|
7447
|
+
e.preventDefault();
|
|
7448
|
+
setUploading(true);
|
|
7449
|
+
try {
|
|
7450
|
+
const uploaded = yield uploadImage(file);
|
|
7451
|
+
appendImageBlock(uploaded);
|
|
7452
|
+
} catch (e2) {
|
|
7453
|
+
} finally {
|
|
7454
|
+
setUploading(false);
|
|
7455
|
+
}
|
|
7456
|
+
});
|
|
7457
|
+
return /* @__PURE__ */ React58__default.default.createElement(
|
|
7458
|
+
material.Box,
|
|
7459
|
+
{
|
|
7460
|
+
ref: wrapperRef,
|
|
7461
|
+
onDragEnter,
|
|
7462
|
+
onDragLeave,
|
|
7463
|
+
onDragOver,
|
|
7464
|
+
onDrop,
|
|
7465
|
+
sx: { position: "relative" }
|
|
7466
|
+
},
|
|
7467
|
+
children,
|
|
7468
|
+
(dragging || uploading) && /* @__PURE__ */ React58__default.default.createElement(
|
|
7469
|
+
material.Box,
|
|
7470
|
+
{
|
|
7471
|
+
sx: {
|
|
7472
|
+
position: "absolute",
|
|
7473
|
+
inset: 0,
|
|
7474
|
+
backgroundColor: "rgba(33, 150, 243, 0.06)",
|
|
7475
|
+
border: "2px dashed",
|
|
7476
|
+
borderColor: "primary.main",
|
|
7477
|
+
borderRadius: 1,
|
|
7478
|
+
display: "flex",
|
|
7479
|
+
alignItems: "flex-start",
|
|
7480
|
+
justifyContent: "center",
|
|
7481
|
+
paddingTop: 12,
|
|
7482
|
+
color: "primary.dark",
|
|
7483
|
+
pointerEvents: "none",
|
|
7484
|
+
zIndex: 10
|
|
7485
|
+
}
|
|
7486
|
+
},
|
|
7487
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontWeight: 600, fontSize: 14 } }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.CloudUploadOutlined, null), uploading ? "Uploading\u2026" : "Drop image to insert")
|
|
7488
|
+
)
|
|
7489
|
+
);
|
|
7490
|
+
}
|
|
6553
7491
|
|
|
6554
7492
|
// src/app/email-canvas/index.tsx
|
|
6555
7493
|
function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true }) {
|
|
@@ -6580,21 +7518,29 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
6580
7518
|
}
|
|
6581
7519
|
};
|
|
6582
7520
|
const renderMainPanel = () => {
|
|
7521
|
+
var _a;
|
|
6583
7522
|
switch (selectedMainTab) {
|
|
6584
7523
|
case "editor":
|
|
6585
|
-
return /* @__PURE__ */
|
|
6586
|
-
case "preview":
|
|
6587
|
-
|
|
7524
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: mainBoxSx }, /* @__PURE__ */ React58__default.default.createElement(EditorBlock, { id: "root" }));
|
|
7525
|
+
case "preview": {
|
|
7526
|
+
const rootBlock = document2.root;
|
|
7527
|
+
const layoutData = rootBlock && rootBlock.type === "EmailLayout" ? rootBlock.data : void 0;
|
|
7528
|
+
const samples = buildSampleValueMap(
|
|
7529
|
+
(_a = layoutData == null ? void 0 : layoutData.variables) != null ? _a : []
|
|
7530
|
+
);
|
|
7531
|
+
const previewDoc = applySampleValuesToDocument(document2, samples);
|
|
7532
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: mainBoxSx }, /* @__PURE__ */ React58__default.default.createElement(Reader, { document: previewDoc, rootBlockId: "root" }));
|
|
7533
|
+
}
|
|
6588
7534
|
case "html":
|
|
6589
|
-
return /* @__PURE__ */
|
|
7535
|
+
return /* @__PURE__ */ React58__default.default.createElement(HtmlPanel, null);
|
|
6590
7536
|
case "text":
|
|
6591
|
-
return /* @__PURE__ */
|
|
7537
|
+
return /* @__PURE__ */ React58__default.default.createElement(TextPanel, null);
|
|
6592
7538
|
case "json":
|
|
6593
|
-
return /* @__PURE__ */
|
|
7539
|
+
return /* @__PURE__ */ React58__default.default.createElement(JsonPanel, null);
|
|
6594
7540
|
}
|
|
6595
7541
|
};
|
|
6596
7542
|
const showSaveButtons = persistenceEnabled;
|
|
6597
|
-
return /* @__PURE__ */
|
|
7543
|
+
return /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(
|
|
6598
7544
|
material.Stack,
|
|
6599
7545
|
{
|
|
6600
7546
|
sx: {
|
|
@@ -6611,13 +7557,13 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
6611
7557
|
justifyContent: "space-between",
|
|
6612
7558
|
alignItems: "center"
|
|
6613
7559
|
},
|
|
6614
|
-
samplesDrawerEnabled && /* @__PURE__ */
|
|
6615
|
-
/* @__PURE__ */
|
|
6616
|
-
/* @__PURE__ */
|
|
6617
|
-
), selectedMainTab === "editor" && /* @__PURE__ */
|
|
7560
|
+
samplesDrawerEnabled && /* @__PURE__ */ React58__default.default.createElement(ToggleSamplesPanelButton, null),
|
|
7561
|
+
/* @__PURE__ */ React58__default.default.createElement(material.Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React58__default.default.createElement(MainTabsGroup, null)), /* @__PURE__ */ React58__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React58__default.default.createElement(material.ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "desktop" }, /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58__default.default.createElement(material.ToggleButton, { value: "mobile" }, /* @__PURE__ */ React58__default.default.createElement(material.Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React58__default.default.createElement(iconsMaterial.PhoneIphoneOutlined, { fontSize: "small" })))), showSaveButtons && /* @__PURE__ */ React58__default.default.createElement(React58__default.default.Fragment, null, /* @__PURE__ */ React58__default.default.createElement(NewTemplateButton, { loadTemplates, saveAs }), /* @__PURE__ */ React58__default.default.createElement(SaveButton, { loadTemplates, saveAs })))),
|
|
7562
|
+
/* @__PURE__ */ React58__default.default.createElement(ToggleInspectorPanelButton, null)
|
|
7563
|
+
), selectedMainTab === "editor" && /* @__PURE__ */ React58__default.default.createElement(SubjectInput, null), selectedMainTab === "preview" && /* @__PURE__ */ React58__default.default.createElement(SubjectPreview, null), /* @__PURE__ */ React58__default.default.createElement(ImageDropPasteHandler, { enabled: selectedMainTab === "editor" }, /* @__PURE__ */ React58__default.default.createElement(material.Box, { sx: {
|
|
6618
7564
|
paddingBottom: "50px",
|
|
6619
7565
|
minWidth: 370
|
|
6620
|
-
} }, renderMainPanel()));
|
|
7566
|
+
} }, renderMainPanel())));
|
|
6621
7567
|
}
|
|
6622
7568
|
|
|
6623
7569
|
// src/app/index.tsx
|
|
@@ -6653,7 +7599,7 @@ function useDrawerTransition(cssProperty, open) {
|
|
|
6653
7599
|
duration: !open ? transitions.duration.leavingScreen : transitions.duration.enteringScreen
|
|
6654
7600
|
});
|
|
6655
7601
|
}
|
|
6656
|
-
var EmailEditorInternal =
|
|
7602
|
+
var EmailEditorInternal = React58.forwardRef((props, ref) => {
|
|
6657
7603
|
const {
|
|
6658
7604
|
drawerEnterDuration = 225,
|
|
6659
7605
|
drawerExitDuration = 225,
|
|
@@ -6675,10 +7621,10 @@ var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
|
6675
7621
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
6676
7622
|
const marginLeftTransition = useDrawerTransition("margin-left", samplesDrawerOpen);
|
|
6677
7623
|
const marginRightTransition = useDrawerTransition("margin-right", inspectorDrawerOpen);
|
|
6678
|
-
const onChangeRef =
|
|
7624
|
+
const onChangeRef = React58.useRef(onChange);
|
|
6679
7625
|
onChangeRef.current = onChange;
|
|
6680
|
-
const prevDocJsonRef =
|
|
6681
|
-
|
|
7626
|
+
const prevDocJsonRef = React58.useRef("");
|
|
7627
|
+
React58.useEffect(() => {
|
|
6682
7628
|
var _a;
|
|
6683
7629
|
const docJson = JSON.stringify(currentDocument);
|
|
6684
7630
|
if (docJson !== prevDocJsonRef.current) {
|
|
@@ -6686,7 +7632,7 @@ var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
|
6686
7632
|
(_a = onChangeRef.current) == null ? void 0 : _a.call(onChangeRef, currentDocument);
|
|
6687
7633
|
}
|
|
6688
7634
|
}, [currentDocument]);
|
|
6689
|
-
|
|
7635
|
+
React58.useImperativeHandle(ref, () => ({
|
|
6690
7636
|
saveTemplate: () => {
|
|
6691
7637
|
return saveTemplate();
|
|
6692
7638
|
},
|
|
@@ -6698,7 +7644,7 @@ var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
|
6698
7644
|
return getDocument();
|
|
6699
7645
|
}
|
|
6700
7646
|
}));
|
|
6701
|
-
return /* @__PURE__ */
|
|
7647
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React58__default.default.createElement(
|
|
6702
7648
|
InspectorDrawer,
|
|
6703
7649
|
{
|
|
6704
7650
|
enterDuration: drawerEnterDuration,
|
|
@@ -6706,7 +7652,7 @@ var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
|
6706
7652
|
deleteTemplate,
|
|
6707
7653
|
copyTemplate
|
|
6708
7654
|
}
|
|
6709
|
-
), /* @__PURE__ */
|
|
7655
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6710
7656
|
SamplesDrawer,
|
|
6711
7657
|
{
|
|
6712
7658
|
enterDuration: drawerEnterDuration,
|
|
@@ -6722,7 +7668,7 @@ var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
|
6722
7668
|
setTemplateKind,
|
|
6723
7669
|
saveAs
|
|
6724
7670
|
}
|
|
6725
|
-
), /* @__PURE__ */
|
|
7671
|
+
), /* @__PURE__ */ React58__default.default.createElement(
|
|
6726
7672
|
material.Stack,
|
|
6727
7673
|
{
|
|
6728
7674
|
sx: {
|
|
@@ -6731,10 +7677,10 @@ var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
|
6731
7677
|
transition: [marginLeftTransition, marginRightTransition].join(", ")
|
|
6732
7678
|
}
|
|
6733
7679
|
},
|
|
6734
|
-
/* @__PURE__ */
|
|
7680
|
+
/* @__PURE__ */ React58__default.default.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
|
|
6735
7681
|
));
|
|
6736
7682
|
});
|
|
6737
|
-
var EmailEditor =
|
|
7683
|
+
var EmailEditor = React58.forwardRef((props, ref) => {
|
|
6738
7684
|
const {
|
|
6739
7685
|
initialTemplate: initialTemplateProp,
|
|
6740
7686
|
initialTemplateId,
|
|
@@ -6754,21 +7700,28 @@ var EmailEditor = React60.forwardRef((props, ref) => {
|
|
|
6754
7700
|
renameTemplate,
|
|
6755
7701
|
setTemplateKind,
|
|
6756
7702
|
saveAs,
|
|
7703
|
+
uploadImage,
|
|
7704
|
+
loadImages,
|
|
7705
|
+
deleteImage,
|
|
6757
7706
|
theme
|
|
6758
7707
|
} = props;
|
|
6759
|
-
const resolvedTemplate =
|
|
7708
|
+
const resolvedTemplate = React58.useMemo(
|
|
6760
7709
|
() => typeof initialTemplateProp === "string" ? htmlToEditorConfig(initialTemplateProp) : initialTemplateProp,
|
|
6761
7710
|
[initialTemplateProp]
|
|
6762
7711
|
);
|
|
6763
|
-
const prevTemplateRef =
|
|
7712
|
+
const prevTemplateRef = React58.useRef(void 0);
|
|
6764
7713
|
if (resolvedTemplate && resolvedTemplate !== prevTemplateRef.current) {
|
|
6765
7714
|
prevTemplateRef.current = resolvedTemplate;
|
|
6766
7715
|
resetDocument(resolvedTemplate);
|
|
6767
7716
|
}
|
|
6768
|
-
|
|
7717
|
+
React58.useEffect(() => {
|
|
6769
7718
|
setPersistenceEnabled(persistenceEnabled);
|
|
6770
7719
|
}, [persistenceEnabled]);
|
|
6771
|
-
|
|
7720
|
+
const imageCallbacks = React58.useMemo(
|
|
7721
|
+
() => ({ uploadImage, loadImages, deleteImage }),
|
|
7722
|
+
[uploadImage, loadImages, deleteImage]
|
|
7723
|
+
);
|
|
7724
|
+
return /* @__PURE__ */ React58__default.default.createElement(material.ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React58__default.default.createElement(material.CssBaseline, null), /* @__PURE__ */ React58__default.default.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React58__default.default.createElement(SnackbarProvider, null, /* @__PURE__ */ React58__default.default.createElement(ImageCallbacksProvider, { callbacks: imageCallbacks }, /* @__PURE__ */ React58__default.default.createElement(
|
|
6772
7725
|
EmailEditorProvider,
|
|
6773
7726
|
{
|
|
6774
7727
|
initialTemplate: resolvedTemplate,
|
|
@@ -6777,7 +7730,7 @@ var EmailEditor = React60.forwardRef((props, ref) => {
|
|
|
6777
7730
|
onSave,
|
|
6778
7731
|
onChange
|
|
6779
7732
|
},
|
|
6780
|
-
/* @__PURE__ */
|
|
7733
|
+
/* @__PURE__ */ React58__default.default.createElement(
|
|
6781
7734
|
EmailEditorInternal,
|
|
6782
7735
|
{
|
|
6783
7736
|
ref,
|
|
@@ -6796,7 +7749,7 @@ var EmailEditor = React60.forwardRef((props, ref) => {
|
|
|
6796
7749
|
onChange
|
|
6797
7750
|
}
|
|
6798
7751
|
)
|
|
6799
|
-
))));
|
|
7752
|
+
)))));
|
|
6800
7753
|
});
|
|
6801
7754
|
EmailEditor.displayName = "EmailEditor";
|
|
6802
7755
|
EmailEditorInternal.displayName = "EmailEditorInternal";
|