@kontakto/email-template-editor 1.5.1 → 2.0.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 +60 -4
- package/dist/index.cjs +1513 -859
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -14
- package/dist/index.d.ts +164 -14
- package/dist/index.js +1420 -767
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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 React60 = 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 React60__default = /*#__PURE__*/_interopDefault(React60);
|
|
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 = React60.useMemo(() => renderMarkdownString(markdown), [markdown]);
|
|
172
|
+
return /* @__PURE__ */ React60__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",
|
|
@@ -245,9 +245,9 @@ function Text({ style, props }) {
|
|
|
245
245
|
};
|
|
246
246
|
const text = (_f = props == null ? void 0 : props.text) != null ? _f : TextPropsDefaults.text;
|
|
247
247
|
if (props == null ? void 0 : props.markdown) {
|
|
248
|
-
return /* @__PURE__ */
|
|
248
|
+
return /* @__PURE__ */ React60__default.default.createElement(EmailMarkdown, { style: wStyle, markdown: text });
|
|
249
249
|
}
|
|
250
|
-
return /* @__PURE__ */
|
|
250
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wStyle }, text);
|
|
251
251
|
}
|
|
252
252
|
var PADDING_SCHEMA2 = zod.z.object({
|
|
253
253
|
top: zod.z.number(),
|
|
@@ -296,7 +296,7 @@ function Avatar({ style, props }) {
|
|
|
296
296
|
textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
|
|
297
297
|
padding: getPadding2(style == null ? void 0 : style.padding)
|
|
298
298
|
};
|
|
299
|
-
return /* @__PURE__ */
|
|
299
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React60__default.default.createElement(
|
|
300
300
|
"img",
|
|
301
301
|
{
|
|
302
302
|
alt,
|
|
@@ -444,14 +444,14 @@ function Button({ style, props }) {
|
|
|
444
444
|
padding: `${padding[0]}px ${padding[1]}px`,
|
|
445
445
|
textDecoration: "none"
|
|
446
446
|
};
|
|
447
|
-
return /* @__PURE__ */
|
|
447
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60__default.default.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
448
448
|
"span",
|
|
449
449
|
{
|
|
450
450
|
dangerouslySetInnerHTML: {
|
|
451
451
|
__html: `<!--[if mso]><i style="letter-spacing: ${padding[1]}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
), /* @__PURE__ */
|
|
454
|
+
), /* @__PURE__ */ React60__default.default.createElement("span", null, text), /* @__PURE__ */ React60__default.default.createElement(
|
|
455
455
|
"span",
|
|
456
456
|
{
|
|
457
457
|
dangerouslySetInnerHTML: {
|
|
@@ -500,7 +500,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
500
500
|
contentAlignment: (_d = props == null ? void 0 : props.contentAlignment) != null ? _d : ColumnsContainerPropsDefaults.contentAlignment,
|
|
501
501
|
fixedWidths: props == null ? void 0 : props.fixedWidths
|
|
502
502
|
};
|
|
503
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wStyle }, /* @__PURE__ */ React60__default.default.createElement(
|
|
504
504
|
"table",
|
|
505
505
|
{
|
|
506
506
|
align: "center",
|
|
@@ -509,7 +509,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
509
509
|
border: 0,
|
|
510
510
|
style: { tableLayout: "fixed", borderCollapse: "collapse" }
|
|
511
511
|
},
|
|
512
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ React60__default.default.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React60__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60__default.default.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React60__default.default.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React60__default.default.createElement(TableCell, { index: 2, props: blockProps, columns })))
|
|
513
513
|
));
|
|
514
514
|
}
|
|
515
515
|
function TableCell({ index, props, columns }) {
|
|
@@ -527,7 +527,7 @@ function TableCell({ index, props, columns }) {
|
|
|
527
527
|
width: (_d = (_c = props.fixedWidths) == null ? void 0 : _c[index]) != null ? _d : void 0
|
|
528
528
|
};
|
|
529
529
|
const children = (_e = columns && columns[index]) != null ? _e : null;
|
|
530
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ React60__default.default.createElement("td", { style }, children);
|
|
531
531
|
}
|
|
532
532
|
function getPaddingBefore(index, { columnsGap, columnsCount }) {
|
|
533
533
|
if (index === 0) {
|
|
@@ -589,9 +589,9 @@ function Container({ style, children }) {
|
|
|
589
589
|
padding: getPadding5(style == null ? void 0 : style.padding)
|
|
590
590
|
};
|
|
591
591
|
if (!children) {
|
|
592
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wStyle });
|
|
593
593
|
}
|
|
594
|
-
return /* @__PURE__ */
|
|
594
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wStyle }, children);
|
|
595
595
|
}
|
|
596
596
|
var container_default = Container;
|
|
597
597
|
var COLOR_SCHEMA5 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
@@ -625,7 +625,7 @@ function Divider({ style, props }) {
|
|
|
625
625
|
};
|
|
626
626
|
const borderTopWidth = (_b = props == null ? void 0 : props.lineHeight) != null ? _b : DividerPropsDefaults.lineHeight;
|
|
627
627
|
const borderTopColor = (_c = props == null ? void 0 : props.lineColor) != null ? _c : DividerPropsDefaults.lineColor;
|
|
628
|
-
return /* @__PURE__ */
|
|
628
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: st }, /* @__PURE__ */ React60__default.default.createElement(
|
|
629
629
|
"hr",
|
|
630
630
|
{
|
|
631
631
|
style: {
|
|
@@ -715,11 +715,11 @@ function Heading({ props, style }) {
|
|
|
715
715
|
};
|
|
716
716
|
switch (level) {
|
|
717
717
|
case "h1":
|
|
718
|
-
return /* @__PURE__ */
|
|
718
|
+
return /* @__PURE__ */ React60__default.default.createElement("h1", { style: hStyle }, text);
|
|
719
719
|
case "h2":
|
|
720
|
-
return /* @__PURE__ */
|
|
720
|
+
return /* @__PURE__ */ React60__default.default.createElement("h2", { style: hStyle }, text);
|
|
721
721
|
case "h3":
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ React60__default.default.createElement("h3", { style: hStyle }, text);
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
function getFontSize(level) {
|
|
@@ -801,9 +801,9 @@ function Html({ style, props }) {
|
|
|
801
801
|
padding: getPadding8(style == null ? void 0 : style.padding)
|
|
802
802
|
};
|
|
803
803
|
if (!children) {
|
|
804
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: cssStyle });
|
|
805
805
|
}
|
|
806
|
-
return /* @__PURE__ */
|
|
806
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
807
807
|
}
|
|
808
808
|
var html_default = Html;
|
|
809
809
|
var PADDING_SCHEMA9 = zod.z.object({
|
|
@@ -839,7 +839,7 @@ function Image({ style, props }) {
|
|
|
839
839
|
const linkHref = (_c = props == null ? void 0 : props.linkHref) != null ? _c : null;
|
|
840
840
|
const width = (_d = props == null ? void 0 : props.width) != null ? _d : void 0;
|
|
841
841
|
const height = (_e = props == null ? void 0 : props.height) != null ? _e : void 0;
|
|
842
|
-
const imageElement = /* @__PURE__ */
|
|
842
|
+
const imageElement = /* @__PURE__ */ React60__default.default.createElement(
|
|
843
843
|
"img",
|
|
844
844
|
{
|
|
845
845
|
alt: (_f = props == null ? void 0 : props.alt) != null ? _f : "",
|
|
@@ -859,9 +859,9 @@ function Image({ style, props }) {
|
|
|
859
859
|
}
|
|
860
860
|
);
|
|
861
861
|
if (!linkHref) {
|
|
862
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: sectionStyle }, imageElement);
|
|
863
863
|
}
|
|
864
|
-
return /* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React60__default.default.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
|
|
865
865
|
}
|
|
866
866
|
var image_default = Image;
|
|
867
867
|
var FONT_FAMILY_SCHEMA5 = zod.z.enum([
|
|
@@ -1007,7 +1007,7 @@ function Signature({ style, props }) {
|
|
|
1007
1007
|
color: linkColor,
|
|
1008
1008
|
textDecoration: "none"
|
|
1009
1009
|
};
|
|
1010
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
1010
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React60__default.default.createElement(
|
|
1011
1011
|
"img",
|
|
1012
1012
|
{
|
|
1013
1013
|
src: imageUrl,
|
|
@@ -1026,18 +1026,18 @@ function Signature({ style, props }) {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
) : null;
|
|
1028
1028
|
const contactParts = [];
|
|
1029
|
-
if (email) contactParts.push(/* @__PURE__ */
|
|
1030
|
-
if (phone) contactParts.push(/* @__PURE__ */
|
|
1029
|
+
if (email) contactParts.push(/* @__PURE__ */ React60__default.default.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
|
|
1030
|
+
if (phone) contactParts.push(/* @__PURE__ */ React60__default.default.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
|
|
1031
1031
|
if (website) {
|
|
1032
1032
|
const href = website.startsWith("http") ? website : `https://${website}`;
|
|
1033
|
-
contactParts.push(/* @__PURE__ */
|
|
1033
|
+
contactParts.push(/* @__PURE__ */ React60__default.default.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
|
|
1034
1034
|
}
|
|
1035
|
-
const textContent = /* @__PURE__ */
|
|
1036
|
-
const greetingElement = greeting ? /* @__PURE__ */
|
|
1035
|
+
const textContent = /* @__PURE__ */ React60__default.default.createElement("div", null, name && /* @__PURE__ */ React60__default.default.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React60__default.default.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React60__default.default.createElement("span", { style: detailStyle }, " \xB7 "), part))));
|
|
1036
|
+
const greetingElement = greeting ? /* @__PURE__ */ React60__default.default.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
1037
1037
|
if (layout === "vertical") {
|
|
1038
|
-
return /* @__PURE__ */
|
|
1038
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React60__default.default.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
1039
1039
|
}
|
|
1040
|
-
return /* @__PURE__ */
|
|
1040
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React60__default.default.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React60__default.default.createElement("tbody", null, /* @__PURE__ */ React60__default.default.createElement("tr", null, imageElement && /* @__PURE__ */ React60__default.default.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React60__default.default.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
1041
1041
|
}
|
|
1042
1042
|
var signature_default = Signature;
|
|
1043
1043
|
var SpacerPropsSchema = zod.z.object({
|
|
@@ -1054,13 +1054,13 @@ function Spacer({ props }) {
|
|
|
1054
1054
|
const style = {
|
|
1055
1055
|
height: (_a = props == null ? void 0 : props.height) != null ? _a : SpacerPropsDefaults.height
|
|
1056
1056
|
};
|
|
1057
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style });
|
|
1058
1058
|
}
|
|
1059
1059
|
var spacer_default = Spacer;
|
|
1060
1060
|
function buildBlockComponent(blocks) {
|
|
1061
1061
|
return function BlockComponent({ type, data }) {
|
|
1062
1062
|
const Component = blocks[type].Component;
|
|
1063
|
-
return /* @__PURE__ */
|
|
1063
|
+
return /* @__PURE__ */ React60__default.default.createElement(Component, __spreadValues({}, data));
|
|
1064
1064
|
};
|
|
1065
1065
|
}
|
|
1066
1066
|
function buildBlockConfigurationSchema(blocks) {
|
|
@@ -1097,9 +1097,9 @@ function ColumnsContainerReader({ style, props }) {
|
|
|
1097
1097
|
const _a = props != null ? props : {}, { columns } = _a, restProps = __objRest(_a, ["columns"]);
|
|
1098
1098
|
let cols = void 0;
|
|
1099
1099
|
if (columns) {
|
|
1100
|
-
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */
|
|
1100
|
+
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React60__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1101
1101
|
}
|
|
1102
|
-
return /* @__PURE__ */
|
|
1102
|
+
return /* @__PURE__ */ React60__default.default.createElement(columns_container_default, { props: restProps, columns: cols, style });
|
|
1103
1103
|
}
|
|
1104
1104
|
var ContainerPropsSchema2 = zod.z.object({
|
|
1105
1105
|
style: ContainerPropsSchema.shape.style,
|
|
@@ -1110,7 +1110,7 @@ var ContainerPropsSchema2 = zod.z.object({
|
|
|
1110
1110
|
function ContainerReader({ style, props }) {
|
|
1111
1111
|
var _a;
|
|
1112
1112
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
1113
|
-
return /* @__PURE__ */
|
|
1113
|
+
return /* @__PURE__ */ React60__default.default.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React60__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1114
1114
|
}
|
|
1115
1115
|
var COLOR_SCHEMA9 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
1116
1116
|
var FONT_FAMILY_SCHEMA6 = zod.z.enum([
|
|
@@ -1124,14 +1124,21 @@ var FONT_FAMILY_SCHEMA6 = zod.z.enum([
|
|
|
1124
1124
|
"BOOK_SERIF",
|
|
1125
1125
|
"MONOSPACE"
|
|
1126
1126
|
]).nullable().optional();
|
|
1127
|
+
var TemplateVariableSchema = zod.z.object({
|
|
1128
|
+
name: zod.z.string(),
|
|
1129
|
+
description: zod.z.string().optional().nullable()
|
|
1130
|
+
});
|
|
1127
1131
|
var EmailLayoutPropsSchema = zod.z.object({
|
|
1128
1132
|
backdropColor: COLOR_SCHEMA9,
|
|
1133
|
+
backdropDisabled: zod.z.boolean().optional().nullable(),
|
|
1129
1134
|
borderColor: COLOR_SCHEMA9,
|
|
1130
1135
|
borderRadius: zod.z.number().optional().nullable(),
|
|
1131
1136
|
canvasColor: COLOR_SCHEMA9,
|
|
1132
1137
|
textColor: COLOR_SCHEMA9,
|
|
1133
1138
|
fontFamily: FONT_FAMILY_SCHEMA6,
|
|
1134
|
-
childrenIds: zod.z.array(zod.z.string()).optional().nullable()
|
|
1139
|
+
childrenIds: zod.z.array(zod.z.string()).optional().nullable(),
|
|
1140
|
+
subject: zod.z.string().optional().nullable(),
|
|
1141
|
+
variables: zod.z.array(TemplateVariableSchema).optional().nullable()
|
|
1135
1142
|
});
|
|
1136
1143
|
function getFontFamily6(fontFamily) {
|
|
1137
1144
|
const f = fontFamily != null ? fontFamily : "MODERN_SANS";
|
|
@@ -1165,24 +1172,29 @@ function getBorder2({ borderColor }) {
|
|
|
1165
1172
|
function EmailLayoutReader(props) {
|
|
1166
1173
|
var _a, _b, _c, _d, _e;
|
|
1167
1174
|
const childrenIds = (_a = props.childrenIds) != null ? _a : [];
|
|
1168
|
-
|
|
1175
|
+
const baseStyle = {
|
|
1176
|
+
color: (_b = props.textColor) != null ? _b : "#262626",
|
|
1177
|
+
fontFamily: getFontFamily6(props.fontFamily),
|
|
1178
|
+
fontSize: "16px",
|
|
1179
|
+
fontWeight: "400",
|
|
1180
|
+
letterSpacing: "0.15008px",
|
|
1181
|
+
lineHeight: "1.5",
|
|
1182
|
+
margin: "0"
|
|
1183
|
+
};
|
|
1184
|
+
if (props.backdropDisabled) {
|
|
1185
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React60__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1186
|
+
}
|
|
1187
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
1169
1188
|
"div",
|
|
1170
1189
|
{
|
|
1171
|
-
style: {
|
|
1172
|
-
backgroundColor: (
|
|
1173
|
-
color: (_c = props.textColor) != null ? _c : "#262626",
|
|
1174
|
-
fontFamily: getFontFamily6(props.fontFamily),
|
|
1175
|
-
fontSize: "16px",
|
|
1176
|
-
fontWeight: "400",
|
|
1177
|
-
letterSpacing: "0.15008px",
|
|
1178
|
-
lineHeight: "1.5",
|
|
1179
|
-
margin: "0",
|
|
1190
|
+
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
1191
|
+
backgroundColor: (_c = props.backdropColor) != null ? _c : "#F5F5F5",
|
|
1180
1192
|
padding: "32px 0",
|
|
1181
1193
|
minHeight: "100%",
|
|
1182
1194
|
width: "100%"
|
|
1183
|
-
}
|
|
1195
|
+
})
|
|
1184
1196
|
},
|
|
1185
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
1186
1198
|
"table",
|
|
1187
1199
|
{
|
|
1188
1200
|
align: "center",
|
|
@@ -1192,6 +1204,7 @@ function EmailLayoutReader(props) {
|
|
|
1192
1204
|
maxWidth: "600px",
|
|
1193
1205
|
backgroundColor: (_d = props.canvasColor) != null ? _d : "#FFFFFF",
|
|
1194
1206
|
borderRadius: (_e = props.borderRadius) != null ? _e : void 0,
|
|
1207
|
+
overflow: props.borderRadius ? "hidden" : void 0,
|
|
1195
1208
|
border: getBorder2(props)
|
|
1196
1209
|
},
|
|
1197
1210
|
role: "presentation",
|
|
@@ -1199,19 +1212,19 @@ function EmailLayoutReader(props) {
|
|
|
1199
1212
|
cellPadding: "0",
|
|
1200
1213
|
border: 0
|
|
1201
1214
|
},
|
|
1202
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ React60__default.default.createElement("tbody", null, /* @__PURE__ */ React60__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60__default.default.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React60__default.default.createElement(ReaderBlock, { key: childId, id: childId })))))
|
|
1203
1216
|
)
|
|
1204
1217
|
);
|
|
1205
1218
|
}
|
|
1206
1219
|
|
|
1207
1220
|
// src/email-builder/reader/core.tsx
|
|
1208
|
-
var ReaderContext =
|
|
1221
|
+
var ReaderContext = React60.createContext({});
|
|
1209
1222
|
function useReaderDocument() {
|
|
1210
|
-
return
|
|
1223
|
+
return React60.useContext(ReaderContext);
|
|
1211
1224
|
}
|
|
1212
1225
|
function ReaderBlock({ id }) {
|
|
1213
1226
|
const document2 = useReaderDocument();
|
|
1214
|
-
return document2[id] ? /* @__PURE__ */
|
|
1227
|
+
return document2[id] ? /* @__PURE__ */ React60__default.default.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
|
|
1215
1228
|
}
|
|
1216
1229
|
var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
1217
1230
|
ColumnsContainer: {
|
|
@@ -1268,13 +1281,13 @@ var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
|
|
|
1268
1281
|
var ReaderDocumentSchema = zod.z.record(zod.z.string(), ReaderBlockSchema);
|
|
1269
1282
|
var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
|
|
1270
1283
|
function Reader({ document: document2, rootBlockId }) {
|
|
1271
|
-
return /* @__PURE__ */
|
|
1284
|
+
return /* @__PURE__ */ React60__default.default.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React60__default.default.createElement(ReaderBlock, { id: rootBlockId }));
|
|
1272
1285
|
}
|
|
1273
1286
|
|
|
1274
1287
|
// src/email-builder/renderers/render-to-static-markup.tsx
|
|
1275
1288
|
function renderToStaticMarkup(document2, { rootBlockId }) {
|
|
1276
1289
|
return "<!DOCTYPE html>" + server.renderToStaticMarkup(
|
|
1277
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ React60__default.default.createElement("html", null, /* @__PURE__ */ React60__default.default.createElement("body", null, /* @__PURE__ */ React60__default.default.createElement(Reader, { document: document2, rootBlockId })))
|
|
1278
1291
|
);
|
|
1279
1292
|
}
|
|
1280
1293
|
|
|
@@ -2015,70 +2028,95 @@ function setSelectedScreenSize(selectedScreenSize) {
|
|
|
2015
2028
|
function setPersistenceEnabled(persistenceEnabled) {
|
|
2016
2029
|
return editorStateStore.setState({ persistenceEnabled });
|
|
2017
2030
|
}
|
|
2018
|
-
|
|
2031
|
+
|
|
2032
|
+
// src/app/save-payload.ts
|
|
2033
|
+
var ROOT_BLOCK_ID = "root";
|
|
2034
|
+
function buildSavePayload(doc) {
|
|
2035
|
+
var _a, _b;
|
|
2036
|
+
const root = doc.root;
|
|
2037
|
+
const layoutData = root && root.type === "EmailLayout" ? root.data : void 0;
|
|
2038
|
+
return {
|
|
2039
|
+
editorConfig: doc,
|
|
2040
|
+
subject: (_a = layoutData == null ? void 0 : layoutData.subject) != null ? _a : void 0,
|
|
2041
|
+
variables: (_b = layoutData == null ? void 0 : layoutData.variables) != null ? _b : void 0,
|
|
2042
|
+
bodyHtml: renderToStaticMarkup(doc, { rootBlockId: ROOT_BLOCK_ID }),
|
|
2043
|
+
bodyText: renderToText(doc, { rootBlockId: ROOT_BLOCK_ID })
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
// src/app/context.tsx
|
|
2048
|
+
var EmailEditorContext = React60.createContext(null);
|
|
2019
2049
|
var EmailEditorProvider = ({
|
|
2020
2050
|
children,
|
|
2021
2051
|
initialTemplateId = null,
|
|
2022
2052
|
initialTemplateName = null,
|
|
2023
2053
|
onSave
|
|
2024
2054
|
}) => {
|
|
2025
|
-
const [currentTemplateId, setCurrentTemplateId] =
|
|
2026
|
-
const [currentTemplateName, setCurrentTemplateName] =
|
|
2027
|
-
const
|
|
2028
|
-
const
|
|
2055
|
+
const [currentTemplateId, setCurrentTemplateId] = React60.useState(initialTemplateId);
|
|
2056
|
+
const [currentTemplateName, setCurrentTemplateName] = React60.useState(initialTemplateName);
|
|
2057
|
+
const [currentTemplateKind, setCurrentTemplateKind] = React60.useState(null);
|
|
2058
|
+
const saveListenersRef = React60.useRef([]);
|
|
2059
|
+
const onSaveRef = React60.useRef(onSave);
|
|
2029
2060
|
onSaveRef.current = onSave;
|
|
2030
|
-
const saveTemplate =
|
|
2061
|
+
const saveTemplate = React60.useCallback(() => {
|
|
2031
2062
|
const currentDoc = getDocument();
|
|
2032
2063
|
saveListenersRef.current.forEach((listener) => listener(currentDoc));
|
|
2033
2064
|
if (onSaveRef.current) {
|
|
2034
|
-
onSaveRef.current(currentDoc);
|
|
2065
|
+
onSaveRef.current(buildSavePayload(currentDoc));
|
|
2035
2066
|
}
|
|
2036
2067
|
return currentDoc;
|
|
2037
2068
|
}, []);
|
|
2038
|
-
const loadTemplate =
|
|
2069
|
+
const loadTemplate = React60.useCallback((newTemplate, templateId, templateName, kind) => {
|
|
2039
2070
|
if (templateId !== void 0) {
|
|
2040
2071
|
setCurrentTemplateId(templateId);
|
|
2041
2072
|
}
|
|
2042
2073
|
if (templateName !== void 0) {
|
|
2043
2074
|
setCurrentTemplateName(templateName);
|
|
2044
2075
|
}
|
|
2076
|
+
if (kind !== void 0) {
|
|
2077
|
+
setCurrentTemplateKind(kind);
|
|
2078
|
+
}
|
|
2045
2079
|
}, []);
|
|
2046
|
-
const setCurrentTemplate =
|
|
2080
|
+
const setCurrentTemplate = React60.useCallback((templateId, templateName, kind) => {
|
|
2047
2081
|
setCurrentTemplateId(templateId);
|
|
2048
2082
|
setCurrentTemplateName(templateName);
|
|
2083
|
+
if (kind !== void 0) {
|
|
2084
|
+
setCurrentTemplateKind(kind);
|
|
2085
|
+
}
|
|
2049
2086
|
}, []);
|
|
2050
|
-
const registerSaveListener =
|
|
2087
|
+
const registerSaveListener = React60.useCallback((callback) => {
|
|
2051
2088
|
saveListenersRef.current = [...saveListenersRef.current, callback];
|
|
2052
2089
|
return () => {
|
|
2053
2090
|
saveListenersRef.current = saveListenersRef.current.filter((listener) => listener !== callback);
|
|
2054
2091
|
};
|
|
2055
2092
|
}, []);
|
|
2056
|
-
const value =
|
|
2093
|
+
const value = React60.useMemo(() => ({
|
|
2057
2094
|
currentTemplateId,
|
|
2058
2095
|
currentTemplateName,
|
|
2096
|
+
currentTemplateKind,
|
|
2059
2097
|
saveTemplate,
|
|
2060
2098
|
loadTemplate,
|
|
2061
2099
|
registerSaveListener,
|
|
2062
2100
|
setCurrentTemplate
|
|
2063
|
-
}), [currentTemplateId, currentTemplateName, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2064
|
-
return /* @__PURE__ */
|
|
2101
|
+
}), [currentTemplateId, currentTemplateName, currentTemplateKind, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
2102
|
+
return /* @__PURE__ */ React60__default.default.createElement(EmailEditorContext.Provider, { value }, children);
|
|
2065
2103
|
};
|
|
2066
2104
|
var useEmailEditor = () => {
|
|
2067
|
-
const context =
|
|
2105
|
+
const context = React60.useContext(EmailEditorContext);
|
|
2068
2106
|
if (!context) {
|
|
2069
2107
|
throw new Error("useEmailEditor must be used within an EmailEditorProvider");
|
|
2070
2108
|
}
|
|
2071
2109
|
return context;
|
|
2072
2110
|
};
|
|
2073
2111
|
function BaseSidebarPanel({ title, children }) {
|
|
2074
|
-
return /* @__PURE__ */
|
|
2112
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, title), /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 5, mb: 3 }, children));
|
|
2075
2113
|
}
|
|
2076
2114
|
function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
2077
|
-
const [value, setValue] =
|
|
2078
|
-
|
|
2115
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
2116
|
+
React60.useEffect(() => {
|
|
2079
2117
|
setValue(defaultValue);
|
|
2080
2118
|
}, [defaultValue]);
|
|
2081
|
-
return /* @__PURE__ */
|
|
2119
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React60__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React60__default.default.createElement(
|
|
2082
2120
|
material.ToggleButtonGroup,
|
|
2083
2121
|
{
|
|
2084
2122
|
exclusive: true,
|
|
@@ -2098,7 +2136,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
|
2098
2136
|
}
|
|
2099
2137
|
function RawSliderInput(_a) {
|
|
2100
2138
|
var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
|
|
2101
|
-
return /* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React60__default.default.createElement(
|
|
2102
2140
|
material.Slider,
|
|
2103
2141
|
__spreadProps(__spreadValues({}, props), {
|
|
2104
2142
|
value,
|
|
@@ -2109,14 +2147,14 @@ function RawSliderInput(_a) {
|
|
|
2109
2147
|
setValue(value2);
|
|
2110
2148
|
}
|
|
2111
2149
|
})
|
|
2112
|
-
), /* @__PURE__ */
|
|
2150
|
+
), /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
|
|
2113
2151
|
}
|
|
2114
2152
|
|
|
2115
2153
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
|
|
2116
2154
|
function SliderInput(_a) {
|
|
2117
2155
|
var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
|
|
2118
|
-
const [value, setValue] =
|
|
2119
|
-
return /* @__PURE__ */
|
|
2156
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
2157
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React60__default.default.createElement(
|
|
2120
2158
|
RawSliderInput,
|
|
2121
2159
|
__spreadValues({
|
|
2122
2160
|
value,
|
|
@@ -2128,12 +2166,12 @@ function SliderInput(_a) {
|
|
|
2128
2166
|
));
|
|
2129
2167
|
}
|
|
2130
2168
|
function TextInput({ helperText, label, placeholder, rows, InputProps: InputProps2, defaultValue, onChange }) {
|
|
2131
|
-
const [value, setValue] =
|
|
2169
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
2132
2170
|
const isMultiline = typeof rows === "number" && rows > 1;
|
|
2133
|
-
|
|
2171
|
+
React60.useEffect(() => {
|
|
2134
2172
|
setValue(defaultValue);
|
|
2135
2173
|
}, [defaultValue]);
|
|
2136
|
-
return /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2137
2175
|
material.TextField,
|
|
2138
2176
|
{
|
|
2139
2177
|
fullWidth: true,
|
|
@@ -2159,7 +2197,7 @@ var TILE_BUTTON = {
|
|
|
2159
2197
|
};
|
|
2160
2198
|
function Swatch({ paletteColors, value, onChange }) {
|
|
2161
2199
|
const renderButton2 = (colorValue) => {
|
|
2162
|
-
return /* @__PURE__ */
|
|
2200
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2163
2201
|
material.Button,
|
|
2164
2202
|
{
|
|
2165
2203
|
key: colorValue,
|
|
@@ -2178,7 +2216,7 @@ function Swatch({ paletteColors, value, onChange }) {
|
|
|
2178
2216
|
}
|
|
2179
2217
|
);
|
|
2180
2218
|
};
|
|
2181
|
-
return /* @__PURE__ */
|
|
2219
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
|
|
2182
2220
|
}
|
|
2183
2221
|
|
|
2184
2222
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
|
|
@@ -2245,7 +2283,7 @@ var SX = {
|
|
|
2245
2283
|
}
|
|
2246
2284
|
};
|
|
2247
2285
|
function Picker({ value, onChange }) {
|
|
2248
|
-
return /* @__PURE__ */
|
|
2286
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React60__default.default.createElement(reactColorful.HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React60__default.default.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React60__default.default.createElement(material.Box, { pt: 1 }, /* @__PURE__ */ React60__default.default.createElement(reactColorful.HexColorInput, { prefixed: true, color: value, onChange })));
|
|
2249
2287
|
}
|
|
2250
2288
|
|
|
2251
2289
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
|
|
@@ -2258,8 +2296,8 @@ var BUTTON_SX = {
|
|
|
2258
2296
|
bgcolor: "#FFFFFF"
|
|
2259
2297
|
};
|
|
2260
2298
|
function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
2261
|
-
const [anchorEl, setAnchorEl] =
|
|
2262
|
-
const [value, setValue] =
|
|
2299
|
+
const [anchorEl, setAnchorEl] = React60.useState(null);
|
|
2300
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
2263
2301
|
const handleClickOpen = (event) => {
|
|
2264
2302
|
setAnchorEl(event.currentTarget);
|
|
2265
2303
|
};
|
|
@@ -2270,7 +2308,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2270
2308
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2271
2309
|
return null;
|
|
2272
2310
|
}
|
|
2273
|
-
return /* @__PURE__ */
|
|
2311
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2274
2312
|
material.ButtonBase,
|
|
2275
2313
|
{
|
|
2276
2314
|
onClick: () => {
|
|
@@ -2278,16 +2316,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2278
2316
|
onChange(null);
|
|
2279
2317
|
}
|
|
2280
2318
|
},
|
|
2281
|
-
/* @__PURE__ */
|
|
2319
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
|
|
2282
2320
|
);
|
|
2283
2321
|
};
|
|
2284
2322
|
const renderOpenButton = () => {
|
|
2285
2323
|
if (value) {
|
|
2286
|
-
return /* @__PURE__ */
|
|
2324
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
|
|
2287
2325
|
}
|
|
2288
|
-
return /* @__PURE__ */
|
|
2326
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" }));
|
|
2289
2327
|
};
|
|
2290
|
-
return /* @__PURE__ */
|
|
2328
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React60__default.default.createElement(material.InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React60__default.default.createElement(
|
|
2291
2329
|
material.Menu,
|
|
2292
2330
|
{
|
|
2293
2331
|
anchorEl,
|
|
@@ -2297,7 +2335,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2297
2335
|
sx: { height: "auto", padding: 0 }
|
|
2298
2336
|
}
|
|
2299
2337
|
},
|
|
2300
|
-
/* @__PURE__ */
|
|
2338
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
2301
2339
|
Picker,
|
|
2302
2340
|
{
|
|
2303
2341
|
value: value || "",
|
|
@@ -2312,10 +2350,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2312
2350
|
|
|
2313
2351
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
|
|
2314
2352
|
function ColorInput2(props) {
|
|
2315
|
-
return /* @__PURE__ */
|
|
2353
|
+
return /* @__PURE__ */ React60__default.default.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
|
|
2316
2354
|
}
|
|
2317
2355
|
function NullableColorInput(props) {
|
|
2318
|
-
return /* @__PURE__ */
|
|
2356
|
+
return /* @__PURE__ */ React60__default.default.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
|
|
2319
2357
|
}
|
|
2320
2358
|
|
|
2321
2359
|
// src/editor/blocks/helpers/font-family.ts
|
|
@@ -2368,13 +2406,13 @@ var FONT_FAMILIES = [
|
|
|
2368
2406
|
];
|
|
2369
2407
|
|
|
2370
2408
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
|
|
2371
|
-
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */
|
|
2409
|
+
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React60__default.default.createElement(material.MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
|
|
2372
2410
|
function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
2373
|
-
const [value, setValue] =
|
|
2374
|
-
|
|
2411
|
+
const [value, setValue] = React60.useState(defaultValue != null ? defaultValue : "inherit");
|
|
2412
|
+
React60.useEffect(() => {
|
|
2375
2413
|
setValue(defaultValue != null ? defaultValue : "inherit");
|
|
2376
2414
|
}, [defaultValue]);
|
|
2377
|
-
return /* @__PURE__ */
|
|
2415
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2378
2416
|
material.TextField,
|
|
2379
2417
|
{
|
|
2380
2418
|
select: true,
|
|
@@ -2387,23 +2425,23 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
|
2387
2425
|
onChange(v === null ? null : v);
|
|
2388
2426
|
}
|
|
2389
2427
|
},
|
|
2390
|
-
/* @__PURE__ */
|
|
2428
|
+
/* @__PURE__ */ React60__default.default.createElement(material.MenuItem, { value: "inherit" }, "Match email settings"),
|
|
2391
2429
|
OPTIONS
|
|
2392
2430
|
);
|
|
2393
2431
|
}
|
|
2394
2432
|
function FontSizeInput({ label, defaultValue, onChange }) {
|
|
2395
|
-
const [value, setValue] =
|
|
2396
|
-
|
|
2433
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
2434
|
+
React60.useEffect(() => {
|
|
2397
2435
|
setValue(defaultValue);
|
|
2398
2436
|
}, [defaultValue]);
|
|
2399
2437
|
const handleChange = (value2) => {
|
|
2400
2438
|
setValue(value2);
|
|
2401
2439
|
onChange(value2);
|
|
2402
2440
|
};
|
|
2403
|
-
return /* @__PURE__ */
|
|
2441
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React60__default.default.createElement(
|
|
2404
2442
|
RawSliderInput,
|
|
2405
2443
|
{
|
|
2406
|
-
iconLabel: /* @__PURE__ */
|
|
2444
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.TextFieldsOutlined, { sx: { fontSize: 16 } }),
|
|
2407
2445
|
value,
|
|
2408
2446
|
setValue: handleChange,
|
|
2409
2447
|
units: "px",
|
|
@@ -2414,11 +2452,11 @@ function FontSizeInput({ label, defaultValue, onChange }) {
|
|
|
2414
2452
|
));
|
|
2415
2453
|
}
|
|
2416
2454
|
function FontWeightInput({ label, defaultValue, onChange }) {
|
|
2417
|
-
const [value, setValue] =
|
|
2418
|
-
|
|
2455
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
2456
|
+
React60.useEffect(() => {
|
|
2419
2457
|
setValue(defaultValue);
|
|
2420
2458
|
}, [defaultValue]);
|
|
2421
|
-
return /* @__PURE__ */
|
|
2459
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2422
2460
|
RadioGroupInput,
|
|
2423
2461
|
{
|
|
2424
2462
|
label,
|
|
@@ -2428,12 +2466,12 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2428
2466
|
onChange(fontWeight);
|
|
2429
2467
|
}
|
|
2430
2468
|
},
|
|
2431
|
-
/* @__PURE__ */
|
|
2432
|
-
/* @__PURE__ */
|
|
2469
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "normal" }, "Regular"),
|
|
2470
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "bold" }, "Bold")
|
|
2433
2471
|
);
|
|
2434
2472
|
}
|
|
2435
2473
|
function PaddingInput({ label, defaultValue, onChange }) {
|
|
2436
|
-
const [value, setValue] =
|
|
2474
|
+
const [value, setValue] = React60.useState(() => {
|
|
2437
2475
|
if (defaultValue) {
|
|
2438
2476
|
return defaultValue;
|
|
2439
2477
|
}
|
|
@@ -2451,10 +2489,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2451
2489
|
setValue(v);
|
|
2452
2490
|
onChange(v);
|
|
2453
2491
|
}
|
|
2454
|
-
return /* @__PURE__ */
|
|
2492
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React60__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React60__default.default.createElement(
|
|
2455
2493
|
RawSliderInput,
|
|
2456
2494
|
{
|
|
2457
|
-
iconLabel: /* @__PURE__ */
|
|
2495
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
|
|
2458
2496
|
value: value.top,
|
|
2459
2497
|
setValue: (num) => handleChange("top", num),
|
|
2460
2498
|
units: "px",
|
|
@@ -2463,10 +2501,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2463
2501
|
max: 80,
|
|
2464
2502
|
marks: true
|
|
2465
2503
|
}
|
|
2466
|
-
), /* @__PURE__ */
|
|
2504
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2467
2505
|
RawSliderInput,
|
|
2468
2506
|
{
|
|
2469
|
-
iconLabel: /* @__PURE__ */
|
|
2507
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
|
|
2470
2508
|
value: value.bottom,
|
|
2471
2509
|
setValue: (num) => handleChange("bottom", num),
|
|
2472
2510
|
units: "px",
|
|
@@ -2475,10 +2513,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2475
2513
|
max: 80,
|
|
2476
2514
|
marks: true
|
|
2477
2515
|
}
|
|
2478
|
-
), /* @__PURE__ */
|
|
2516
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2479
2517
|
RawSliderInput,
|
|
2480
2518
|
{
|
|
2481
|
-
iconLabel: /* @__PURE__ */
|
|
2519
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
|
|
2482
2520
|
value: value.left,
|
|
2483
2521
|
setValue: (num) => handleChange("left", num),
|
|
2484
2522
|
units: "px",
|
|
@@ -2487,10 +2525,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2487
2525
|
max: 80,
|
|
2488
2526
|
marks: true
|
|
2489
2527
|
}
|
|
2490
|
-
), /* @__PURE__ */
|
|
2528
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2491
2529
|
RawSliderInput,
|
|
2492
2530
|
{
|
|
2493
|
-
iconLabel: /* @__PURE__ */
|
|
2531
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
|
|
2494
2532
|
value: value.right,
|
|
2495
2533
|
setValue: (num) => handleChange("right", num),
|
|
2496
2534
|
units: "px",
|
|
@@ -2502,11 +2540,11 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2502
2540
|
));
|
|
2503
2541
|
}
|
|
2504
2542
|
function TextAlignInput({ label, defaultValue, onChange }) {
|
|
2505
|
-
const [value, setValue] =
|
|
2506
|
-
|
|
2543
|
+
const [value, setValue] = React60.useState(defaultValue != null ? defaultValue : "left");
|
|
2544
|
+
React60.useEffect(() => {
|
|
2507
2545
|
setValue(defaultValue != null ? defaultValue : "left");
|
|
2508
2546
|
}, [defaultValue]);
|
|
2509
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2510
2548
|
RadioGroupInput,
|
|
2511
2549
|
{
|
|
2512
2550
|
label,
|
|
@@ -2516,9 +2554,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2516
2554
|
onChange(value2);
|
|
2517
2555
|
}
|
|
2518
2556
|
},
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2557
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "left" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FormatAlignLeftOutlined, { fontSize: "small" })),
|
|
2558
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "center" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FormatAlignCenterOutlined, { fontSize: "small" })),
|
|
2559
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "right" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FormatAlignRightOutlined, { fontSize: "small" }))
|
|
2522
2560
|
);
|
|
2523
2561
|
}
|
|
2524
2562
|
|
|
@@ -2531,14 +2569,14 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2531
2569
|
};
|
|
2532
2570
|
switch (name) {
|
|
2533
2571
|
case "backgroundColor":
|
|
2534
|
-
return /* @__PURE__ */
|
|
2572
|
+
return /* @__PURE__ */ React60__default.default.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
|
|
2535
2573
|
case "borderColor":
|
|
2536
|
-
return /* @__PURE__ */
|
|
2574
|
+
return /* @__PURE__ */ React60__default.default.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
|
|
2537
2575
|
case "borderRadius":
|
|
2538
|
-
return /* @__PURE__ */
|
|
2576
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2539
2577
|
SliderInput,
|
|
2540
2578
|
{
|
|
2541
|
-
iconLabel: /* @__PURE__ */
|
|
2579
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.RoundedCornerOutlined, null),
|
|
2542
2580
|
units: "px",
|
|
2543
2581
|
step: 4,
|
|
2544
2582
|
marks: true,
|
|
@@ -2550,29 +2588,29 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2550
2588
|
}
|
|
2551
2589
|
);
|
|
2552
2590
|
case "color":
|
|
2553
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ React60__default.default.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
|
|
2554
2592
|
case "fontFamily":
|
|
2555
|
-
return /* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ React60__default.default.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
|
|
2556
2594
|
case "fontSize":
|
|
2557
|
-
return /* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ React60__default.default.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
|
|
2558
2596
|
case "fontWeight":
|
|
2559
|
-
return /* @__PURE__ */
|
|
2597
|
+
return /* @__PURE__ */ React60__default.default.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
|
|
2560
2598
|
case "textAlign":
|
|
2561
|
-
return /* @__PURE__ */
|
|
2599
|
+
return /* @__PURE__ */ React60__default.default.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
|
|
2562
2600
|
case "padding":
|
|
2563
|
-
return /* @__PURE__ */
|
|
2601
|
+
return /* @__PURE__ */ React60__default.default.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
|
|
2564
2602
|
}
|
|
2565
2603
|
}
|
|
2566
2604
|
|
|
2567
2605
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
|
|
2568
2606
|
function MultiStylePropertyPanel({ names, value, onChange }) {
|
|
2569
|
-
return /* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, names.map((name) => /* @__PURE__ */ React60__default.default.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
|
|
2570
2608
|
}
|
|
2571
2609
|
|
|
2572
2610
|
// src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
|
|
2573
2611
|
function AvatarSidebarPanel({ data, setData }) {
|
|
2574
2612
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2575
|
-
const [, setErrors] =
|
|
2613
|
+
const [, setErrors] = React60.useState(null);
|
|
2576
2614
|
const updateData = (d) => {
|
|
2577
2615
|
const res = AvatarPropsSchema.safeParse(d);
|
|
2578
2616
|
if (res.success) {
|
|
@@ -2586,11 +2624,11 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2586
2624
|
const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
|
|
2587
2625
|
const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
|
|
2588
2626
|
const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
|
|
2589
|
-
return /* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
2590
2628
|
SliderInput,
|
|
2591
2629
|
{
|
|
2592
2630
|
label: "Size",
|
|
2593
|
-
iconLabel: /* @__PURE__ */
|
|
2631
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
2594
2632
|
units: "px",
|
|
2595
2633
|
step: 3,
|
|
2596
2634
|
min: 32,
|
|
@@ -2600,7 +2638,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2600
2638
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
|
|
2601
2639
|
}
|
|
2602
2640
|
}
|
|
2603
|
-
), /* @__PURE__ */
|
|
2641
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2604
2642
|
RadioGroupInput,
|
|
2605
2643
|
{
|
|
2606
2644
|
label: "Shape",
|
|
@@ -2609,10 +2647,10 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2609
2647
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
|
|
2610
2648
|
}
|
|
2611
2649
|
},
|
|
2612
|
-
/* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
), /* @__PURE__ */
|
|
2650
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "circle" }, "Circle"),
|
|
2651
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "square" }, "Square"),
|
|
2652
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded")
|
|
2653
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2616
2654
|
TextInput,
|
|
2617
2655
|
{
|
|
2618
2656
|
label: "Image URL",
|
|
@@ -2621,7 +2659,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2621
2659
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
|
|
2622
2660
|
}
|
|
2623
2661
|
}
|
|
2624
|
-
), /* @__PURE__ */
|
|
2662
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2625
2663
|
TextInput,
|
|
2626
2664
|
{
|
|
2627
2665
|
label: "Alt text",
|
|
@@ -2630,7 +2668,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2630
2668
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
|
|
2631
2669
|
}
|
|
2632
2670
|
}
|
|
2633
|
-
), /* @__PURE__ */
|
|
2671
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2634
2672
|
MultiStylePropertyPanel,
|
|
2635
2673
|
{
|
|
2636
2674
|
names: ["textAlign", "padding"],
|
|
@@ -2641,7 +2679,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2641
2679
|
}
|
|
2642
2680
|
function ButtonSidebarPanel({ data, setData }) {
|
|
2643
2681
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2644
|
-
const [, setErrors] =
|
|
2682
|
+
const [, setErrors] = React60.useState(null);
|
|
2645
2683
|
const updateData = (d) => {
|
|
2646
2684
|
const res = ButtonPropsSchema.safeParse(d);
|
|
2647
2685
|
if (res.success) {
|
|
@@ -2658,65 +2696,65 @@ function ButtonSidebarPanel({ data, setData }) {
|
|
|
2658
2696
|
const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
|
|
2659
2697
|
const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
|
|
2660
2698
|
const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
|
|
2661
|
-
return /* @__PURE__ */
|
|
2699
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
2662
2700
|
TextInput,
|
|
2663
2701
|
{
|
|
2664
2702
|
label: "Text",
|
|
2665
2703
|
defaultValue: text,
|
|
2666
2704
|
onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
|
|
2667
2705
|
}
|
|
2668
|
-
), /* @__PURE__ */
|
|
2706
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2669
2707
|
TextInput,
|
|
2670
2708
|
{
|
|
2671
2709
|
label: "Url",
|
|
2672
2710
|
defaultValue: url,
|
|
2673
2711
|
onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
|
|
2674
2712
|
}
|
|
2675
|
-
), /* @__PURE__ */
|
|
2713
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2676
2714
|
RadioGroupInput,
|
|
2677
2715
|
{
|
|
2678
2716
|
label: "Width",
|
|
2679
2717
|
defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
|
|
2680
2718
|
onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
|
|
2681
2719
|
},
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
2684
|
-
), /* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "FULL_WIDTH" }, "Full"),
|
|
2721
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "AUTO" }, "Auto")
|
|
2722
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2685
2723
|
RadioGroupInput,
|
|
2686
2724
|
{
|
|
2687
2725
|
label: "Size",
|
|
2688
2726
|
defaultValue: size,
|
|
2689
2727
|
onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
|
|
2690
2728
|
},
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2693
|
-
/* @__PURE__ */
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
), /* @__PURE__ */
|
|
2729
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "x-small" }, "Xs"),
|
|
2730
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "small" }, "Sm"),
|
|
2731
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "medium" }, "Md"),
|
|
2732
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "large" }, "Lg")
|
|
2733
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2696
2734
|
RadioGroupInput,
|
|
2697
2735
|
{
|
|
2698
2736
|
label: "Style",
|
|
2699
2737
|
defaultValue: buttonStyle,
|
|
2700
2738
|
onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
|
|
2701
2739
|
},
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
), /* @__PURE__ */
|
|
2740
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "rectangle" }, "Rectangle"),
|
|
2741
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded"),
|
|
2742
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "pill" }, "Pill")
|
|
2743
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2706
2744
|
ColorInput2,
|
|
2707
2745
|
{
|
|
2708
2746
|
label: "Text color",
|
|
2709
2747
|
defaultValue: buttonTextColor,
|
|
2710
2748
|
onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
|
|
2711
2749
|
}
|
|
2712
|
-
), /* @__PURE__ */
|
|
2750
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2713
2751
|
ColorInput2,
|
|
2714
2752
|
{
|
|
2715
2753
|
label: "Button color",
|
|
2716
2754
|
defaultValue: buttonBackgroundColor,
|
|
2717
2755
|
onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
|
|
2718
2756
|
}
|
|
2719
|
-
), /* @__PURE__ */
|
|
2757
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2720
2758
|
MultiStylePropertyPanel,
|
|
2721
2759
|
{
|
|
2722
2760
|
names: ["backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -2742,7 +2780,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2742
2780
|
const value = parseInt(ev.target.value);
|
|
2743
2781
|
onChange(isNaN(value) ? null : value);
|
|
2744
2782
|
};
|
|
2745
|
-
return /* @__PURE__ */
|
|
2783
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
2746
2784
|
material.TextField,
|
|
2747
2785
|
{
|
|
2748
2786
|
fullWidth: true,
|
|
@@ -2753,7 +2791,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2753
2791
|
placeholder: "auto",
|
|
2754
2792
|
size: "small",
|
|
2755
2793
|
InputProps: {
|
|
2756
|
-
endAdornment: /* @__PURE__ */
|
|
2794
|
+
endAdornment: /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2757
2795
|
}
|
|
2758
2796
|
}
|
|
2759
2797
|
);
|
|
@@ -2761,7 +2799,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2761
2799
|
|
|
2762
2800
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/column-widths-input.tsx
|
|
2763
2801
|
function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
2764
|
-
const [currentValue, setCurrentValue] =
|
|
2802
|
+
const [currentValue, setCurrentValue] = React60.useState(() => {
|
|
2765
2803
|
if (defaultValue) {
|
|
2766
2804
|
return defaultValue;
|
|
2767
2805
|
}
|
|
@@ -2775,7 +2813,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2775
2813
|
};
|
|
2776
2814
|
let column3 = null;
|
|
2777
2815
|
{
|
|
2778
|
-
column3 = /* @__PURE__ */
|
|
2816
|
+
column3 = /* @__PURE__ */ React60__default.default.createElement(
|
|
2779
2817
|
TextDimensionInput,
|
|
2780
2818
|
{
|
|
2781
2819
|
label: "Column 3",
|
|
@@ -2786,7 +2824,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2786
2824
|
}
|
|
2787
2825
|
);
|
|
2788
2826
|
}
|
|
2789
|
-
return /* @__PURE__ */
|
|
2827
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React60__default.default.createElement(
|
|
2790
2828
|
TextDimensionInput,
|
|
2791
2829
|
{
|
|
2792
2830
|
label: "Column 1",
|
|
@@ -2795,7 +2833,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2795
2833
|
setIndexValue(0, v);
|
|
2796
2834
|
}
|
|
2797
2835
|
}
|
|
2798
|
-
), /* @__PURE__ */
|
|
2836
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2799
2837
|
TextDimensionInput,
|
|
2800
2838
|
{
|
|
2801
2839
|
label: "Column 2",
|
|
@@ -2810,7 +2848,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2810
2848
|
// src/app/inspector-drawer/configuration-panel/input-panels/columns-container-sidebar-panel.tsx
|
|
2811
2849
|
function ColumnsContainerPanel({ data, setData }) {
|
|
2812
2850
|
var _a, _b, _c, _d, _e, _f;
|
|
2813
|
-
const [, setErrors] =
|
|
2851
|
+
const [, setErrors] = React60.useState(null);
|
|
2814
2852
|
const updateData = (d) => {
|
|
2815
2853
|
const res = columns_container_props_schema_default2.safeParse(d);
|
|
2816
2854
|
if (res.success) {
|
|
@@ -2820,7 +2858,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2820
2858
|
setErrors(res.error);
|
|
2821
2859
|
}
|
|
2822
2860
|
};
|
|
2823
|
-
return /* @__PURE__ */
|
|
2861
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
2824
2862
|
RadioGroupInput,
|
|
2825
2863
|
{
|
|
2826
2864
|
label: "Number of columns",
|
|
@@ -2829,9 +2867,9 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2829
2867
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
|
|
2830
2868
|
}
|
|
2831
2869
|
},
|
|
2832
|
-
/* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
), /* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "2" }, "2"),
|
|
2871
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "3" }, "3")
|
|
2872
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2835
2873
|
ColumnWidthsInput,
|
|
2836
2874
|
{
|
|
2837
2875
|
defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
|
|
@@ -2839,11 +2877,11 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2839
2877
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
|
|
2840
2878
|
}
|
|
2841
2879
|
}
|
|
2842
|
-
), /* @__PURE__ */
|
|
2880
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2843
2881
|
SliderInput,
|
|
2844
2882
|
{
|
|
2845
2883
|
label: "Columns gap",
|
|
2846
|
-
iconLabel: /* @__PURE__ */
|
|
2884
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.SpaceBarOutlined, { sx: { color: "text.secondary" } }),
|
|
2847
2885
|
units: "px",
|
|
2848
2886
|
step: 4,
|
|
2849
2887
|
marks: true,
|
|
@@ -2852,7 +2890,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2852
2890
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
|
|
2853
2891
|
onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
|
|
2854
2892
|
}
|
|
2855
|
-
), /* @__PURE__ */
|
|
2893
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2856
2894
|
RadioGroupInput,
|
|
2857
2895
|
{
|
|
2858
2896
|
label: "Alignment",
|
|
@@ -2861,10 +2899,10 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2861
2899
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
|
|
2862
2900
|
}
|
|
2863
2901
|
},
|
|
2864
|
-
/* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
), /* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "top" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
2903
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "middle" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
2904
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "bottom" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
2905
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2868
2906
|
MultiStylePropertyPanel,
|
|
2869
2907
|
{
|
|
2870
2908
|
names: ["backgroundColor", "padding"],
|
|
@@ -2883,7 +2921,7 @@ var container_props_schema_default = ContainerPropsSchema3;
|
|
|
2883
2921
|
|
|
2884
2922
|
// src/app/inspector-drawer/configuration-panel/input-panels/container-sidebar-panel.tsx
|
|
2885
2923
|
function ContainerSidebarPanel({ data, setData }) {
|
|
2886
|
-
const [, setErrors] =
|
|
2924
|
+
const [, setErrors] = React60.useState(null);
|
|
2887
2925
|
const updateData = (d) => {
|
|
2888
2926
|
const res = container_props_schema_default.safeParse(d);
|
|
2889
2927
|
if (res.success) {
|
|
@@ -2893,7 +2931,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2893
2931
|
setErrors(res.error);
|
|
2894
2932
|
}
|
|
2895
2933
|
};
|
|
2896
|
-
return /* @__PURE__ */
|
|
2934
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
2897
2935
|
MultiStylePropertyPanel,
|
|
2898
2936
|
{
|
|
2899
2937
|
names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
|
|
@@ -2904,7 +2942,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2904
2942
|
}
|
|
2905
2943
|
function DividerSidebarPanel({ data, setData }) {
|
|
2906
2944
|
var _a, _b, _c, _d;
|
|
2907
|
-
const [, setErrors] =
|
|
2945
|
+
const [, setErrors] = React60.useState(null);
|
|
2908
2946
|
const updateData = (d) => {
|
|
2909
2947
|
const res = DividerPropsSchema.safeParse(d);
|
|
2910
2948
|
if (res.success) {
|
|
@@ -2916,18 +2954,18 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2916
2954
|
};
|
|
2917
2955
|
const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
|
|
2918
2956
|
const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
|
|
2919
|
-
return /* @__PURE__ */
|
|
2957
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
2920
2958
|
ColorInput2,
|
|
2921
2959
|
{
|
|
2922
2960
|
label: "Color",
|
|
2923
2961
|
defaultValue: lineColor,
|
|
2924
2962
|
onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
|
|
2925
2963
|
}
|
|
2926
|
-
), /* @__PURE__ */
|
|
2964
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2927
2965
|
SliderInput,
|
|
2928
2966
|
{
|
|
2929
2967
|
label: "Height",
|
|
2930
|
-
iconLabel: /* @__PURE__ */
|
|
2968
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
2931
2969
|
units: "px",
|
|
2932
2970
|
step: 1,
|
|
2933
2971
|
min: 1,
|
|
@@ -2935,7 +2973,7 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2935
2973
|
defaultValue: lineHeight,
|
|
2936
2974
|
onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
|
|
2937
2975
|
}
|
|
2938
|
-
), /* @__PURE__ */
|
|
2976
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2939
2977
|
MultiStylePropertyPanel,
|
|
2940
2978
|
{
|
|
2941
2979
|
names: ["backgroundColor", "padding"],
|
|
@@ -2956,21 +2994,50 @@ var FONT_FAMILY_SCHEMA7 = zod.z.enum([
|
|
|
2956
2994
|
"BOOK_SERIF",
|
|
2957
2995
|
"MONOSPACE"
|
|
2958
2996
|
]).nullable().optional();
|
|
2997
|
+
var TemplateVariableSchema2 = zod.z.object({
|
|
2998
|
+
name: zod.z.string(),
|
|
2999
|
+
description: zod.z.string().optional().nullable()
|
|
3000
|
+
});
|
|
2959
3001
|
var EmailLayoutPropsSchema2 = zod.z.object({
|
|
2960
3002
|
backdropColor: COLOR_SCHEMA10,
|
|
3003
|
+
backdropDisabled: zod.z.boolean().optional().nullable(),
|
|
2961
3004
|
borderColor: COLOR_SCHEMA10,
|
|
2962
3005
|
borderRadius: zod.z.number().optional().nullable(),
|
|
2963
3006
|
canvasColor: COLOR_SCHEMA10,
|
|
2964
3007
|
textColor: COLOR_SCHEMA10,
|
|
2965
3008
|
fontFamily: FONT_FAMILY_SCHEMA7,
|
|
2966
|
-
childrenIds: zod.z.array(zod.z.string()).optional().nullable()
|
|
3009
|
+
childrenIds: zod.z.array(zod.z.string()).optional().nullable(),
|
|
3010
|
+
subject: zod.z.string().optional().nullable(),
|
|
3011
|
+
variables: zod.z.array(TemplateVariableSchema2).optional().nullable()
|
|
2967
3012
|
});
|
|
2968
3013
|
var email_layout_props_schema_default = EmailLayoutPropsSchema2;
|
|
3014
|
+
function BooleanInput({ label, defaultValue, onChange }) {
|
|
3015
|
+
const [value, setValue] = React60.useState(defaultValue);
|
|
3016
|
+
React60.useEffect(() => {
|
|
3017
|
+
setValue(defaultValue);
|
|
3018
|
+
}, [defaultValue]);
|
|
3019
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
3020
|
+
material.FormControlLabel,
|
|
3021
|
+
{
|
|
3022
|
+
label,
|
|
3023
|
+
control: /* @__PURE__ */ React60__default.default.createElement(
|
|
3024
|
+
material.Switch,
|
|
3025
|
+
{
|
|
3026
|
+
checked: value,
|
|
3027
|
+
onChange: (_, checked) => {
|
|
3028
|
+
setValue(checked);
|
|
3029
|
+
onChange(checked);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
)
|
|
3033
|
+
}
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
2969
3036
|
|
|
2970
3037
|
// src/app/inspector-drawer/configuration-panel/input-panels/email-layout-sidebar-panel.tsx
|
|
2971
3038
|
function EmailLayoutSidebarFields({ data, setData }) {
|
|
2972
|
-
var _a, _b, _c, _d, _e;
|
|
2973
|
-
const [, setErrors] =
|
|
3039
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3040
|
+
const [, setErrors] = React60.useState(null);
|
|
2974
3041
|
const updateData = (d) => {
|
|
2975
3042
|
const res = email_layout_props_schema_default.safeParse(d);
|
|
2976
3043
|
if (res.success) {
|
|
@@ -2980,59 +3047,67 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
2980
3047
|
setErrors(res.error);
|
|
2981
3048
|
}
|
|
2982
3049
|
};
|
|
2983
|
-
|
|
3050
|
+
const backdropDisabled = (_a = data.backdropDisabled) != null ? _a : false;
|
|
3051
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3052
|
+
BooleanInput,
|
|
3053
|
+
{
|
|
3054
|
+
label: "Disable backdrop",
|
|
3055
|
+
defaultValue: backdropDisabled,
|
|
3056
|
+
onChange: (backdropDisabled2) => updateData(__spreadProps(__spreadValues({}, data), { backdropDisabled: backdropDisabled2 }))
|
|
3057
|
+
}
|
|
3058
|
+
), !backdropDisabled && /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
2984
3059
|
ColorInput2,
|
|
2985
3060
|
{
|
|
2986
3061
|
label: "Backdrop color",
|
|
2987
|
-
defaultValue: (
|
|
3062
|
+
defaultValue: (_b = data.backdropColor) != null ? _b : "#F5F5F5",
|
|
2988
3063
|
onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
|
|
2989
3064
|
}
|
|
2990
|
-
), /* @__PURE__ */
|
|
3065
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2991
3066
|
ColorInput2,
|
|
2992
3067
|
{
|
|
2993
3068
|
label: "Canvas color",
|
|
2994
|
-
defaultValue: (
|
|
3069
|
+
defaultValue: (_c = data.canvasColor) != null ? _c : "#FFFFFF",
|
|
2995
3070
|
onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
|
|
2996
3071
|
}
|
|
2997
|
-
), /* @__PURE__ */
|
|
3072
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
2998
3073
|
NullableColorInput,
|
|
2999
3074
|
{
|
|
3000
3075
|
label: "Canvas border color",
|
|
3001
|
-
defaultValue: (
|
|
3076
|
+
defaultValue: (_d = data.borderColor) != null ? _d : null,
|
|
3002
3077
|
onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
|
|
3003
3078
|
}
|
|
3004
|
-
), /* @__PURE__ */
|
|
3079
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3005
3080
|
SliderInput,
|
|
3006
3081
|
{
|
|
3007
|
-
iconLabel: /* @__PURE__ */
|
|
3082
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.RoundedCornerOutlined, null),
|
|
3008
3083
|
units: "px",
|
|
3009
3084
|
step: 4,
|
|
3010
3085
|
marks: true,
|
|
3011
3086
|
min: 0,
|
|
3012
3087
|
max: 48,
|
|
3013
3088
|
label: "Canvas border radius",
|
|
3014
|
-
defaultValue: (
|
|
3089
|
+
defaultValue: (_e = data.borderRadius) != null ? _e : 0,
|
|
3015
3090
|
onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
|
|
3016
3091
|
}
|
|
3017
|
-
), /* @__PURE__ */
|
|
3092
|
+
)), /* @__PURE__ */ React60__default.default.createElement(
|
|
3018
3093
|
NullableFontFamily,
|
|
3019
3094
|
{
|
|
3020
3095
|
label: "Font family",
|
|
3021
3096
|
defaultValue: "MODERN_SANS",
|
|
3022
3097
|
onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
|
|
3023
3098
|
}
|
|
3024
|
-
), /* @__PURE__ */
|
|
3099
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3025
3100
|
ColorInput2,
|
|
3026
3101
|
{
|
|
3027
3102
|
label: "Text color",
|
|
3028
|
-
defaultValue: (
|
|
3103
|
+
defaultValue: (_f = data.textColor) != null ? _f : "#262626",
|
|
3029
3104
|
onChange: (textColor) => updateData(__spreadProps(__spreadValues({}, data), { textColor }))
|
|
3030
3105
|
}
|
|
3031
3106
|
));
|
|
3032
3107
|
}
|
|
3033
3108
|
function HeadingSidebarPanel({ data, setData }) {
|
|
3034
3109
|
var _a, _b, _c, _d;
|
|
3035
|
-
const [, setErrors] =
|
|
3110
|
+
const [, setErrors] = React60.useState(null);
|
|
3036
3111
|
const updateData = (d) => {
|
|
3037
3112
|
const res = HeadingPropsSchema.safeParse(d);
|
|
3038
3113
|
if (res.success) {
|
|
@@ -3042,7 +3117,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3042
3117
|
setErrors(res.error);
|
|
3043
3118
|
}
|
|
3044
3119
|
};
|
|
3045
|
-
return /* @__PURE__ */
|
|
3120
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3046
3121
|
TextInput,
|
|
3047
3122
|
{
|
|
3048
3123
|
label: "Content",
|
|
@@ -3052,7 +3127,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3052
3127
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
|
|
3053
3128
|
}
|
|
3054
3129
|
}
|
|
3055
|
-
), /* @__PURE__ */
|
|
3130
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3056
3131
|
RadioGroupInput,
|
|
3057
3132
|
{
|
|
3058
3133
|
label: "Level",
|
|
@@ -3061,10 +3136,10 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3061
3136
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
|
|
3062
3137
|
}
|
|
3063
3138
|
},
|
|
3064
|
-
/* @__PURE__ */
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
), /* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "h1" }, "H1"),
|
|
3140
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "h2" }, "H2"),
|
|
3141
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "h3" }, "H3")
|
|
3142
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3068
3143
|
MultiStylePropertyPanel,
|
|
3069
3144
|
{
|
|
3070
3145
|
names: ["color", "backgroundColor", "fontFamily", "fontWeight", "textAlign", "padding"],
|
|
@@ -3075,7 +3150,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3075
3150
|
}
|
|
3076
3151
|
function HtmlSidebarPanel({ data, setData }) {
|
|
3077
3152
|
var _a, _b;
|
|
3078
|
-
const [, setErrors] =
|
|
3153
|
+
const [, setErrors] = React60.useState(null);
|
|
3079
3154
|
const updateData = (d) => {
|
|
3080
3155
|
const res = HtmlPropsSchema.safeParse(d);
|
|
3081
3156
|
if (res.success) {
|
|
@@ -3085,7 +3160,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3085
3160
|
setErrors(res.error);
|
|
3086
3161
|
}
|
|
3087
3162
|
};
|
|
3088
|
-
return /* @__PURE__ */
|
|
3163
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3089
3164
|
TextInput,
|
|
3090
3165
|
{
|
|
3091
3166
|
label: "Content",
|
|
@@ -3093,7 +3168,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3093
3168
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
|
|
3094
3169
|
onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
|
|
3095
3170
|
}
|
|
3096
|
-
), /* @__PURE__ */
|
|
3171
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3097
3172
|
MultiStylePropertyPanel,
|
|
3098
3173
|
{
|
|
3099
3174
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
|
|
@@ -3104,7 +3179,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3104
3179
|
}
|
|
3105
3180
|
function ImageSidebarPanel({ data, setData }) {
|
|
3106
3181
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3107
|
-
const [, setErrors] =
|
|
3182
|
+
const [, setErrors] = React60.useState(null);
|
|
3108
3183
|
const updateData = (d) => {
|
|
3109
3184
|
const res = ImagePropsSchema.safeParse(d);
|
|
3110
3185
|
if (res.success) {
|
|
@@ -3114,7 +3189,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3114
3189
|
setErrors(res.error);
|
|
3115
3190
|
}
|
|
3116
3191
|
};
|
|
3117
|
-
return /* @__PURE__ */
|
|
3192
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Image block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3118
3193
|
TextInput,
|
|
3119
3194
|
{
|
|
3120
3195
|
label: "Source URL",
|
|
@@ -3124,14 +3199,14 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3124
3199
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url }) }));
|
|
3125
3200
|
}
|
|
3126
3201
|
}
|
|
3127
|
-
), /* @__PURE__ */
|
|
3202
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3128
3203
|
TextInput,
|
|
3129
3204
|
{
|
|
3130
3205
|
label: "Alt text",
|
|
3131
3206
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
|
|
3132
3207
|
onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
|
|
3133
3208
|
}
|
|
3134
|
-
), /* @__PURE__ */
|
|
3209
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3135
3210
|
TextInput,
|
|
3136
3211
|
{
|
|
3137
3212
|
label: "Click through URL",
|
|
@@ -3141,31 +3216,31 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3141
3216
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
|
|
3142
3217
|
}
|
|
3143
3218
|
}
|
|
3144
|
-
), /* @__PURE__ */
|
|
3219
|
+
), /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3145
3220
|
TextDimensionInput,
|
|
3146
3221
|
{
|
|
3147
3222
|
label: "Width",
|
|
3148
3223
|
defaultValue: (_g = data.props) == null ? void 0 : _g.width,
|
|
3149
3224
|
onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
|
|
3150
3225
|
}
|
|
3151
|
-
), /* @__PURE__ */
|
|
3226
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3152
3227
|
TextDimensionInput,
|
|
3153
3228
|
{
|
|
3154
3229
|
label: "Height",
|
|
3155
3230
|
defaultValue: (_h = data.props) == null ? void 0 : _h.height,
|
|
3156
3231
|
onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
|
|
3157
3232
|
}
|
|
3158
|
-
)), /* @__PURE__ */
|
|
3233
|
+
)), /* @__PURE__ */ React60__default.default.createElement(
|
|
3159
3234
|
RadioGroupInput,
|
|
3160
3235
|
{
|
|
3161
3236
|
label: "Alignment",
|
|
3162
3237
|
defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
|
|
3163
3238
|
onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
|
|
3164
3239
|
},
|
|
3165
|
-
/* @__PURE__ */
|
|
3166
|
-
/* @__PURE__ */
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
), /* @__PURE__ */
|
|
3240
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "top" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3241
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "middle" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3242
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "bottom" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3243
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3169
3244
|
MultiStylePropertyPanel,
|
|
3170
3245
|
{
|
|
3171
3246
|
names: ["backgroundColor", "textAlign", "padding"],
|
|
@@ -3176,7 +3251,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3176
3251
|
}
|
|
3177
3252
|
function SignatureSidebarPanel({ data, setData }) {
|
|
3178
3253
|
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;
|
|
3179
|
-
const [, setErrors] =
|
|
3254
|
+
const [, setErrors] = React60.useState(null);
|
|
3180
3255
|
const updateData = (d) => {
|
|
3181
3256
|
const res = SignaturePropsSchema.safeParse(d);
|
|
3182
3257
|
if (res.success) {
|
|
@@ -3201,74 +3276,74 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3201
3276
|
const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
|
|
3202
3277
|
const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
|
|
3203
3278
|
const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
|
|
3204
|
-
return /* @__PURE__ */
|
|
3279
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3205
3280
|
TextInput,
|
|
3206
3281
|
{
|
|
3207
3282
|
label: "Greeting",
|
|
3208
3283
|
defaultValue: greeting,
|
|
3209
3284
|
onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
|
|
3210
3285
|
}
|
|
3211
|
-
), /* @__PURE__ */
|
|
3286
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3212
3287
|
TextInput,
|
|
3213
3288
|
{
|
|
3214
3289
|
label: "Name",
|
|
3215
3290
|
defaultValue: name,
|
|
3216
3291
|
onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
|
|
3217
3292
|
}
|
|
3218
|
-
), /* @__PURE__ */
|
|
3293
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3219
3294
|
TextInput,
|
|
3220
3295
|
{
|
|
3221
3296
|
label: "Title",
|
|
3222
3297
|
defaultValue: title,
|
|
3223
3298
|
onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
|
|
3224
3299
|
}
|
|
3225
|
-
), /* @__PURE__ */
|
|
3300
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3226
3301
|
TextInput,
|
|
3227
3302
|
{
|
|
3228
3303
|
label: "Company",
|
|
3229
3304
|
defaultValue: company,
|
|
3230
3305
|
onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
|
|
3231
3306
|
}
|
|
3232
|
-
), /* @__PURE__ */
|
|
3307
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3233
3308
|
TextInput,
|
|
3234
3309
|
{
|
|
3235
3310
|
label: "Address",
|
|
3236
3311
|
defaultValue: address,
|
|
3237
3312
|
onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
|
|
3238
3313
|
}
|
|
3239
|
-
), /* @__PURE__ */
|
|
3314
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3240
3315
|
TextInput,
|
|
3241
3316
|
{
|
|
3242
3317
|
label: "Email",
|
|
3243
3318
|
defaultValue: email,
|
|
3244
3319
|
onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
|
|
3245
3320
|
}
|
|
3246
|
-
), /* @__PURE__ */
|
|
3321
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3247
3322
|
TextInput,
|
|
3248
3323
|
{
|
|
3249
3324
|
label: "Phone",
|
|
3250
3325
|
defaultValue: phone,
|
|
3251
3326
|
onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
|
|
3252
3327
|
}
|
|
3253
|
-
), /* @__PURE__ */
|
|
3328
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3254
3329
|
TextInput,
|
|
3255
3330
|
{
|
|
3256
3331
|
label: "Website",
|
|
3257
3332
|
defaultValue: website,
|
|
3258
3333
|
onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
|
|
3259
3334
|
}
|
|
3260
|
-
), /* @__PURE__ */
|
|
3335
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3261
3336
|
TextInput,
|
|
3262
3337
|
{
|
|
3263
3338
|
label: "Image URL",
|
|
3264
3339
|
defaultValue: imageUrl,
|
|
3265
3340
|
onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
|
|
3266
3341
|
}
|
|
3267
|
-
), /* @__PURE__ */
|
|
3342
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3268
3343
|
SliderInput,
|
|
3269
3344
|
{
|
|
3270
3345
|
label: "Image size",
|
|
3271
|
-
iconLabel: /* @__PURE__ */
|
|
3346
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
3272
3347
|
units: "px",
|
|
3273
3348
|
step: 4,
|
|
3274
3349
|
min: 32,
|
|
@@ -3276,47 +3351,47 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3276
3351
|
defaultValue: imageSize,
|
|
3277
3352
|
onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
|
|
3278
3353
|
}
|
|
3279
|
-
), /* @__PURE__ */
|
|
3354
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3280
3355
|
RadioGroupInput,
|
|
3281
3356
|
{
|
|
3282
3357
|
label: "Image shape",
|
|
3283
3358
|
defaultValue: imageShape,
|
|
3284
3359
|
onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
|
|
3285
3360
|
},
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
), /* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "circle" }, "Circle"),
|
|
3362
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "square" }, "Square"),
|
|
3363
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded")
|
|
3364
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3290
3365
|
RadioGroupInput,
|
|
3291
3366
|
{
|
|
3292
3367
|
label: "Layout",
|
|
3293
3368
|
defaultValue: layout,
|
|
3294
3369
|
onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
|
|
3295
3370
|
},
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3298
|
-
), /* @__PURE__ */
|
|
3371
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "horizontal" }, "Horizontal"),
|
|
3372
|
+
/* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "vertical" }, "Vertical")
|
|
3373
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3299
3374
|
ColorInput2,
|
|
3300
3375
|
{
|
|
3301
3376
|
label: "Name color",
|
|
3302
3377
|
defaultValue: nameColor,
|
|
3303
3378
|
onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
|
|
3304
3379
|
}
|
|
3305
|
-
), /* @__PURE__ */
|
|
3380
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3306
3381
|
ColorInput2,
|
|
3307
3382
|
{
|
|
3308
3383
|
label: "Text color",
|
|
3309
3384
|
defaultValue: textColor,
|
|
3310
3385
|
onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
|
|
3311
3386
|
}
|
|
3312
|
-
), /* @__PURE__ */
|
|
3387
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3313
3388
|
ColorInput2,
|
|
3314
3389
|
{
|
|
3315
3390
|
label: "Link color",
|
|
3316
3391
|
defaultValue: linkColor,
|
|
3317
3392
|
onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
|
|
3318
3393
|
}
|
|
3319
|
-
), /* @__PURE__ */
|
|
3394
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3320
3395
|
MultiStylePropertyPanel,
|
|
3321
3396
|
{
|
|
3322
3397
|
names: ["backgroundColor", "fontFamily", "padding"],
|
|
@@ -3327,7 +3402,7 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3327
3402
|
}
|
|
3328
3403
|
function SpacerSidebarPanel({ data, setData }) {
|
|
3329
3404
|
var _a, _b;
|
|
3330
|
-
const [, setErrors] =
|
|
3405
|
+
const [, setErrors] = React60.useState(null);
|
|
3331
3406
|
const updateData = (d) => {
|
|
3332
3407
|
const res = SpacerPropsSchema.safeParse(d);
|
|
3333
3408
|
if (res.success) {
|
|
@@ -3337,11 +3412,11 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3337
3412
|
setErrors(res.error);
|
|
3338
3413
|
}
|
|
3339
3414
|
};
|
|
3340
|
-
return /* @__PURE__ */
|
|
3415
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3341
3416
|
SliderInput,
|
|
3342
3417
|
{
|
|
3343
3418
|
label: "Height",
|
|
3344
|
-
iconLabel: /* @__PURE__ */
|
|
3419
|
+
iconLabel: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
3345
3420
|
units: "px",
|
|
3346
3421
|
step: 4,
|
|
3347
3422
|
min: 4,
|
|
@@ -3351,33 +3426,9 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3351
3426
|
}
|
|
3352
3427
|
));
|
|
3353
3428
|
}
|
|
3354
|
-
function BooleanInput({ label, defaultValue, onChange }) {
|
|
3355
|
-
const [value, setValue] = React72.useState(defaultValue);
|
|
3356
|
-
React72.useEffect(() => {
|
|
3357
|
-
setValue(defaultValue);
|
|
3358
|
-
}, [defaultValue]);
|
|
3359
|
-
return /* @__PURE__ */ React72__default.default.createElement(
|
|
3360
|
-
material.FormControlLabel,
|
|
3361
|
-
{
|
|
3362
|
-
label,
|
|
3363
|
-
control: /* @__PURE__ */ React72__default.default.createElement(
|
|
3364
|
-
material.Switch,
|
|
3365
|
-
{
|
|
3366
|
-
checked: value,
|
|
3367
|
-
onChange: (_, checked) => {
|
|
3368
|
-
setValue(checked);
|
|
3369
|
-
onChange(checked);
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
)
|
|
3373
|
-
}
|
|
3374
|
-
);
|
|
3375
|
-
}
|
|
3376
|
-
|
|
3377
|
-
// src/app/inspector-drawer/configuration-panel/input-panels/text-sidebar-panel.tsx
|
|
3378
3429
|
function TextSidebarPanel({ data, setData }) {
|
|
3379
3430
|
var _a, _b, _c, _d;
|
|
3380
|
-
const [, setErrors] =
|
|
3431
|
+
const [, setErrors] = React60.useState(null);
|
|
3381
3432
|
const updateData = (d) => {
|
|
3382
3433
|
const res = TextPropsSchema.safeParse(d);
|
|
3383
3434
|
if (res.success) {
|
|
@@ -3387,7 +3438,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3387
3438
|
setErrors(res.error);
|
|
3388
3439
|
}
|
|
3389
3440
|
};
|
|
3390
|
-
return /* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3391
3442
|
TextInput,
|
|
3392
3443
|
{
|
|
3393
3444
|
label: "Content",
|
|
@@ -3395,14 +3446,14 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3395
3446
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
|
|
3396
3447
|
onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
|
|
3397
3448
|
}
|
|
3398
|
-
), /* @__PURE__ */
|
|
3449
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3399
3450
|
BooleanInput,
|
|
3400
3451
|
{
|
|
3401
3452
|
label: "Markdown",
|
|
3402
3453
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
|
|
3403
3454
|
onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
|
|
3404
3455
|
}
|
|
3405
|
-
), /* @__PURE__ */
|
|
3456
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3406
3457
|
MultiStylePropertyPanel,
|
|
3407
3458
|
{
|
|
3408
3459
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -3414,7 +3465,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3414
3465
|
|
|
3415
3466
|
// src/app/inspector-drawer/configuration-panel/index.tsx
|
|
3416
3467
|
function renderMessage(val) {
|
|
3417
|
-
return /* @__PURE__ */
|
|
3468
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { color: "text.secondary" }, val));
|
|
3418
3469
|
}
|
|
3419
3470
|
function ConfigurationPanel() {
|
|
3420
3471
|
const document2 = useDocument();
|
|
@@ -3430,55 +3481,55 @@ function ConfigurationPanel() {
|
|
|
3430
3481
|
const { data, type } = block;
|
|
3431
3482
|
switch (type) {
|
|
3432
3483
|
case "Avatar":
|
|
3433
|
-
return /* @__PURE__ */
|
|
3484
|
+
return /* @__PURE__ */ React60__default.default.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3434
3485
|
case "Button":
|
|
3435
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ React60__default.default.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3436
3487
|
case "ColumnsContainer":
|
|
3437
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ React60__default.default.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3438
3489
|
case "Container":
|
|
3439
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ React60__default.default.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3440
3491
|
case "Divider":
|
|
3441
|
-
return /* @__PURE__ */
|
|
3492
|
+
return /* @__PURE__ */ React60__default.default.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3442
3493
|
case "Heading":
|
|
3443
|
-
return /* @__PURE__ */
|
|
3494
|
+
return /* @__PURE__ */ React60__default.default.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3444
3495
|
case "Html":
|
|
3445
|
-
return /* @__PURE__ */
|
|
3496
|
+
return /* @__PURE__ */ React60__default.default.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3446
3497
|
case "Image":
|
|
3447
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ React60__default.default.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3448
3499
|
case "EmailLayout":
|
|
3449
|
-
return /* @__PURE__ */
|
|
3500
|
+
return /* @__PURE__ */ React60__default.default.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3450
3501
|
case "Spacer":
|
|
3451
|
-
return /* @__PURE__ */
|
|
3502
|
+
return /* @__PURE__ */ React60__default.default.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3452
3503
|
case "Signature":
|
|
3453
|
-
return /* @__PURE__ */
|
|
3504
|
+
return /* @__PURE__ */ React60__default.default.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3454
3505
|
case "Text":
|
|
3455
|
-
return /* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ React60__default.default.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3456
3507
|
default:
|
|
3457
|
-
return /* @__PURE__ */
|
|
3508
|
+
return /* @__PURE__ */ React60__default.default.createElement("pre", null, JSON.stringify(block, null, " "));
|
|
3458
3509
|
}
|
|
3459
3510
|
}
|
|
3460
3511
|
function StylesPanel() {
|
|
3461
3512
|
const block = useDocument().root;
|
|
3462
3513
|
if (!block) {
|
|
3463
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ React60__default.default.createElement("p", null, "Block not found");
|
|
3464
3515
|
}
|
|
3465
3516
|
const { data, type } = block;
|
|
3466
3517
|
if (type !== "EmailLayout") {
|
|
3467
3518
|
throw new Error('Expected "root" element to be of type EmailLayout');
|
|
3468
3519
|
}
|
|
3469
|
-
return /* @__PURE__ */
|
|
3520
|
+
return /* @__PURE__ */ React60__default.default.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
|
|
3470
3521
|
}
|
|
3471
3522
|
function TemplateDownloadButton() {
|
|
3472
3523
|
const doc = useDocument();
|
|
3473
|
-
const href =
|
|
3524
|
+
const href = React60.useMemo(() => {
|
|
3474
3525
|
return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
|
|
3475
3526
|
}, [doc]);
|
|
3476
|
-
return /* @__PURE__ */
|
|
3527
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
3477
3528
|
material.Button,
|
|
3478
3529
|
{
|
|
3479
3530
|
variant: "outlined",
|
|
3480
3531
|
color: "primary",
|
|
3481
|
-
startIcon: /* @__PURE__ */
|
|
3532
|
+
startIcon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FileDownloadOutlined, null),
|
|
3482
3533
|
href,
|
|
3483
3534
|
download: "emailTemplate.json",
|
|
3484
3535
|
fullWidth: true
|
|
@@ -3510,9 +3561,9 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3510
3561
|
}
|
|
3511
3562
|
};
|
|
3512
3563
|
if (!currentTemplateId) {
|
|
3513
|
-
return /* @__PURE__ */
|
|
3564
|
+
return /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected");
|
|
3514
3565
|
}
|
|
3515
|
-
return /* @__PURE__ */
|
|
3566
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React60__default.default.createElement(
|
|
3516
3567
|
material.Typography,
|
|
3517
3568
|
{
|
|
3518
3569
|
variant: "body2",
|
|
@@ -3525,29 +3576,110 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3525
3576
|
}
|
|
3526
3577
|
},
|
|
3527
3578
|
"Save functionality is disabled. To enable saving, provide the necessary callback functions."
|
|
3528
|
-
), persistenceEnabled && /* @__PURE__ */
|
|
3579
|
+
), persistenceEnabled && /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
3529
3580
|
material.Button,
|
|
3530
3581
|
{
|
|
3531
3582
|
variant: "outlined",
|
|
3532
3583
|
color: "primary",
|
|
3533
|
-
startIcon: /* @__PURE__ */
|
|
3584
|
+
startIcon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ContentCopyOutlined, null),
|
|
3534
3585
|
onClick: handleCopyToSamples,
|
|
3535
3586
|
fullWidth: true,
|
|
3536
3587
|
disabled: !copyTemplate
|
|
3537
3588
|
},
|
|
3538
3589
|
"Save as Sample Template"
|
|
3539
|
-
), /* @__PURE__ */
|
|
3590
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
3540
3591
|
material.Button,
|
|
3541
3592
|
{
|
|
3542
3593
|
variant: "outlined",
|
|
3543
3594
|
color: "error",
|
|
3544
|
-
startIcon: /* @__PURE__ */
|
|
3595
|
+
startIcon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.DeleteOutlined, null),
|
|
3545
3596
|
onClick: handleDelete,
|
|
3546
3597
|
fullWidth: true,
|
|
3547
3598
|
disabled: !deleteTemplate
|
|
3548
3599
|
},
|
|
3549
3600
|
"Delete Template"
|
|
3550
|
-
)))), persistenceEnabled && /* @__PURE__ */
|
|
3601
|
+
)))), persistenceEnabled && /* @__PURE__ */ React60__default.default.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 2 }, /* @__PURE__ */ React60__default.default.createElement(TemplateDownloadButton, null))));
|
|
3602
|
+
}
|
|
3603
|
+
var VARIABLE_NAME_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
3604
|
+
function validateName(name, index, all) {
|
|
3605
|
+
if (!name.trim()) return "Name is required";
|
|
3606
|
+
if (!VARIABLE_NAME_RE.test(name)) return "Use letters, digits, underscore; start with a letter or underscore";
|
|
3607
|
+
const duplicate = all.some((v, i) => i !== index && v.name === name);
|
|
3608
|
+
if (duplicate) return "Already declared";
|
|
3609
|
+
return null;
|
|
3610
|
+
}
|
|
3611
|
+
function VariablesPanel() {
|
|
3612
|
+
var _a;
|
|
3613
|
+
const document2 = useDocument();
|
|
3614
|
+
const root = document2.root;
|
|
3615
|
+
if (!root || root.type !== "EmailLayout") {
|
|
3616
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React60__default.default.createElement(material.Alert, { severity: "info" }, "Open a template to manage variables."));
|
|
3617
|
+
}
|
|
3618
|
+
const data = root.data;
|
|
3619
|
+
const variables = ((_a = data.variables) != null ? _a : []).map((v) => {
|
|
3620
|
+
var _a2;
|
|
3621
|
+
return {
|
|
3622
|
+
name: v.name,
|
|
3623
|
+
description: (_a2 = v.description) != null ? _a2 : ""
|
|
3624
|
+
};
|
|
3625
|
+
});
|
|
3626
|
+
const commit = (next) => {
|
|
3627
|
+
setDocument({
|
|
3628
|
+
root: __spreadProps(__spreadValues({}, root), {
|
|
3629
|
+
data: __spreadProps(__spreadValues({}, data), {
|
|
3630
|
+
variables: next.map((v) => ({
|
|
3631
|
+
name: v.name,
|
|
3632
|
+
description: v.description ? v.description : void 0
|
|
3633
|
+
}))
|
|
3634
|
+
})
|
|
3635
|
+
})
|
|
3636
|
+
});
|
|
3637
|
+
};
|
|
3638
|
+
const updateAt = (index, patch) => {
|
|
3639
|
+
const next = variables.map((v, i) => i === index ? __spreadValues(__spreadValues({}, v), patch) : v);
|
|
3640
|
+
commit(next);
|
|
3641
|
+
};
|
|
3642
|
+
const add = () => {
|
|
3643
|
+
commit([...variables, { name: "", description: "" }]);
|
|
3644
|
+
};
|
|
3645
|
+
const removeAt = (index) => {
|
|
3646
|
+
commit(variables.filter((_, i) => i !== index));
|
|
3647
|
+
};
|
|
3648
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { mb: 1 } }, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "subtitle1", sx: { fontWeight: 600 } }, "Variables"), /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Add variable" }, /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { size: "small", onClick: add, "aria-label": "Add variable" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })))), /* @__PURE__ */ React60__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__ */ React60__default.default.createElement(material.Box, { component: "code", sx: { fontFamily: "monospace" } }, "{{name}}"), "."), variables.length === 0 ? /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary" } }, "No variables declared. Click + to add one.") : /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 2 }, variables.map((v, i) => {
|
|
3649
|
+
var _a2;
|
|
3650
|
+
const nameError = validateName(v.name, i, variables);
|
|
3651
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { key: i, spacing: 0.75, sx: { pb: 1, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3652
|
+
material.TextField,
|
|
3653
|
+
{
|
|
3654
|
+
label: "Name",
|
|
3655
|
+
size: "small",
|
|
3656
|
+
fullWidth: true,
|
|
3657
|
+
value: v.name,
|
|
3658
|
+
onChange: (e) => updateAt(i, { name: e.target.value }),
|
|
3659
|
+
error: Boolean(nameError),
|
|
3660
|
+
helperText: nameError != null ? nameError : " "
|
|
3661
|
+
}
|
|
3662
|
+
), /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Remove" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3663
|
+
material.IconButton,
|
|
3664
|
+
{
|
|
3665
|
+
size: "small",
|
|
3666
|
+
onClick: () => removeAt(i),
|
|
3667
|
+
"aria-label": `Remove ${v.name || "variable"}`,
|
|
3668
|
+
sx: { mt: 0.5 }
|
|
3669
|
+
},
|
|
3670
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.DeleteOutline, { fontSize: "small" })
|
|
3671
|
+
))), /* @__PURE__ */ React60__default.default.createElement(
|
|
3672
|
+
material.TextField,
|
|
3673
|
+
{
|
|
3674
|
+
label: "Description",
|
|
3675
|
+
size: "small",
|
|
3676
|
+
fullWidth: true,
|
|
3677
|
+
value: (_a2 = v.description) != null ? _a2 : "",
|
|
3678
|
+
onChange: (e) => updateAt(i, { description: e.target.value }),
|
|
3679
|
+
placeholder: "Optional"
|
|
3680
|
+
}
|
|
3681
|
+
));
|
|
3682
|
+
})));
|
|
3551
3683
|
}
|
|
3552
3684
|
|
|
3553
3685
|
// src/app/inspector-drawer/index.tsx
|
|
@@ -3564,11 +3696,13 @@ function InspectorDrawer({
|
|
|
3564
3696
|
const renderCurrentSidebarPanel = () => {
|
|
3565
3697
|
switch (selectedSidebarTab) {
|
|
3566
3698
|
case "block-configuration":
|
|
3567
|
-
return /* @__PURE__ */
|
|
3699
|
+
return /* @__PURE__ */ React60__default.default.createElement(ConfigurationPanel, null);
|
|
3568
3700
|
case "styles":
|
|
3569
|
-
return /* @__PURE__ */
|
|
3701
|
+
return /* @__PURE__ */ React60__default.default.createElement(StylesPanel, null);
|
|
3702
|
+
case "variables":
|
|
3703
|
+
return /* @__PURE__ */ React60__default.default.createElement(VariablesPanel, null);
|
|
3570
3704
|
case "template-settings":
|
|
3571
|
-
return /* @__PURE__ */
|
|
3705
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
3572
3706
|
TemplatePanel,
|
|
3573
3707
|
{
|
|
3574
3708
|
deleteTemplate,
|
|
@@ -3577,7 +3711,7 @@ function InspectorDrawer({
|
|
|
3577
3711
|
);
|
|
3578
3712
|
}
|
|
3579
3713
|
};
|
|
3580
|
-
return /* @__PURE__ */
|
|
3714
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
3581
3715
|
material.Drawer,
|
|
3582
3716
|
{
|
|
3583
3717
|
variant: "persistent",
|
|
@@ -3599,236 +3733,820 @@ function InspectorDrawer({
|
|
|
3599
3733
|
width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
|
|
3600
3734
|
}
|
|
3601
3735
|
},
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
|
|
3736
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React60__default.default.createElement(material.Box, { px: 1 }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3737
|
+
material.Tabs,
|
|
3738
|
+
{
|
|
3739
|
+
value: selectedSidebarTab,
|
|
3740
|
+
onChange: (_, v) => setSidebarTab(v),
|
|
3741
|
+
variant: "fullWidth",
|
|
3742
|
+
sx: { "& .MuiTab-root": { minWidth: 0, px: 1, fontSize: 13 } }
|
|
3743
|
+
},
|
|
3744
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Tab, { value: "styles", label: "Styles" }),
|
|
3745
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Tab, { value: "block-configuration", label: "Inspect" }),
|
|
3746
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Tab, { value: "variables", label: "Variables" }),
|
|
3747
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Tab, { value: "template-settings", label: "Settings" })
|
|
3748
|
+
))),
|
|
3749
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
|
|
3604
3750
|
);
|
|
3605
3751
|
}
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3752
|
+
var SnackbarContext = React60.createContext(null);
|
|
3753
|
+
function useSnackbar() {
|
|
3754
|
+
const context = React60.useContext(SnackbarContext);
|
|
3755
|
+
if (!context) {
|
|
3756
|
+
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
3757
|
+
}
|
|
3758
|
+
return context;
|
|
3759
|
+
}
|
|
3760
|
+
function SnackbarProvider({ children }) {
|
|
3761
|
+
const [message, setMessage] = React60.useState(null);
|
|
3762
|
+
const [duration, setDuration] = React60.useState(3e3);
|
|
3763
|
+
const showMessage = (text, customDuration = 3e3) => {
|
|
3764
|
+
setMessage(text);
|
|
3765
|
+
setDuration(customDuration);
|
|
3766
|
+
};
|
|
3767
|
+
const handleClose = () => {
|
|
3768
|
+
setMessage(null);
|
|
3769
|
+
};
|
|
3770
|
+
return /* @__PURE__ */ React60__default.default.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React60__default.default.createElement(
|
|
3771
|
+
material.Snackbar,
|
|
3772
|
+
{
|
|
3773
|
+
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
3774
|
+
open: message !== null,
|
|
3775
|
+
onClose: handleClose,
|
|
3776
|
+
message,
|
|
3777
|
+
autoHideDuration: duration,
|
|
3778
|
+
sx: {
|
|
3779
|
+
zIndex: 1e4,
|
|
3780
|
+
// Very high z-index
|
|
3781
|
+
position: "fixed"
|
|
3782
|
+
// Make sure it's fixed positioned
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
));
|
|
3786
|
+
}
|
|
3787
|
+
function relativeTime(iso) {
|
|
3788
|
+
if (!iso) return null;
|
|
3789
|
+
const date = new Date(iso).getTime();
|
|
3790
|
+
if (Number.isNaN(date)) return null;
|
|
3791
|
+
const diffMs = Date.now() - date;
|
|
3792
|
+
const diffSec = Math.round(diffMs / 1e3);
|
|
3793
|
+
if (diffSec < 60) return "just now";
|
|
3794
|
+
const diffMin = Math.round(diffSec / 60);
|
|
3795
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
3796
|
+
const diffHr = Math.round(diffMin / 60);
|
|
3797
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
3798
|
+
const diffDay = Math.round(diffHr / 24);
|
|
3799
|
+
if (diffDay < 30) return `${diffDay}d ago`;
|
|
3800
|
+
const diffMo = Math.round(diffDay / 30);
|
|
3801
|
+
if (diffMo < 12) return `${diffMo}mo ago`;
|
|
3802
|
+
const diffYr = Math.round(diffMo / 12);
|
|
3803
|
+
return `${diffYr}y ago`;
|
|
3804
|
+
}
|
|
3805
|
+
function TemplateRow({
|
|
3806
|
+
template,
|
|
3807
|
+
isCurrent,
|
|
3609
3808
|
templateLoader,
|
|
3610
|
-
|
|
3809
|
+
onDuplicate,
|
|
3810
|
+
onRename,
|
|
3811
|
+
onDelete,
|
|
3812
|
+
onPromote,
|
|
3813
|
+
onDemote,
|
|
3814
|
+
onDuplicateAsTemplate
|
|
3611
3815
|
}) {
|
|
3612
3816
|
const { setCurrentTemplate } = useEmailEditor();
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3817
|
+
const [hover, setHover] = React60.useState(false);
|
|
3818
|
+
const handleClick = () => __async(null, null, function* () {
|
|
3615
3819
|
try {
|
|
3616
|
-
const
|
|
3617
|
-
if (
|
|
3618
|
-
resetDocument(
|
|
3619
|
-
setCurrentTemplate(
|
|
3820
|
+
const content = yield templateLoader();
|
|
3821
|
+
if (content) {
|
|
3822
|
+
resetDocument(content);
|
|
3823
|
+
setCurrentTemplate(template.id, template.slug, template.kind);
|
|
3620
3824
|
}
|
|
3621
3825
|
} catch (error) {
|
|
3622
3826
|
console.error("Error loading template:", error);
|
|
3623
3827
|
}
|
|
3624
3828
|
});
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
canvasColor: "#FFFFFF",
|
|
3635
|
-
textColor: "#262626",
|
|
3636
|
-
fontFamily: "MODERN_SANS",
|
|
3637
|
-
childrenIds: []
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3640
|
-
};
|
|
3641
|
-
var empty_email_message_default = EMPTY_EMAIL_MESSAGE;
|
|
3642
|
-
|
|
3643
|
-
// src/app/templates-drawer/index.tsx
|
|
3644
|
-
var SAMPLES_DRAWER_WIDTH = 240;
|
|
3645
|
-
var EMPTY_TEMPLATE = {
|
|
3646
|
-
id: "empty-email",
|
|
3647
|
-
name: "Empty email",
|
|
3648
|
-
description: "A blank email template to start from scratch"
|
|
3649
|
-
};
|
|
3650
|
-
function SamplesDrawer({
|
|
3651
|
-
enterDuration = 225,
|
|
3652
|
-
exitDuration = 225,
|
|
3653
|
-
enabled = true,
|
|
3654
|
-
loadSamples,
|
|
3655
|
-
loadTemplates,
|
|
3656
|
-
loadTemplate,
|
|
3657
|
-
currentTemplateId,
|
|
3658
|
-
deleteTemplate
|
|
3659
|
-
}) {
|
|
3660
|
-
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
3661
|
-
const [samples, setSamples] = React72.useState([EMPTY_TEMPLATE]);
|
|
3662
|
-
const [templates, setTemplates] = React72.useState([]);
|
|
3663
|
-
const [loadingSamples, setLoadingSamples] = React72.useState(false);
|
|
3664
|
-
const [loadingTemplates, setLoadingTemplates] = React72.useState(false);
|
|
3665
|
-
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
3666
|
-
if (templateId === "empty-email") {
|
|
3667
|
-
return empty_email_message_default;
|
|
3668
|
-
}
|
|
3669
|
-
if (loadTemplate) {
|
|
3670
|
-
return loadTemplate(templateId);
|
|
3671
|
-
}
|
|
3672
|
-
return null;
|
|
3673
|
-
});
|
|
3674
|
-
React72.useEffect(() => {
|
|
3675
|
-
if (enabled && samplesDrawerOpen && loadSamples) {
|
|
3676
|
-
setLoadingSamples(true);
|
|
3677
|
-
loadSamples().then((results) => {
|
|
3678
|
-
const existingEmptyTemplate = results.find((sample) => sample.id === "empty-email");
|
|
3679
|
-
if (!existingEmptyTemplate) {
|
|
3680
|
-
setSamples([EMPTY_TEMPLATE, ...results]);
|
|
3681
|
-
} else {
|
|
3682
|
-
setSamples(results);
|
|
3683
|
-
}
|
|
3684
|
-
setLoadingSamples(false);
|
|
3685
|
-
}).catch((error) => {
|
|
3686
|
-
console.error("Failed to load samples:", error);
|
|
3687
|
-
setSamples([EMPTY_TEMPLATE]);
|
|
3688
|
-
setLoadingSamples(false);
|
|
3689
|
-
});
|
|
3690
|
-
}
|
|
3691
|
-
}, [enabled, samplesDrawerOpen, loadSamples]);
|
|
3692
|
-
React72.useEffect(() => {
|
|
3693
|
-
if (enabled && loadTemplates) {
|
|
3694
|
-
setLoadingTemplates(true);
|
|
3695
|
-
loadTemplates().then((results) => {
|
|
3696
|
-
setTemplates(results);
|
|
3697
|
-
setLoadingTemplates(false);
|
|
3698
|
-
}).catch((error) => {
|
|
3699
|
-
console.error("Failed to load templates:", error);
|
|
3700
|
-
setLoadingTemplates(false);
|
|
3701
|
-
});
|
|
3702
|
-
}
|
|
3703
|
-
}, [enabled, loadTemplates]);
|
|
3704
|
-
React72.useEffect(() => {
|
|
3705
|
-
const handleTemplateListUpdate = (e) => {
|
|
3706
|
-
setTemplates(e.detail);
|
|
3707
|
-
};
|
|
3708
|
-
window.addEventListener("templateListUpdated", handleTemplateListUpdate);
|
|
3709
|
-
return () => window.removeEventListener("templateListUpdated", handleTemplateListUpdate);
|
|
3710
|
-
}, []);
|
|
3711
|
-
if (!enabled) {
|
|
3712
|
-
return null;
|
|
3713
|
-
}
|
|
3714
|
-
return /* @__PURE__ */ React72__default.default.createElement(React72__default.default.Fragment, null, /* @__PURE__ */ React72__default.default.createElement(
|
|
3715
|
-
material.Drawer,
|
|
3829
|
+
const stop = (e) => {
|
|
3830
|
+
e.stopPropagation();
|
|
3831
|
+
};
|
|
3832
|
+
const updated = relativeTime(template.updatedAt);
|
|
3833
|
+
const hasActions = Boolean(
|
|
3834
|
+
onDuplicate || onRename || onDelete || onPromote || onDemote || onDuplicateAsTemplate
|
|
3835
|
+
);
|
|
3836
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
3837
|
+
material.Box,
|
|
3716
3838
|
{
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
style: { position: "absolute" },
|
|
3726
|
-
keepMounted: true
|
|
3727
|
-
},
|
|
3728
|
-
transitionDuration: {
|
|
3729
|
-
enter: enterDuration,
|
|
3730
|
-
exit: exitDuration
|
|
3839
|
+
role: "button",
|
|
3840
|
+
tabIndex: 0,
|
|
3841
|
+
onClick: handleClick,
|
|
3842
|
+
onKeyDown: (e) => {
|
|
3843
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3844
|
+
e.preventDefault();
|
|
3845
|
+
handleClick();
|
|
3846
|
+
}
|
|
3731
3847
|
},
|
|
3848
|
+
onMouseEnter: () => setHover(true),
|
|
3849
|
+
onMouseLeave: () => setHover(false),
|
|
3732
3850
|
sx: {
|
|
3733
|
-
|
|
3851
|
+
position: "relative",
|
|
3852
|
+
width: "100%",
|
|
3853
|
+
px: 1.5,
|
|
3854
|
+
py: 1,
|
|
3855
|
+
borderRadius: 1,
|
|
3856
|
+
cursor: "pointer",
|
|
3857
|
+
bgcolor: isCurrent ? "rgba(0, 0, 0, 0.08)" : "transparent",
|
|
3858
|
+
"&:hover": { bgcolor: "rgba(0, 0, 0, 0.04)" },
|
|
3859
|
+
"&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
|
|
3734
3860
|
}
|
|
3735
3861
|
},
|
|
3736
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", alignItems: "flex-start", spacing: 1 }, /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", alignItems: "baseline", spacing: 1, sx: { minWidth: 0 } }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3863
|
+
material.Typography,
|
|
3864
|
+
{
|
|
3865
|
+
variant: "body2",
|
|
3866
|
+
sx: {
|
|
3867
|
+
fontWeight: 600,
|
|
3868
|
+
flexGrow: 1,
|
|
3869
|
+
overflow: "hidden",
|
|
3870
|
+
textOverflow: "ellipsis",
|
|
3871
|
+
whiteSpace: "nowrap"
|
|
3872
|
+
},
|
|
3873
|
+
title: template.slug
|
|
3874
|
+
},
|
|
3875
|
+
template.slug
|
|
3876
|
+
), updated && /* @__PURE__ */ React60__default.default.createElement(
|
|
3877
|
+
material.Typography,
|
|
3878
|
+
{
|
|
3879
|
+
variant: "caption",
|
|
3880
|
+
sx: { color: "text.secondary", flexShrink: 0, fontSize: "0.7rem" }
|
|
3881
|
+
},
|
|
3882
|
+
updated
|
|
3883
|
+
)), template.description && /* @__PURE__ */ React60__default.default.createElement(
|
|
3884
|
+
material.Typography,
|
|
3885
|
+
{
|
|
3886
|
+
variant: "caption",
|
|
3887
|
+
sx: {
|
|
3888
|
+
color: "text.secondary",
|
|
3889
|
+
display: "-webkit-box",
|
|
3890
|
+
WebkitLineClamp: 2,
|
|
3891
|
+
WebkitBoxOrient: "vertical",
|
|
3892
|
+
overflow: "hidden",
|
|
3893
|
+
lineHeight: 1.3
|
|
3894
|
+
}
|
|
3895
|
+
},
|
|
3896
|
+
template.description
|
|
3897
|
+
), template.tags && template.tags.length > 0 && /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { mt: 0.5, flexWrap: "wrap", gap: 0.5 } }, template.tags.map((tag) => /* @__PURE__ */ React60__default.default.createElement(
|
|
3898
|
+
material.Chip,
|
|
3899
|
+
{
|
|
3900
|
+
key: tag,
|
|
3901
|
+
label: tag,
|
|
3902
|
+
size: "small",
|
|
3903
|
+
sx: { height: 18, fontSize: "0.65rem", "& .MuiChip-label": { px: 0.75 } }
|
|
3904
|
+
}
|
|
3905
|
+
))))),
|
|
3906
|
+
hasActions && hover && /* @__PURE__ */ React60__default.default.createElement(
|
|
3737
3907
|
material.Stack,
|
|
3738
3908
|
{
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3909
|
+
direction: "row",
|
|
3910
|
+
spacing: 0.25,
|
|
3911
|
+
onClick: stop,
|
|
3912
|
+
sx: {
|
|
3913
|
+
position: "absolute",
|
|
3914
|
+
top: 4,
|
|
3915
|
+
right: 4,
|
|
3916
|
+
bgcolor: "background.paper",
|
|
3917
|
+
borderRadius: 1,
|
|
3918
|
+
boxShadow: 1,
|
|
3919
|
+
p: 0.25
|
|
3920
|
+
}
|
|
3745
3921
|
},
|
|
3746
|
-
/* @__PURE__ */
|
|
3747
|
-
material.
|
|
3922
|
+
onDuplicateAsTemplate && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Duplicate as template" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3923
|
+
material.IconButton,
|
|
3748
3924
|
{
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
justifyContent: "flex-start"
|
|
3754
|
-
}
|
|
3925
|
+
size: "small",
|
|
3926
|
+
onClick: (e) => {
|
|
3927
|
+
stop(e);
|
|
3928
|
+
onDuplicateAsTemplate();
|
|
3755
3929
|
}
|
|
3756
3930
|
},
|
|
3757
|
-
/* @__PURE__ */
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
))))
|
|
3815
|
-
)
|
|
3931
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.LibraryAddOutlined, { fontSize: "small" })
|
|
3932
|
+
)),
|
|
3933
|
+
onDuplicate && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Duplicate" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3934
|
+
material.IconButton,
|
|
3935
|
+
{
|
|
3936
|
+
size: "small",
|
|
3937
|
+
onClick: (e) => {
|
|
3938
|
+
stop(e);
|
|
3939
|
+
onDuplicate();
|
|
3940
|
+
}
|
|
3941
|
+
},
|
|
3942
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" })
|
|
3943
|
+
)),
|
|
3944
|
+
onRename && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Rename" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3945
|
+
material.IconButton,
|
|
3946
|
+
{
|
|
3947
|
+
size: "small",
|
|
3948
|
+
onClick: (e) => {
|
|
3949
|
+
stop(e);
|
|
3950
|
+
onRename();
|
|
3951
|
+
}
|
|
3952
|
+
},
|
|
3953
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.DriveFileRenameOutlineOutlined, { fontSize: "small" })
|
|
3954
|
+
)),
|
|
3955
|
+
onPromote && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Promote to sample" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3956
|
+
material.IconButton,
|
|
3957
|
+
{
|
|
3958
|
+
size: "small",
|
|
3959
|
+
onClick: (e) => {
|
|
3960
|
+
stop(e);
|
|
3961
|
+
onPromote();
|
|
3962
|
+
}
|
|
3963
|
+
},
|
|
3964
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FileUploadOutlined, { fontSize: "small" })
|
|
3965
|
+
)),
|
|
3966
|
+
onDemote && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Demote to template" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3967
|
+
material.IconButton,
|
|
3968
|
+
{
|
|
3969
|
+
size: "small",
|
|
3970
|
+
onClick: (e) => {
|
|
3971
|
+
stop(e);
|
|
3972
|
+
onDemote();
|
|
3973
|
+
}
|
|
3974
|
+
},
|
|
3975
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FileDownloadOutlined, { fontSize: "small" })
|
|
3976
|
+
)),
|
|
3977
|
+
onDelete && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Delete" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
3978
|
+
material.IconButton,
|
|
3979
|
+
{
|
|
3980
|
+
size: "small",
|
|
3981
|
+
onClick: (e) => {
|
|
3982
|
+
stop(e);
|
|
3983
|
+
onDelete();
|
|
3984
|
+
}
|
|
3985
|
+
},
|
|
3986
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.DeleteOutlined, { fontSize: "small" })
|
|
3987
|
+
))
|
|
3816
3988
|
)
|
|
3817
|
-
)
|
|
3989
|
+
);
|
|
3818
3990
|
}
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3991
|
+
function RenameDialog({
|
|
3992
|
+
open,
|
|
3993
|
+
currentSlug,
|
|
3994
|
+
existingSlugs,
|
|
3995
|
+
onClose,
|
|
3996
|
+
onSubmit
|
|
3997
|
+
}) {
|
|
3998
|
+
const [value, setValue] = React60.useState(currentSlug);
|
|
3999
|
+
const [error, setError] = React60.useState(null);
|
|
4000
|
+
const [submitting, setSubmitting] = React60.useState(false);
|
|
4001
|
+
React60.useEffect(() => {
|
|
4002
|
+
if (open) {
|
|
4003
|
+
setValue(currentSlug);
|
|
4004
|
+
setError(null);
|
|
4005
|
+
setSubmitting(false);
|
|
4006
|
+
}
|
|
4007
|
+
}, [open, currentSlug]);
|
|
4008
|
+
const handleChange = (e) => {
|
|
4009
|
+
setValue(e.target.value);
|
|
4010
|
+
setError(null);
|
|
4011
|
+
};
|
|
4012
|
+
const handleSubmit = () => __async(null, null, function* () {
|
|
4013
|
+
const trimmed = value.trim();
|
|
4014
|
+
if (!trimmed) {
|
|
4015
|
+
setError("Please enter a name");
|
|
4016
|
+
return;
|
|
4017
|
+
}
|
|
4018
|
+
if (trimmed === currentSlug) {
|
|
4019
|
+
onClose();
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
if (existingSlugs.some((s) => s.toLowerCase() === trimmed.toLowerCase())) {
|
|
4023
|
+
setError("A template with this name already exists");
|
|
4024
|
+
return;
|
|
4025
|
+
}
|
|
4026
|
+
setSubmitting(true);
|
|
4027
|
+
try {
|
|
4028
|
+
yield onSubmit(trimmed);
|
|
4029
|
+
onClose();
|
|
4030
|
+
} catch (e) {
|
|
4031
|
+
console.error("Error renaming template:", e);
|
|
4032
|
+
setError("Failed to rename template");
|
|
4033
|
+
} finally {
|
|
4034
|
+
setSubmitting(false);
|
|
4035
|
+
}
|
|
4036
|
+
});
|
|
4037
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Dialog, { open, onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React60__default.default.createElement(material.DialogTitle, null, "Rename template"), /* @__PURE__ */ React60__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
4038
|
+
material.TextField,
|
|
4039
|
+
{
|
|
4040
|
+
autoFocus: true,
|
|
4041
|
+
margin: "dense",
|
|
4042
|
+
label: "Slug",
|
|
4043
|
+
fullWidth: true,
|
|
4044
|
+
variant: "outlined",
|
|
4045
|
+
value,
|
|
4046
|
+
onChange: handleChange,
|
|
4047
|
+
error: !!error,
|
|
4048
|
+
helperText: error,
|
|
4049
|
+
disabled: submitting,
|
|
4050
|
+
onKeyPress: (e) => {
|
|
4051
|
+
if (e.key === "Enter" && !submitting) {
|
|
4052
|
+
handleSubmit();
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
)), /* @__PURE__ */ React60__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React60__default.default.createElement(material.Button, { onClick: onClose, disabled: submitting }, "Cancel"), /* @__PURE__ */ React60__default.default.createElement(
|
|
4057
|
+
material.Button,
|
|
4058
|
+
{
|
|
4059
|
+
onClick: handleSubmit,
|
|
4060
|
+
variant: "contained",
|
|
4061
|
+
disabled: !value.trim() || submitting
|
|
4062
|
+
},
|
|
4063
|
+
submitting ? "Renaming..." : "Rename"
|
|
4064
|
+
)));
|
|
4065
|
+
}
|
|
4066
|
+
function SaveTemplateDialog({
|
|
4067
|
+
open,
|
|
4068
|
+
onClose,
|
|
4069
|
+
onSave,
|
|
4070
|
+
onNameChange,
|
|
4071
|
+
defaultName = "",
|
|
4072
|
+
error: externalError = null
|
|
4073
|
+
}) {
|
|
4074
|
+
const [templateName, setTemplateName] = React60.useState(defaultName);
|
|
4075
|
+
const [internalError, setInternalError] = React60.useState("");
|
|
4076
|
+
const [isSubmitting, setIsSubmitting] = React60.useState(false);
|
|
4077
|
+
React60.useEffect(() => {
|
|
4078
|
+
if (open) {
|
|
4079
|
+
setTemplateName(defaultName);
|
|
4080
|
+
setInternalError("");
|
|
4081
|
+
setIsSubmitting(false);
|
|
4082
|
+
}
|
|
4083
|
+
}, [open, defaultName]);
|
|
4084
|
+
const displayError = externalError || internalError;
|
|
4085
|
+
const handleNameChange = (e) => {
|
|
4086
|
+
setTemplateName(e.target.value);
|
|
4087
|
+
if (e.target.value.trim()) {
|
|
4088
|
+
setInternalError("");
|
|
4089
|
+
}
|
|
4090
|
+
if (onNameChange) {
|
|
4091
|
+
onNameChange();
|
|
4092
|
+
}
|
|
4093
|
+
};
|
|
4094
|
+
const handleSave = () => __async(null, null, function* () {
|
|
4095
|
+
if (!templateName.trim()) {
|
|
4096
|
+
setInternalError("Please enter a template name");
|
|
4097
|
+
return;
|
|
4098
|
+
}
|
|
4099
|
+
setIsSubmitting(true);
|
|
4100
|
+
try {
|
|
4101
|
+
const result = onSave(templateName);
|
|
4102
|
+
if (result instanceof Promise) {
|
|
4103
|
+
const success = yield result;
|
|
4104
|
+
if (success) {
|
|
4105
|
+
setTemplateName("");
|
|
4106
|
+
setInternalError("");
|
|
4107
|
+
onClose();
|
|
4108
|
+
}
|
|
4109
|
+
} else if (result !== false) {
|
|
4110
|
+
setTemplateName("");
|
|
4111
|
+
setInternalError("");
|
|
4112
|
+
onClose();
|
|
4113
|
+
}
|
|
4114
|
+
} catch (error) {
|
|
4115
|
+
console.error("Error saving template:", error);
|
|
4116
|
+
} finally {
|
|
4117
|
+
setIsSubmitting(false);
|
|
4118
|
+
}
|
|
4119
|
+
});
|
|
4120
|
+
const handleCancel = () => {
|
|
4121
|
+
setTemplateName("");
|
|
4122
|
+
setInternalError("");
|
|
4123
|
+
onClose();
|
|
4124
|
+
};
|
|
4125
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4126
|
+
material.Dialog,
|
|
4127
|
+
{
|
|
4128
|
+
open,
|
|
4129
|
+
onClose: handleCancel,
|
|
4130
|
+
maxWidth: "sm",
|
|
4131
|
+
fullWidth: true
|
|
4132
|
+
},
|
|
4133
|
+
/* @__PURE__ */ React60__default.default.createElement(material.DialogTitle, null, "Save Email Template"),
|
|
4134
|
+
/* @__PURE__ */ React60__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { pt: 1 } }, /* @__PURE__ */ React60__default.default.createElement(
|
|
4135
|
+
material.TextField,
|
|
4136
|
+
{
|
|
4137
|
+
autoFocus: true,
|
|
4138
|
+
margin: "dense",
|
|
4139
|
+
id: "template-name",
|
|
4140
|
+
label: "Template Name",
|
|
4141
|
+
type: "text",
|
|
4142
|
+
fullWidth: true,
|
|
4143
|
+
variant: "outlined",
|
|
4144
|
+
value: templateName,
|
|
4145
|
+
onChange: handleNameChange,
|
|
4146
|
+
error: !!displayError,
|
|
4147
|
+
helperText: displayError,
|
|
4148
|
+
onKeyPress: (e) => {
|
|
4149
|
+
if (e.key === "Enter" && templateName.trim() && !displayError && !isSubmitting) {
|
|
4150
|
+
handleSave();
|
|
4151
|
+
}
|
|
4152
|
+
},
|
|
4153
|
+
disabled: isSubmitting
|
|
4154
|
+
}
|
|
4155
|
+
))),
|
|
4156
|
+
/* @__PURE__ */ React60__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React60__default.default.createElement(material.Button, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React60__default.default.createElement(
|
|
4157
|
+
material.Button,
|
|
4158
|
+
{
|
|
4159
|
+
onClick: handleSave,
|
|
4160
|
+
variant: "contained",
|
|
4161
|
+
color: "primary",
|
|
4162
|
+
disabled: !templateName.trim() || !!displayError || isSubmitting
|
|
4163
|
+
},
|
|
4164
|
+
isSubmitting ? "Saving..." : "Save Template"
|
|
4165
|
+
))
|
|
4166
|
+
);
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4169
|
+
// sample-templates/empty-email-message.ts
|
|
4170
|
+
var EMPTY_EMAIL_MESSAGE = {
|
|
4171
|
+
root: {
|
|
4172
|
+
type: "EmailLayout",
|
|
4173
|
+
data: {
|
|
4174
|
+
backdropColor: "#F5F5F5",
|
|
4175
|
+
canvasColor: "#FFFFFF",
|
|
4176
|
+
textColor: "#262626",
|
|
4177
|
+
fontFamily: "MODERN_SANS",
|
|
4178
|
+
childrenIds: []
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
};
|
|
4182
|
+
var empty_email_message_default = EMPTY_EMAIL_MESSAGE;
|
|
4183
|
+
|
|
4184
|
+
// src/app/templates-drawer/index.tsx
|
|
4185
|
+
var SAMPLES_DRAWER_WIDTH = 320;
|
|
4186
|
+
var EMPTY_TEMPLATE = {
|
|
4187
|
+
id: "empty-email",
|
|
4188
|
+
slug: "Empty email",
|
|
4189
|
+
kind: "sample",
|
|
4190
|
+
description: "A blank email template to start from scratch"
|
|
4191
|
+
};
|
|
4192
|
+
var SORT_OPTIONS = [
|
|
4193
|
+
{ value: "updatedAt", label: "Last updated" },
|
|
4194
|
+
{ value: "createdAt", label: "Recently created" },
|
|
4195
|
+
{ value: "slug", label: "Name (A\u2013Z)" }
|
|
4196
|
+
];
|
|
4197
|
+
function compareTemplates(a, b, key) {
|
|
4198
|
+
if (key === "slug") {
|
|
4199
|
+
return a.slug.localeCompare(b.slug);
|
|
4200
|
+
}
|
|
4201
|
+
const av = a[key];
|
|
4202
|
+
const bv = b[key];
|
|
4203
|
+
if (!av && !bv) return 0;
|
|
4204
|
+
if (!av) return 1;
|
|
4205
|
+
if (!bv) return -1;
|
|
4206
|
+
return new Date(bv).getTime() - new Date(av).getTime();
|
|
4207
|
+
}
|
|
4208
|
+
function SamplesDrawer({
|
|
4209
|
+
enterDuration = 225,
|
|
4210
|
+
exitDuration = 225,
|
|
4211
|
+
enabled = true,
|
|
4212
|
+
loadSamples,
|
|
4213
|
+
loadTemplates,
|
|
4214
|
+
loadTemplate,
|
|
4215
|
+
currentTemplateId,
|
|
4216
|
+
deleteTemplate,
|
|
4217
|
+
copyTemplate,
|
|
4218
|
+
renameTemplate,
|
|
4219
|
+
setTemplateKind,
|
|
4220
|
+
saveAs
|
|
4221
|
+
}) {
|
|
4222
|
+
var _a;
|
|
4223
|
+
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
4224
|
+
const { setCurrentTemplate, loadTemplate: ctxLoadTemplate } = useEmailEditor();
|
|
4225
|
+
const { showMessage } = useSnackbar();
|
|
4226
|
+
const [samples, setSamples] = React60.useState([EMPTY_TEMPLATE]);
|
|
4227
|
+
const [templates, setTemplates] = React60.useState([]);
|
|
4228
|
+
const [loadingSamples, setLoadingSamples] = React60.useState(false);
|
|
4229
|
+
const [loadingTemplates, setLoadingTemplates] = React60.useState(false);
|
|
4230
|
+
const [templatesError, setTemplatesError] = React60.useState(null);
|
|
4231
|
+
const [search, setSearch] = React60.useState("");
|
|
4232
|
+
const [sortKey, setSortKey] = React60.useState("updatedAt");
|
|
4233
|
+
const [activeTags, setActiveTags] = React60.useState([]);
|
|
4234
|
+
const [renameTarget, setRenameTarget] = React60.useState(null);
|
|
4235
|
+
const [pendingSaveAs, setPendingSaveAs] = React60.useState(null);
|
|
4236
|
+
const [newError, setNewError] = React60.useState(null);
|
|
4237
|
+
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
4238
|
+
if (templateId === "empty-email") {
|
|
4239
|
+
return empty_email_message_default;
|
|
4240
|
+
}
|
|
4241
|
+
if (loadTemplate) {
|
|
4242
|
+
return loadTemplate(templateId);
|
|
4243
|
+
}
|
|
4244
|
+
return null;
|
|
4245
|
+
});
|
|
4246
|
+
const withKind = (items, fallback) => items.map((item) => item.kind ? item : __spreadProps(__spreadValues({}, item), { kind: fallback }));
|
|
4247
|
+
React60.useEffect(() => {
|
|
4248
|
+
if (!enabled || !samplesDrawerOpen || !loadSamples) return;
|
|
4249
|
+
setLoadingSamples(true);
|
|
4250
|
+
loadSamples().then((results) => {
|
|
4251
|
+
const normalized = withKind(results, "sample");
|
|
4252
|
+
const existingEmpty = normalized.find((s) => s.id === "empty-email");
|
|
4253
|
+
setSamples(existingEmpty ? normalized : [EMPTY_TEMPLATE, ...normalized]);
|
|
4254
|
+
}).catch((error) => {
|
|
4255
|
+
console.error("Failed to load samples:", error);
|
|
4256
|
+
setSamples([EMPTY_TEMPLATE]);
|
|
4257
|
+
}).finally(() => setLoadingSamples(false));
|
|
4258
|
+
}, [enabled, samplesDrawerOpen, loadSamples]);
|
|
4259
|
+
const refreshTemplates = () => __async(null, null, function* () {
|
|
4260
|
+
if (!loadTemplates) return;
|
|
4261
|
+
setLoadingTemplates(true);
|
|
4262
|
+
setTemplatesError(null);
|
|
4263
|
+
try {
|
|
4264
|
+
const results = yield loadTemplates();
|
|
4265
|
+
setTemplates(withKind(results, "template"));
|
|
4266
|
+
} catch (error) {
|
|
4267
|
+
console.error("Failed to load templates:", error);
|
|
4268
|
+
setTemplatesError("Could not load templates");
|
|
4269
|
+
} finally {
|
|
4270
|
+
setLoadingTemplates(false);
|
|
4271
|
+
}
|
|
4272
|
+
});
|
|
4273
|
+
React60.useEffect(() => {
|
|
4274
|
+
if (!enabled || !loadTemplates) return;
|
|
4275
|
+
refreshTemplates();
|
|
4276
|
+
}, [enabled, loadTemplates]);
|
|
4277
|
+
React60.useEffect(() => {
|
|
4278
|
+
const handler = (e) => {
|
|
4279
|
+
const detail = e.detail;
|
|
4280
|
+
if (Array.isArray(detail)) setTemplates(withKind(detail, "template"));
|
|
4281
|
+
};
|
|
4282
|
+
window.addEventListener("templateListUpdated", handler);
|
|
4283
|
+
return () => window.removeEventListener("templateListUpdated", handler);
|
|
4284
|
+
}, []);
|
|
4285
|
+
const { templateRows, sampleRows } = React60.useMemo(() => {
|
|
4286
|
+
const byId = /* @__PURE__ */ new Map();
|
|
4287
|
+
for (const s of samples) byId.set(s.id, s);
|
|
4288
|
+
for (const t of templates) byId.set(t.id, t);
|
|
4289
|
+
const all = Array.from(byId.values());
|
|
4290
|
+
return {
|
|
4291
|
+
templateRows: all.filter((t) => t.kind === "template"),
|
|
4292
|
+
sampleRows: all.filter((t) => t.kind === "sample")
|
|
4293
|
+
};
|
|
4294
|
+
}, [samples, templates]);
|
|
4295
|
+
const allTags = React60.useMemo(() => {
|
|
4296
|
+
var _a2;
|
|
4297
|
+
const set = /* @__PURE__ */ new Set();
|
|
4298
|
+
for (const t of templateRows) {
|
|
4299
|
+
(_a2 = t.tags) == null ? void 0 : _a2.forEach((tag) => set.add(tag));
|
|
4300
|
+
}
|
|
4301
|
+
return Array.from(set).sort();
|
|
4302
|
+
}, [templateRows]);
|
|
4303
|
+
const filteredTemplates = React60.useMemo(() => {
|
|
4304
|
+
const term = search.trim().toLowerCase();
|
|
4305
|
+
const matchSearch = (t) => {
|
|
4306
|
+
if (!term) return true;
|
|
4307
|
+
const haystack = [t.slug, t.description, t.subject].filter(Boolean).join(" ").toLowerCase();
|
|
4308
|
+
return haystack.includes(term);
|
|
4309
|
+
};
|
|
4310
|
+
const matchTags = (t) => {
|
|
4311
|
+
if (activeTags.length === 0) return true;
|
|
4312
|
+
if (!t.tags || t.tags.length === 0) return false;
|
|
4313
|
+
return activeTags.every((tag) => t.tags.includes(tag));
|
|
4314
|
+
};
|
|
4315
|
+
return templateRows.filter((t) => matchSearch(t) && matchTags(t)).slice().sort((a, b) => compareTemplates(a, b, sortKey));
|
|
4316
|
+
}, [templateRows, search, activeTags, sortKey]);
|
|
4317
|
+
const toggleTag = (tag) => {
|
|
4318
|
+
setActiveTags((prev) => prev.includes(tag) ? prev.filter((t) => t !== tag) : [...prev, tag]);
|
|
4319
|
+
};
|
|
4320
|
+
const handleDuplicate = (template) => {
|
|
4321
|
+
if (!copyTemplate) return;
|
|
4322
|
+
(() => __async(null, null, function* () {
|
|
4323
|
+
try {
|
|
4324
|
+
const full = yield handleLoadTemplate(template.id);
|
|
4325
|
+
if (!full) {
|
|
4326
|
+
showMessage("Could not load template to duplicate");
|
|
4327
|
+
return;
|
|
4328
|
+
}
|
|
4329
|
+
copyTemplate(`${template.slug} (Copy)`, full);
|
|
4330
|
+
showMessage("Template duplicated");
|
|
4331
|
+
} catch (e) {
|
|
4332
|
+
console.error("Error duplicating template:", e);
|
|
4333
|
+
showMessage("Error duplicating template");
|
|
4334
|
+
}
|
|
4335
|
+
}))();
|
|
4336
|
+
};
|
|
4337
|
+
const handleDelete = (template) => {
|
|
4338
|
+
if (!deleteTemplate) return;
|
|
4339
|
+
if (!window.confirm(`Delete "${template.slug}"? This cannot be undone.`)) return;
|
|
4340
|
+
deleteTemplate(template.id);
|
|
4341
|
+
showMessage("Template deleted");
|
|
4342
|
+
};
|
|
4343
|
+
const handleRenameSubmit = (newSlug) => __async(null, null, function* () {
|
|
4344
|
+
if (!renameTarget || !renameTemplate) return;
|
|
4345
|
+
yield renameTemplate(renameTarget.id, newSlug);
|
|
4346
|
+
setTemplates(
|
|
4347
|
+
(prev) => prev.map((t) => t.id === renameTarget.id ? __spreadProps(__spreadValues({}, t), { slug: newSlug }) : t)
|
|
4348
|
+
);
|
|
4349
|
+
if (currentTemplateId === renameTarget.id) {
|
|
4350
|
+
setCurrentTemplate(renameTarget.id, newSlug);
|
|
4351
|
+
}
|
|
4352
|
+
showMessage("Template renamed");
|
|
4353
|
+
});
|
|
4354
|
+
const flipKindLocally = (id, kind) => {
|
|
4355
|
+
setTemplates((prev) => prev.map((t) => t.id === id ? __spreadProps(__spreadValues({}, t), { kind }) : t));
|
|
4356
|
+
setSamples((prev) => prev.map((t) => t.id === id ? __spreadProps(__spreadValues({}, t), { kind }) : t));
|
|
4357
|
+
};
|
|
4358
|
+
const handleSetKind = (template, kind) => {
|
|
4359
|
+
if (!setTemplateKind) return;
|
|
4360
|
+
(() => __async(null, null, function* () {
|
|
4361
|
+
try {
|
|
4362
|
+
yield setTemplateKind(template.id, kind);
|
|
4363
|
+
flipKindLocally(template.id, kind);
|
|
4364
|
+
if (currentTemplateId === template.id) {
|
|
4365
|
+
setCurrentTemplate(template.id, template.slug, kind);
|
|
4366
|
+
}
|
|
4367
|
+
showMessage(kind === "sample" ? "Promoted to sample" : "Demoted to template");
|
|
4368
|
+
} catch (e) {
|
|
4369
|
+
console.error("Error updating template kind:", e);
|
|
4370
|
+
showMessage("Error updating template kind");
|
|
4371
|
+
}
|
|
4372
|
+
}))();
|
|
4373
|
+
};
|
|
4374
|
+
const handleDuplicateAsTemplate = (sample) => {
|
|
4375
|
+
if (!saveAs) return;
|
|
4376
|
+
(() => __async(null, null, function* () {
|
|
4377
|
+
try {
|
|
4378
|
+
const content = yield handleLoadTemplate(sample.id);
|
|
4379
|
+
if (!content) {
|
|
4380
|
+
showMessage("Could not load sample");
|
|
4381
|
+
return;
|
|
4382
|
+
}
|
|
4383
|
+
resetDocument(content);
|
|
4384
|
+
setPendingSaveAs({ content, defaultName: `${sample.slug} (Copy)` });
|
|
4385
|
+
} catch (e) {
|
|
4386
|
+
console.error("Error duplicating sample:", e);
|
|
4387
|
+
showMessage("Error duplicating sample");
|
|
4388
|
+
}
|
|
4389
|
+
}))();
|
|
4390
|
+
};
|
|
4391
|
+
const handleSaveAsSubmit = (templateName) => __async(null, null, function* () {
|
|
4392
|
+
if (!saveAs || !pendingSaveAs) return false;
|
|
4393
|
+
const taken = templateRows.some((t) => t.slug.toLowerCase() === templateName.toLowerCase());
|
|
4394
|
+
if (taken) {
|
|
4395
|
+
setNewError("A template with this name already exists");
|
|
4396
|
+
return false;
|
|
4397
|
+
}
|
|
4398
|
+
try {
|
|
4399
|
+
const content = pendingSaveAs.content;
|
|
4400
|
+
const { id, slug } = yield saveAs(templateName, buildSavePayload(content));
|
|
4401
|
+
resetDocument(content);
|
|
4402
|
+
setCurrentTemplate(id, slug, "template");
|
|
4403
|
+
ctxLoadTemplate(content, id, slug, "template");
|
|
4404
|
+
showMessage("New template created!");
|
|
4405
|
+
window.location.hash = `#template/${id}`;
|
|
4406
|
+
yield refreshTemplates();
|
|
4407
|
+
return true;
|
|
4408
|
+
} catch (e) {
|
|
4409
|
+
console.error("Error creating template:", e);
|
|
4410
|
+
showMessage("Error creating template");
|
|
4411
|
+
return false;
|
|
4412
|
+
}
|
|
4413
|
+
});
|
|
4414
|
+
const openNewTemplateDialog = () => {
|
|
4415
|
+
setNewError(null);
|
|
4416
|
+
setPendingSaveAs({ content: empty_email_message_default, defaultName: "New Template" });
|
|
4417
|
+
};
|
|
4418
|
+
if (!enabled) {
|
|
4419
|
+
return null;
|
|
4420
|
+
}
|
|
4421
|
+
const existingSlugs = templates.map((t) => t.slug);
|
|
4422
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
4423
|
+
material.Drawer,
|
|
4424
|
+
{
|
|
4425
|
+
variant: "persistent",
|
|
4426
|
+
anchor: "left",
|
|
4427
|
+
open: samplesDrawerOpen,
|
|
4428
|
+
PaperProps: { style: { position: "absolute" } },
|
|
4429
|
+
ModalProps: {
|
|
4430
|
+
container: document.getElementById("drawer-container"),
|
|
4431
|
+
style: { position: "absolute" },
|
|
4432
|
+
keepMounted: true
|
|
4433
|
+
},
|
|
4434
|
+
transitionDuration: { enter: enterDuration, exit: exitDuration },
|
|
4435
|
+
sx: { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0 }
|
|
4436
|
+
},
|
|
4437
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
4438
|
+
material.Stack,
|
|
4439
|
+
{
|
|
4440
|
+
py: 1,
|
|
4441
|
+
px: 2,
|
|
4442
|
+
width: SAMPLES_DRAWER_WIDTH,
|
|
4443
|
+
height: "100%",
|
|
4444
|
+
spacing: 1.5,
|
|
4445
|
+
sx: { overflowY: "auto" }
|
|
4446
|
+
},
|
|
4447
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { pt: 1 } }, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "h6", component: "h1" }, "Templates"), saveAs && /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "New template" }, /* @__PURE__ */ React60__default.default.createElement(
|
|
4448
|
+
material.IconButton,
|
|
4449
|
+
{
|
|
4450
|
+
size: "small",
|
|
4451
|
+
onClick: openNewTemplateDialog,
|
|
4452
|
+
"aria-label": "New template"
|
|
4453
|
+
},
|
|
4454
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })
|
|
4455
|
+
))),
|
|
4456
|
+
loadTemplates && /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
4457
|
+
material.TextField,
|
|
4458
|
+
{
|
|
4459
|
+
size: "small",
|
|
4460
|
+
placeholder: "Search templates",
|
|
4461
|
+
value: search,
|
|
4462
|
+
onChange: (e) => setSearch(e.target.value),
|
|
4463
|
+
InputProps: {
|
|
4464
|
+
startAdornment: /* @__PURE__ */ React60__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.SearchOutlined, { fontSize: "small" }))
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
4468
|
+
material.TextField,
|
|
4469
|
+
{
|
|
4470
|
+
select: true,
|
|
4471
|
+
size: "small",
|
|
4472
|
+
label: "Sort by",
|
|
4473
|
+
value: sortKey,
|
|
4474
|
+
onChange: (e) => setSortKey(e.target.value)
|
|
4475
|
+
},
|
|
4476
|
+
SORT_OPTIONS.map((opt) => /* @__PURE__ */ React60__default.default.createElement(material.MenuItem, { key: opt.value, value: opt.value }, opt.label))
|
|
4477
|
+
), allTags.length > 0 && /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 } }, allTags.map((tag) => /* @__PURE__ */ React60__default.default.createElement(
|
|
4478
|
+
material.Chip,
|
|
4479
|
+
{
|
|
4480
|
+
key: tag,
|
|
4481
|
+
label: tag,
|
|
4482
|
+
size: "small",
|
|
4483
|
+
clickable: true,
|
|
4484
|
+
color: activeTags.includes(tag) ? "primary" : "default",
|
|
4485
|
+
variant: activeTags.includes(tag) ? "filled" : "outlined",
|
|
4486
|
+
onClick: () => toggleTag(tag)
|
|
4487
|
+
}
|
|
4488
|
+
))), /* @__PURE__ */ React60__default.default.createElement(material.Box, null, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Your Templates"), loadingTemplates ? /* @__PURE__ */ React60__default.default.createElement(material.Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React60__default.default.createElement(material.CircularProgress, { size: 24 })) : templatesError ? /* @__PURE__ */ React60__default.default.createElement(material.Alert, { severity: "error", sx: { my: 1 } }, templatesError) : filteredTemplates.length > 0 ? /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredTemplates.map((template) => /* @__PURE__ */ React60__default.default.createElement(
|
|
4489
|
+
TemplateRow,
|
|
4490
|
+
{
|
|
4491
|
+
key: template.id,
|
|
4492
|
+
template,
|
|
4493
|
+
isCurrent: currentTemplateId === template.id,
|
|
4494
|
+
templateLoader: () => handleLoadTemplate(template.id),
|
|
4495
|
+
onDuplicate: copyTemplate ? () => handleDuplicate(template) : void 0,
|
|
4496
|
+
onRename: renameTemplate ? () => setRenameTarget(template) : void 0,
|
|
4497
|
+
onDelete: deleteTemplate ? () => handleDelete(template) : void 0,
|
|
4498
|
+
onPromote: setTemplateKind ? () => handleSetKind(template, "sample") : void 0
|
|
4499
|
+
}
|
|
4500
|
+
))) : /* @__PURE__ */ React60__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__ */ React60__default.default.createElement(material.Divider, null)),
|
|
4501
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Box, null, /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Sample Templates"), loadingSamples ? /* @__PURE__ */ React60__default.default.createElement(material.Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React60__default.default.createElement(material.CircularProgress, { size: 24 })) : sampleRows.length > 0 ? /* @__PURE__ */ React60__default.default.createElement(material.Stack, { spacing: 0.25, sx: { width: "100%" } }, sampleRows.map((sample) => /* @__PURE__ */ React60__default.default.createElement(
|
|
4502
|
+
TemplateRow,
|
|
4503
|
+
{
|
|
4504
|
+
key: sample.id,
|
|
4505
|
+
template: sample,
|
|
4506
|
+
isCurrent: currentTemplateId === sample.id,
|
|
4507
|
+
templateLoader: () => handleLoadTemplate(sample.id),
|
|
4508
|
+
onDuplicateAsTemplate: saveAs ? () => handleDuplicateAsTemplate(sample) : void 0,
|
|
4509
|
+
onDemote: setTemplateKind && sample.id !== "empty-email" ? () => handleSetKind(sample, "template") : void 0
|
|
4510
|
+
}
|
|
4511
|
+
))) : /* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, "No samples available"))
|
|
4512
|
+
)
|
|
4513
|
+
), renameTarget && /* @__PURE__ */ React60__default.default.createElement(
|
|
4514
|
+
RenameDialog,
|
|
4515
|
+
{
|
|
4516
|
+
open: !!renameTarget,
|
|
4517
|
+
currentSlug: renameTarget.slug,
|
|
4518
|
+
existingSlugs: existingSlugs.filter((s) => s !== renameTarget.slug),
|
|
4519
|
+
onClose: () => setRenameTarget(null),
|
|
4520
|
+
onSubmit: handleRenameSubmit
|
|
4521
|
+
}
|
|
4522
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
4523
|
+
SaveTemplateDialog,
|
|
4524
|
+
{
|
|
4525
|
+
open: !!pendingSaveAs,
|
|
4526
|
+
onClose: () => {
|
|
4527
|
+
setPendingSaveAs(null);
|
|
4528
|
+
setNewError(null);
|
|
4529
|
+
},
|
|
4530
|
+
onSave: handleSaveAsSubmit,
|
|
4531
|
+
onNameChange: () => setNewError(null),
|
|
4532
|
+
defaultName: (_a = pendingSaveAs == null ? void 0 : pendingSaveAs.defaultName) != null ? _a : "New Template",
|
|
4533
|
+
error: newError
|
|
4534
|
+
}
|
|
4535
|
+
));
|
|
4536
|
+
}
|
|
4537
|
+
var BUTTON_SX2 = { p: 1.5, display: "flex", flexDirection: "column" };
|
|
4538
|
+
var ICON_SX = {
|
|
4539
|
+
mb: 0.75,
|
|
4540
|
+
width: "100%",
|
|
4541
|
+
bgcolor: "cadet.200",
|
|
4542
|
+
display: "flex",
|
|
4543
|
+
justifyContent: "center",
|
|
4544
|
+
p: 1,
|
|
4545
|
+
border: "1px solid",
|
|
4546
|
+
borderColor: "cadet.300"
|
|
4547
|
+
};
|
|
3830
4548
|
function BlockTypeButton({ label, icon, onClick }) {
|
|
3831
|
-
return /* @__PURE__ */
|
|
4549
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
3832
4550
|
material.Button,
|
|
3833
4551
|
{
|
|
3834
4552
|
sx: BUTTON_SX2,
|
|
@@ -3837,14 +4555,14 @@ function BlockTypeButton({ label, icon, onClick }) {
|
|
|
3837
4555
|
onClick();
|
|
3838
4556
|
}
|
|
3839
4557
|
},
|
|
3840
|
-
/* @__PURE__ */
|
|
3841
|
-
/* @__PURE__ */
|
|
4558
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: ICON_SX }, icon),
|
|
4559
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Typography, { variant: "body2" }, label)
|
|
3842
4560
|
);
|
|
3843
4561
|
}
|
|
3844
4562
|
var BUTTONS = [
|
|
3845
4563
|
{
|
|
3846
4564
|
label: "Heading",
|
|
3847
|
-
icon: /* @__PURE__ */
|
|
4565
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.HMobiledataOutlined, null),
|
|
3848
4566
|
block: () => ({
|
|
3849
4567
|
type: "Heading",
|
|
3850
4568
|
data: {
|
|
@@ -3857,11 +4575,11 @@ var BUTTONS = [
|
|
|
3857
4575
|
},
|
|
3858
4576
|
{
|
|
3859
4577
|
label: "Text",
|
|
3860
|
-
icon: /* @__PURE__ */
|
|
4578
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.NotesOutlined, null),
|
|
3861
4579
|
block: () => ({
|
|
3862
4580
|
type: "Text",
|
|
3863
4581
|
data: {
|
|
3864
|
-
props: { text: "My new text block" },
|
|
4582
|
+
props: { text: "My new text block", markdown: true },
|
|
3865
4583
|
style: {
|
|
3866
4584
|
padding: { top: 16, bottom: 16, left: 24, right: 24 },
|
|
3867
4585
|
fontWeight: "normal"
|
|
@@ -3871,13 +4589,13 @@ var BUTTONS = [
|
|
|
3871
4589
|
},
|
|
3872
4590
|
{
|
|
3873
4591
|
label: "Button",
|
|
3874
|
-
icon: /* @__PURE__ */
|
|
4592
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.SmartButtonOutlined, null),
|
|
3875
4593
|
block: () => ({
|
|
3876
4594
|
type: "Button",
|
|
3877
4595
|
data: {
|
|
3878
4596
|
props: {
|
|
3879
4597
|
text: "Button",
|
|
3880
|
-
url: "https://
|
|
4598
|
+
url: "https://example.com"
|
|
3881
4599
|
},
|
|
3882
4600
|
style: { padding: { top: 16, bottom: 16, left: 24, right: 24 } }
|
|
3883
4601
|
}
|
|
@@ -3885,12 +4603,12 @@ var BUTTONS = [
|
|
|
3885
4603
|
},
|
|
3886
4604
|
{
|
|
3887
4605
|
label: "Image",
|
|
3888
|
-
icon: /* @__PURE__ */
|
|
4606
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ImageOutlined, null),
|
|
3889
4607
|
block: () => ({
|
|
3890
4608
|
type: "Image",
|
|
3891
4609
|
data: {
|
|
3892
4610
|
props: {
|
|
3893
|
-
url: "https://
|
|
4611
|
+
url: "https://placehold.co/600x400/EEE/999?text=Sample+Image",
|
|
3894
4612
|
alt: "Sample product",
|
|
3895
4613
|
contentAlignment: "middle",
|
|
3896
4614
|
linkHref: null
|
|
@@ -3901,7 +4619,7 @@ var BUTTONS = [
|
|
|
3901
4619
|
},
|
|
3902
4620
|
{
|
|
3903
4621
|
label: "Avatar",
|
|
3904
|
-
icon: /* @__PURE__ */
|
|
4622
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AccountCircleOutlined, null),
|
|
3905
4623
|
block: () => ({
|
|
3906
4624
|
type: "Avatar",
|
|
3907
4625
|
data: {
|
|
@@ -3915,7 +4633,7 @@ var BUTTONS = [
|
|
|
3915
4633
|
},
|
|
3916
4634
|
{
|
|
3917
4635
|
label: "Personal Signature",
|
|
3918
|
-
icon: /* @__PURE__ */
|
|
4636
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ContactMailOutlined, null),
|
|
3919
4637
|
block: () => ({
|
|
3920
4638
|
type: "Signature",
|
|
3921
4639
|
data: {
|
|
@@ -3937,7 +4655,7 @@ var BUTTONS = [
|
|
|
3937
4655
|
},
|
|
3938
4656
|
{
|
|
3939
4657
|
label: "Company Signature",
|
|
3940
|
-
icon: /* @__PURE__ */
|
|
4658
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.BusinessOutlined, null),
|
|
3941
4659
|
block: () => ({
|
|
3942
4660
|
type: "Signature",
|
|
3943
4661
|
data: {
|
|
@@ -3957,7 +4675,7 @@ var BUTTONS = [
|
|
|
3957
4675
|
},
|
|
3958
4676
|
{
|
|
3959
4677
|
label: "Divider",
|
|
3960
|
-
icon: /* @__PURE__ */
|
|
4678
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.HorizontalRuleOutlined, null),
|
|
3961
4679
|
block: () => ({
|
|
3962
4680
|
type: "Divider",
|
|
3963
4681
|
data: {
|
|
@@ -3970,7 +4688,7 @@ var BUTTONS = [
|
|
|
3970
4688
|
},
|
|
3971
4689
|
{
|
|
3972
4690
|
label: "Spacer",
|
|
3973
|
-
icon: /* @__PURE__ */
|
|
4691
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.Crop32Outlined, null),
|
|
3974
4692
|
block: () => ({
|
|
3975
4693
|
type: "Spacer",
|
|
3976
4694
|
data: {}
|
|
@@ -3978,7 +4696,7 @@ var BUTTONS = [
|
|
|
3978
4696
|
},
|
|
3979
4697
|
{
|
|
3980
4698
|
label: "Html",
|
|
3981
|
-
icon: /* @__PURE__ */
|
|
4699
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.HtmlOutlined, null),
|
|
3982
4700
|
block: () => ({
|
|
3983
4701
|
type: "Html",
|
|
3984
4702
|
data: {
|
|
@@ -3993,7 +4711,7 @@ var BUTTONS = [
|
|
|
3993
4711
|
},
|
|
3994
4712
|
{
|
|
3995
4713
|
label: "Columns",
|
|
3996
|
-
icon: /* @__PURE__ */
|
|
4714
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ViewColumnOutlined, null),
|
|
3997
4715
|
block: () => ({
|
|
3998
4716
|
type: "ColumnsContainer",
|
|
3999
4717
|
data: {
|
|
@@ -4008,7 +4726,7 @@ var BUTTONS = [
|
|
|
4008
4726
|
},
|
|
4009
4727
|
{
|
|
4010
4728
|
label: "Container",
|
|
4011
|
-
icon: /* @__PURE__ */
|
|
4729
|
+
icon: /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.LibraryAddOutlined, null),
|
|
4012
4730
|
block: () => ({
|
|
4013
4731
|
type: "Container",
|
|
4014
4732
|
data: {
|
|
@@ -4032,7 +4750,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4032
4750
|
if (anchorEl === null) {
|
|
4033
4751
|
return null;
|
|
4034
4752
|
}
|
|
4035
|
-
return /* @__PURE__ */
|
|
4753
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4036
4754
|
material.Menu,
|
|
4037
4755
|
{
|
|
4038
4756
|
open: true,
|
|
@@ -4041,12 +4759,12 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
4041
4759
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
4042
4760
|
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
4043
4761
|
},
|
|
4044
|
-
/* @__PURE__ */
|
|
4762
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React60__default.default.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
|
|
4045
4763
|
);
|
|
4046
4764
|
}
|
|
4047
4765
|
function DividerButton({ buttonElement, onClick }) {
|
|
4048
|
-
const [visible, setVisible] =
|
|
4049
|
-
|
|
4766
|
+
const [visible, setVisible] = React60.useState(false);
|
|
4767
|
+
React60.useEffect(() => {
|
|
4050
4768
|
function listener({ clientX, clientY }) {
|
|
4051
4769
|
if (!buttonElement) {
|
|
4052
4770
|
return;
|
|
@@ -4068,7 +4786,7 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4068
4786
|
window.removeEventListener("mousemove", listener);
|
|
4069
4787
|
};
|
|
4070
4788
|
}, [buttonElement, setVisible]);
|
|
4071
|
-
return /* @__PURE__ */
|
|
4789
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Fade, { in: visible }, /* @__PURE__ */ React60__default.default.createElement(
|
|
4072
4790
|
material.IconButton,
|
|
4073
4791
|
{
|
|
4074
4792
|
size: "small",
|
|
@@ -4091,11 +4809,11 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
4091
4809
|
onClick();
|
|
4092
4810
|
}
|
|
4093
4811
|
},
|
|
4094
|
-
/* @__PURE__ */
|
|
4812
|
+
/* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })
|
|
4095
4813
|
));
|
|
4096
4814
|
}
|
|
4097
4815
|
function PlaceholderButton({ onClick }) {
|
|
4098
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4099
4817
|
material.ButtonBase,
|
|
4100
4818
|
{
|
|
4101
4819
|
onClick: (ev) => {
|
|
@@ -4111,7 +4829,7 @@ function PlaceholderButton({ onClick }) {
|
|
|
4111
4829
|
bgcolor: "rgba(0,0,0, 0.05)"
|
|
4112
4830
|
}
|
|
4113
4831
|
},
|
|
4114
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
4115
4833
|
iconsMaterial.AddOutlined,
|
|
4116
4834
|
{
|
|
4117
4835
|
sx: {
|
|
@@ -4128,19 +4846,19 @@ function PlaceholderButton({ onClick }) {
|
|
|
4128
4846
|
|
|
4129
4847
|
// src/editor/blocks/helpers/editor-children-ids/add-block-menu/index.tsx
|
|
4130
4848
|
function AddBlockButton({ onSelect, placeholder }) {
|
|
4131
|
-
const [menuAnchorEl, setMenuAnchorEl] =
|
|
4132
|
-
const [buttonElement, setButtonElement] =
|
|
4849
|
+
const [menuAnchorEl, setMenuAnchorEl] = React60.useState(null);
|
|
4850
|
+
const [buttonElement, setButtonElement] = React60.useState(null);
|
|
4133
4851
|
const handleButtonClick = () => {
|
|
4134
4852
|
setMenuAnchorEl(buttonElement);
|
|
4135
4853
|
};
|
|
4136
4854
|
const renderButton2 = () => {
|
|
4137
4855
|
if (placeholder) {
|
|
4138
|
-
return /* @__PURE__ */
|
|
4856
|
+
return /* @__PURE__ */ React60__default.default.createElement(PlaceholderButton, { onClick: handleButtonClick });
|
|
4139
4857
|
} else {
|
|
4140
|
-
return /* @__PURE__ */
|
|
4858
|
+
return /* @__PURE__ */ React60__default.default.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
|
|
4141
4859
|
}
|
|
4142
4860
|
};
|
|
4143
|
-
return /* @__PURE__ */
|
|
4861
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React60__default.default.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
|
|
4144
4862
|
}
|
|
4145
4863
|
|
|
4146
4864
|
// src/editor/blocks/helpers/editor-children-ids/index.tsx
|
|
@@ -4167,9 +4885,9 @@ function EditorChildrenIds({ childrenIds, onChange }) {
|
|
|
4167
4885
|
});
|
|
4168
4886
|
};
|
|
4169
4887
|
if (!childrenIds || childrenIds.length === 0) {
|
|
4170
|
-
return /* @__PURE__ */
|
|
4888
|
+
return /* @__PURE__ */ React60__default.default.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock });
|
|
4171
4889
|
}
|
|
4172
|
-
return /* @__PURE__ */
|
|
4890
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React60__default.default.createElement(React60.Fragment, { key: childId }, /* @__PURE__ */ React60__default.default.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), /* @__PURE__ */ React60__default.default.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React60__default.default.createElement(AddBlockButton, { onSelect: appendBlock }));
|
|
4173
4891
|
}
|
|
4174
4892
|
|
|
4175
4893
|
// src/editor/blocks/columns-container/columns-container-editor.tsx
|
|
@@ -4196,15 +4914,15 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
4196
4914
|
});
|
|
4197
4915
|
setSelectedBlockId(blockId);
|
|
4198
4916
|
};
|
|
4199
|
-
return /* @__PURE__ */
|
|
4917
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4200
4918
|
columns_container_default,
|
|
4201
4919
|
{
|
|
4202
4920
|
props: restProps,
|
|
4203
4921
|
style,
|
|
4204
4922
|
columns: [
|
|
4205
|
-
/* @__PURE__ */
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
/* @__PURE__ */
|
|
4923
|
+
/* @__PURE__ */ React60__default.default.createElement(EditorChildrenIds, { childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds, onChange: (change) => updateColumn(0, change) }),
|
|
4924
|
+
/* @__PURE__ */ React60__default.default.createElement(EditorChildrenIds, { childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds, onChange: (change) => updateColumn(1, change) }),
|
|
4925
|
+
/* @__PURE__ */ React60__default.default.createElement(EditorChildrenIds, { childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds, onChange: (change) => updateColumn(2, change) })
|
|
4208
4926
|
]
|
|
4209
4927
|
}
|
|
4210
4928
|
);
|
|
@@ -4214,7 +4932,7 @@ function ContainerEditor({ style, props }) {
|
|
|
4214
4932
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
4215
4933
|
const document2 = useDocument();
|
|
4216
4934
|
const currentBlockId = useCurrentBlockId();
|
|
4217
|
-
return /* @__PURE__ */
|
|
4935
|
+
return /* @__PURE__ */ React60__default.default.createElement(container_default, { style }, /* @__PURE__ */ React60__default.default.createElement(
|
|
4218
4936
|
EditorChildrenIds,
|
|
4219
4937
|
{
|
|
4220
4938
|
childrenIds,
|
|
@@ -4320,7 +5038,7 @@ function EmailLayoutEditor(props) {
|
|
|
4320
5038
|
const document2 = useDocument();
|
|
4321
5039
|
const currentBlockId = useCurrentBlockId();
|
|
4322
5040
|
const selectedBlockId = useSelectedBlockId();
|
|
4323
|
-
const handleDelete =
|
|
5041
|
+
const handleDelete = React60.useCallback((e) => {
|
|
4324
5042
|
var _a2, _b2, _c2;
|
|
4325
5043
|
if (e.key !== "Delete" && e.key !== "Backspace") return;
|
|
4326
5044
|
if (!selectedBlockId) return;
|
|
@@ -4351,7 +5069,7 @@ function EmailLayoutEditor(props) {
|
|
|
4351
5069
|
delete nDocument[selectedBlockId];
|
|
4352
5070
|
resetDocument(nDocument);
|
|
4353
5071
|
}, [selectedBlockId, document2]);
|
|
4354
|
-
const handleCopy =
|
|
5072
|
+
const handleCopy = React60.useCallback((e) => {
|
|
4355
5073
|
if (!(e.metaKey || e.ctrlKey) || e.key !== "c") return;
|
|
4356
5074
|
if (!selectedBlockId) return;
|
|
4357
5075
|
const target = e.target;
|
|
@@ -4364,7 +5082,7 @@ function EmailLayoutEditor(props) {
|
|
|
4364
5082
|
const payload = JSON.stringify({ __emailEditorBlocks: true, rootBlockId: selectedBlockId, blocks });
|
|
4365
5083
|
navigator.clipboard.writeText(payload);
|
|
4366
5084
|
}, [selectedBlockId, document2]);
|
|
4367
|
-
const handlePaste =
|
|
5085
|
+
const handlePaste = React60.useCallback((e) => __async(null, null, function* () {
|
|
4368
5086
|
var _a2;
|
|
4369
5087
|
const target = e.target;
|
|
4370
5088
|
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
@@ -4395,7 +5113,7 @@ function EmailLayoutEditor(props) {
|
|
|
4395
5113
|
resetDocument(doc);
|
|
4396
5114
|
setSelectedBlockId(newRootId);
|
|
4397
5115
|
}), [document2, childrenIds, selectedBlockId, currentBlockId]);
|
|
4398
|
-
|
|
5116
|
+
React60.useEffect(() => {
|
|
4399
5117
|
window.addEventListener("keydown", handleDelete);
|
|
4400
5118
|
window.addEventListener("keydown", handleCopy);
|
|
4401
5119
|
window.addEventListener("paste", handlePaste);
|
|
@@ -4405,27 +5123,64 @@ function EmailLayoutEditor(props) {
|
|
|
4405
5123
|
window.removeEventListener("paste", handlePaste);
|
|
4406
5124
|
};
|
|
4407
5125
|
}, [handleDelete, handleCopy, handlePaste]);
|
|
4408
|
-
|
|
5126
|
+
const baseStyle = {
|
|
5127
|
+
color: (_b = props.textColor) != null ? _b : "#262626",
|
|
5128
|
+
fontFamily: getFontFamily7(props.fontFamily),
|
|
5129
|
+
fontSize: "16px",
|
|
5130
|
+
fontWeight: "400",
|
|
5131
|
+
letterSpacing: "0.15008px",
|
|
5132
|
+
lineHeight: "1.5",
|
|
5133
|
+
margin: "0"
|
|
5134
|
+
};
|
|
5135
|
+
const editorChildren = /* @__PURE__ */ React60__default.default.createElement(
|
|
5136
|
+
EditorChildrenIds,
|
|
5137
|
+
{
|
|
5138
|
+
childrenIds,
|
|
5139
|
+
onChange: ({ block, blockId, childrenIds: childrenIds2 }) => {
|
|
5140
|
+
setDocument({
|
|
5141
|
+
[blockId]: block,
|
|
5142
|
+
[currentBlockId]: {
|
|
5143
|
+
type: "EmailLayout",
|
|
5144
|
+
data: __spreadProps(__spreadValues({}, document2[currentBlockId].data), {
|
|
5145
|
+
childrenIds: childrenIds2
|
|
5146
|
+
})
|
|
5147
|
+
}
|
|
5148
|
+
});
|
|
5149
|
+
setSelectedBlockId(blockId);
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
);
|
|
5153
|
+
if (props.backdropDisabled) {
|
|
5154
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
5155
|
+
"div",
|
|
5156
|
+
{
|
|
5157
|
+
onClick: () => {
|
|
5158
|
+
setSelectedBlockId(null);
|
|
5159
|
+
},
|
|
5160
|
+
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
5161
|
+
backgroundColor: "#F5F5F5",
|
|
5162
|
+
padding: "32px",
|
|
5163
|
+
width: "100%",
|
|
5164
|
+
minHeight: "100%"
|
|
5165
|
+
})
|
|
5166
|
+
},
|
|
5167
|
+
/* @__PURE__ */ React60__default.default.createElement("div", { style: { maxWidth: "600px" } }, editorChildren)
|
|
5168
|
+
);
|
|
5169
|
+
}
|
|
5170
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4409
5171
|
"div",
|
|
4410
5172
|
{
|
|
4411
5173
|
onClick: () => {
|
|
4412
5174
|
setSelectedBlockId(null);
|
|
4413
5175
|
},
|
|
4414
|
-
style: {
|
|
4415
|
-
backgroundColor: (
|
|
4416
|
-
color: (_c = props.textColor) != null ? _c : "#262626",
|
|
4417
|
-
fontFamily: getFontFamily7(props.fontFamily),
|
|
4418
|
-
fontSize: "16px",
|
|
4419
|
-
fontWeight: "400",
|
|
4420
|
-
letterSpacing: "0.15008px",
|
|
4421
|
-
lineHeight: "1.5",
|
|
4422
|
-
margin: "0",
|
|
5176
|
+
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
5177
|
+
backgroundColor: (_c = props.backdropColor) != null ? _c : "#F5F5F5",
|
|
4423
5178
|
padding: "32px 0",
|
|
4424
5179
|
width: "100%",
|
|
4425
5180
|
minHeight: "100%"
|
|
4426
|
-
}
|
|
5181
|
+
})
|
|
4427
5182
|
},
|
|
4428
|
-
/* @__PURE__ */
|
|
5183
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
4429
5184
|
"table",
|
|
4430
5185
|
{
|
|
4431
5186
|
align: "center",
|
|
@@ -4435,6 +5190,7 @@ function EmailLayoutEditor(props) {
|
|
|
4435
5190
|
maxWidth: "600px",
|
|
4436
5191
|
backgroundColor: (_d = props.canvasColor) != null ? _d : "#FFFFFF",
|
|
4437
5192
|
borderRadius: (_e = props.borderRadius) != null ? _e : void 0,
|
|
5193
|
+
overflow: props.borderRadius ? "hidden" : void 0,
|
|
4438
5194
|
border: (() => {
|
|
4439
5195
|
const v = props.borderColor;
|
|
4440
5196
|
if (!v) {
|
|
@@ -4448,24 +5204,7 @@ function EmailLayoutEditor(props) {
|
|
|
4448
5204
|
cellPadding: "0",
|
|
4449
5205
|
border: 0
|
|
4450
5206
|
},
|
|
4451
|
-
/* @__PURE__ */
|
|
4452
|
-
EditorChildrenIds,
|
|
4453
|
-
{
|
|
4454
|
-
childrenIds,
|
|
4455
|
-
onChange: ({ block, blockId, childrenIds: childrenIds2 }) => {
|
|
4456
|
-
setDocument({
|
|
4457
|
-
[blockId]: block,
|
|
4458
|
-
[currentBlockId]: {
|
|
4459
|
-
type: "EmailLayout",
|
|
4460
|
-
data: __spreadProps(__spreadValues({}, document2[currentBlockId].data), {
|
|
4461
|
-
childrenIds: childrenIds2
|
|
4462
|
-
})
|
|
4463
|
-
}
|
|
4464
|
-
});
|
|
4465
|
-
setSelectedBlockId(blockId);
|
|
4466
|
-
}
|
|
4467
|
-
}
|
|
4468
|
-
))))
|
|
5207
|
+
/* @__PURE__ */ React60__default.default.createElement("tbody", null, /* @__PURE__ */ React60__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React60__default.default.createElement("td", null, editorChildren)))
|
|
4469
5208
|
)
|
|
4470
5209
|
);
|
|
4471
5210
|
}
|
|
@@ -4624,13 +5363,13 @@ function TuneMenu({ blockId }) {
|
|
|
4624
5363
|
resetDocument(nDocument);
|
|
4625
5364
|
setSelectedBlockId(blockId);
|
|
4626
5365
|
};
|
|
4627
|
-
return /* @__PURE__ */
|
|
5366
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, null, /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Move up", placement: "left-start" }, /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Move down", placement: "left-start" }, /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Copy block", placement: "left-start" }, /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Delete", placement: "left-start" }, /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.DeleteOutlined, { fontSize: "small" })))));
|
|
4628
5367
|
}
|
|
4629
5368
|
|
|
4630
5369
|
// src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
|
|
4631
5370
|
function EditorBlockWrapper({ children }) {
|
|
4632
5371
|
const selectedBlockId = useSelectedBlockId();
|
|
4633
|
-
const [mouseInside, setMouseInside] =
|
|
5372
|
+
const [mouseInside, setMouseInside] = React60.useState(false);
|
|
4634
5373
|
const blockId = useCurrentBlockId();
|
|
4635
5374
|
let outline;
|
|
4636
5375
|
if (selectedBlockId === blockId) {
|
|
@@ -4642,9 +5381,9 @@ function EditorBlockWrapper({ children }) {
|
|
|
4642
5381
|
if (selectedBlockId !== blockId) {
|
|
4643
5382
|
return null;
|
|
4644
5383
|
}
|
|
4645
|
-
return /* @__PURE__ */
|
|
5384
|
+
return /* @__PURE__ */ React60__default.default.createElement(TuneMenu, { blockId });
|
|
4646
5385
|
};
|
|
4647
|
-
return /* @__PURE__ */
|
|
5386
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4648
5387
|
material.Box,
|
|
4649
5388
|
{
|
|
4650
5389
|
sx: {
|
|
@@ -4730,8 +5469,8 @@ function ButtonEditor({ style, props }) {
|
|
|
4730
5469
|
const fullWidth = (_b = props == null ? void 0 : props.fullWidth) != null ? _b : ButtonPropsDefaults.fullWidth;
|
|
4731
5470
|
const buttonTextColor = (_c = props == null ? void 0 : props.buttonTextColor) != null ? _c : ButtonPropsDefaults.buttonTextColor;
|
|
4732
5471
|
const buttonBackgroundColor = (_d = props == null ? void 0 : props.buttonBackgroundColor) != null ? _d : ButtonPropsDefaults.buttonBackgroundColor;
|
|
4733
|
-
const [localText, setLocalText] =
|
|
4734
|
-
|
|
5472
|
+
const [localText, setLocalText] = React60.useState(text);
|
|
5473
|
+
React60.useEffect(() => {
|
|
4735
5474
|
setLocalText(text);
|
|
4736
5475
|
}, [text]);
|
|
4737
5476
|
const padding = getButtonSizePadding2(props);
|
|
@@ -4774,7 +5513,7 @@ function ButtonEditor({ style, props }) {
|
|
|
4774
5513
|
width: fullWidth ? "100%" : void 0,
|
|
4775
5514
|
textAlign: "center"
|
|
4776
5515
|
});
|
|
4777
|
-
return /* @__PURE__ */
|
|
5516
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60__default.default.createElement(
|
|
4778
5517
|
"input",
|
|
4779
5518
|
{
|
|
4780
5519
|
type: "text",
|
|
@@ -4785,7 +5524,7 @@ function ButtonEditor({ style, props }) {
|
|
|
4785
5524
|
}
|
|
4786
5525
|
));
|
|
4787
5526
|
}
|
|
4788
|
-
return /* @__PURE__ */
|
|
5527
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React60__default.default.createElement("span", { style: linkStyle }, /* @__PURE__ */ React60__default.default.createElement("span", null, text)));
|
|
4789
5528
|
}
|
|
4790
5529
|
function getFontFamily9(fontFamily) {
|
|
4791
5530
|
switch (fontFamily) {
|
|
@@ -4856,10 +5595,10 @@ function HeadingEditor({ style, props }) {
|
|
|
4856
5595
|
const isSelected = selectedBlockId === blockId;
|
|
4857
5596
|
const level = (_a = props == null ? void 0 : props.level) != null ? _a : HeadingPropsDefaults.level;
|
|
4858
5597
|
const textContent = (_b = props == null ? void 0 : props.text) != null ? _b : HeadingPropsDefaults.text;
|
|
4859
|
-
const [localText, setLocalText] =
|
|
5598
|
+
const [localText, setLocalText] = React60.useState(textContent);
|
|
4860
5599
|
const rootBlock = document2.root;
|
|
4861
5600
|
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily9(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
4862
|
-
|
|
5601
|
+
React60.useEffect(() => {
|
|
4863
5602
|
setLocalText(textContent);
|
|
4864
5603
|
}, [textContent]);
|
|
4865
5604
|
const fontFamily = getFontFamily9(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
@@ -4908,7 +5647,7 @@ function HeadingEditor({ style, props }) {
|
|
|
4908
5647
|
}
|
|
4909
5648
|
};
|
|
4910
5649
|
if (isSelected) {
|
|
4911
|
-
return /* @__PURE__ */
|
|
5650
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
4912
5651
|
"textarea",
|
|
4913
5652
|
{
|
|
4914
5653
|
value: localText,
|
|
@@ -4923,11 +5662,11 @@ function HeadingEditor({ style, props }) {
|
|
|
4923
5662
|
}
|
|
4924
5663
|
switch (level) {
|
|
4925
5664
|
case "h1":
|
|
4926
|
-
return /* @__PURE__ */
|
|
5665
|
+
return /* @__PURE__ */ React60__default.default.createElement("h1", { style: hStyle }, textContent);
|
|
4927
5666
|
case "h2":
|
|
4928
|
-
return /* @__PURE__ */
|
|
5667
|
+
return /* @__PURE__ */ React60__default.default.createElement("h2", { style: hStyle }, textContent);
|
|
4929
5668
|
case "h3":
|
|
4930
|
-
return /* @__PURE__ */
|
|
5669
|
+
return /* @__PURE__ */ React60__default.default.createElement("h3", { style: hStyle }, textContent);
|
|
4931
5670
|
}
|
|
4932
5671
|
}
|
|
4933
5672
|
function HtmlEditor({ style, props }) {
|
|
@@ -4936,8 +5675,8 @@ function HtmlEditor({ style, props }) {
|
|
|
4936
5675
|
const selectedBlockId = useSelectedBlockId();
|
|
4937
5676
|
const isSelected = selectedBlockId === blockId;
|
|
4938
5677
|
const contents = (_a = props == null ? void 0 : props.contents) != null ? _a : "";
|
|
4939
|
-
const [localContents, setLocalContents] =
|
|
4940
|
-
|
|
5678
|
+
const [localContents, setLocalContents] = React60.useState(contents);
|
|
5679
|
+
React60.useEffect(() => {
|
|
4941
5680
|
setLocalContents(contents);
|
|
4942
5681
|
}, [contents]);
|
|
4943
5682
|
const cssStyle = {
|
|
@@ -4982,7 +5721,7 @@ function HtmlEditor({ style, props }) {
|
|
|
4982
5721
|
margin: 0,
|
|
4983
5722
|
backgroundColor: "transparent"
|
|
4984
5723
|
});
|
|
4985
|
-
return /* @__PURE__ */
|
|
5724
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: cssStyle }, /* @__PURE__ */ React60__default.default.createElement(
|
|
4986
5725
|
"textarea",
|
|
4987
5726
|
{
|
|
4988
5727
|
value: localContents,
|
|
@@ -4996,9 +5735,9 @@ function HtmlEditor({ style, props }) {
|
|
|
4996
5735
|
));
|
|
4997
5736
|
}
|
|
4998
5737
|
if (!contents) {
|
|
4999
|
-
return /* @__PURE__ */
|
|
5738
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: cssStyle });
|
|
5000
5739
|
}
|
|
5001
|
-
return /* @__PURE__ */
|
|
5740
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
|
|
5002
5741
|
}
|
|
5003
5742
|
function getImageBorderRadius2(shape, size) {
|
|
5004
5743
|
switch (shape) {
|
|
@@ -5031,36 +5770,36 @@ function SignatureEditor({ style, props }) {
|
|
|
5031
5770
|
const nameColor = (_m = props == null ? void 0 : props.nameColor) != null ? _m : SignaturePropsDefaults.nameColor;
|
|
5032
5771
|
const textColor = (_n = props == null ? void 0 : props.textColor) != null ? _n : SignaturePropsDefaults.textColor;
|
|
5033
5772
|
const linkColor = (_o = props == null ? void 0 : props.linkColor) != null ? _o : SignaturePropsDefaults.linkColor;
|
|
5034
|
-
const [localGreeting, setLocalGreeting] =
|
|
5035
|
-
const [localName, setLocalName] =
|
|
5036
|
-
const [localTitle, setLocalTitle] =
|
|
5037
|
-
const [localCompany, setLocalCompany] =
|
|
5038
|
-
const [localAddress, setLocalAddress] =
|
|
5039
|
-
const [localEmail, setLocalEmail] =
|
|
5040
|
-
const [localPhone, setLocalPhone] =
|
|
5041
|
-
const [localWebsite, setLocalWebsite] =
|
|
5042
|
-
|
|
5773
|
+
const [localGreeting, setLocalGreeting] = React60.useState(greeting);
|
|
5774
|
+
const [localName, setLocalName] = React60.useState(name);
|
|
5775
|
+
const [localTitle, setLocalTitle] = React60.useState(title);
|
|
5776
|
+
const [localCompany, setLocalCompany] = React60.useState(company);
|
|
5777
|
+
const [localAddress, setLocalAddress] = React60.useState(address);
|
|
5778
|
+
const [localEmail, setLocalEmail] = React60.useState(email);
|
|
5779
|
+
const [localPhone, setLocalPhone] = React60.useState(phone);
|
|
5780
|
+
const [localWebsite, setLocalWebsite] = React60.useState(website);
|
|
5781
|
+
React60.useEffect(() => {
|
|
5043
5782
|
setLocalGreeting(greeting);
|
|
5044
5783
|
}, [greeting]);
|
|
5045
|
-
|
|
5784
|
+
React60.useEffect(() => {
|
|
5046
5785
|
setLocalName(name);
|
|
5047
5786
|
}, [name]);
|
|
5048
|
-
|
|
5787
|
+
React60.useEffect(() => {
|
|
5049
5788
|
setLocalTitle(title);
|
|
5050
5789
|
}, [title]);
|
|
5051
|
-
|
|
5790
|
+
React60.useEffect(() => {
|
|
5052
5791
|
setLocalCompany(company);
|
|
5053
5792
|
}, [company]);
|
|
5054
|
-
|
|
5793
|
+
React60.useEffect(() => {
|
|
5055
5794
|
setLocalAddress(address);
|
|
5056
5795
|
}, [address]);
|
|
5057
|
-
|
|
5796
|
+
React60.useEffect(() => {
|
|
5058
5797
|
setLocalEmail(email);
|
|
5059
5798
|
}, [email]);
|
|
5060
|
-
|
|
5799
|
+
React60.useEffect(() => {
|
|
5061
5800
|
setLocalPhone(phone);
|
|
5062
5801
|
}, [phone]);
|
|
5063
|
-
|
|
5802
|
+
React60.useEffect(() => {
|
|
5064
5803
|
setLocalWebsite(website);
|
|
5065
5804
|
}, [website]);
|
|
5066
5805
|
const updateProps = (updates) => {
|
|
@@ -5113,7 +5852,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5113
5852
|
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
5114
5853
|
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
|
|
5115
5854
|
};
|
|
5116
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
5855
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React60__default.default.createElement(
|
|
5117
5856
|
"img",
|
|
5118
5857
|
{
|
|
5119
5858
|
src: imageUrl,
|
|
@@ -5131,7 +5870,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5131
5870
|
}
|
|
5132
5871
|
}
|
|
5133
5872
|
) : null;
|
|
5134
|
-
const greetingElement = isSelected ? /* @__PURE__ */
|
|
5873
|
+
const greetingElement = isSelected ? /* @__PURE__ */ React60__default.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React60__default.default.createElement(
|
|
5135
5874
|
"input",
|
|
5136
5875
|
{
|
|
5137
5876
|
value: localGreeting,
|
|
@@ -5142,8 +5881,8 @@ function SignatureEditor({ style, props }) {
|
|
|
5142
5881
|
placeholder: "Greeting (e.g. Best regards,)",
|
|
5143
5882
|
style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
|
|
5144
5883
|
}
|
|
5145
|
-
)) : greeting ? /* @__PURE__ */
|
|
5146
|
-
const textContent = isSelected ? /* @__PURE__ */
|
|
5884
|
+
)) : greeting ? /* @__PURE__ */ React60__default.default.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
5885
|
+
const textContent = isSelected ? /* @__PURE__ */ React60__default.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React60__default.default.createElement(
|
|
5147
5886
|
"input",
|
|
5148
5887
|
{
|
|
5149
5888
|
value: localName,
|
|
@@ -5154,7 +5893,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5154
5893
|
placeholder: "Name",
|
|
5155
5894
|
style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
|
|
5156
5895
|
}
|
|
5157
|
-
), /* @__PURE__ */
|
|
5896
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5158
5897
|
"input",
|
|
5159
5898
|
{
|
|
5160
5899
|
value: localTitle,
|
|
@@ -5165,7 +5904,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5165
5904
|
placeholder: "Title",
|
|
5166
5905
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5167
5906
|
}
|
|
5168
|
-
), /* @__PURE__ */
|
|
5907
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5169
5908
|
"input",
|
|
5170
5909
|
{
|
|
5171
5910
|
value: localCompany,
|
|
@@ -5176,7 +5915,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5176
5915
|
placeholder: "Company",
|
|
5177
5916
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5178
5917
|
}
|
|
5179
|
-
), /* @__PURE__ */
|
|
5918
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5180
5919
|
"input",
|
|
5181
5920
|
{
|
|
5182
5921
|
value: localAddress,
|
|
@@ -5187,7 +5926,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5187
5926
|
placeholder: "Address",
|
|
5188
5927
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5189
5928
|
}
|
|
5190
|
-
), /* @__PURE__ */
|
|
5929
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5191
5930
|
"input",
|
|
5192
5931
|
{
|
|
5193
5932
|
value: localEmail,
|
|
@@ -5198,7 +5937,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5198
5937
|
placeholder: "Email",
|
|
5199
5938
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
|
|
5200
5939
|
}
|
|
5201
|
-
), /* @__PURE__ */
|
|
5940
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5202
5941
|
"input",
|
|
5203
5942
|
{
|
|
5204
5943
|
value: localPhone,
|
|
@@ -5209,7 +5948,7 @@ function SignatureEditor({ style, props }) {
|
|
|
5209
5948
|
placeholder: "Phone",
|
|
5210
5949
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5211
5950
|
}
|
|
5212
|
-
), /* @__PURE__ */
|
|
5951
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5213
5952
|
"input",
|
|
5214
5953
|
{
|
|
5215
5954
|
value: localWebsite,
|
|
@@ -5220,11 +5959,11 @@ function SignatureEditor({ style, props }) {
|
|
|
5220
5959
|
placeholder: "Website",
|
|
5221
5960
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5222
5961
|
}
|
|
5223
|
-
)) : /* @__PURE__ */
|
|
5962
|
+
)) : /* @__PURE__ */ React60__default.default.createElement("div", null, name && /* @__PURE__ */ React60__default.default.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React60__default.default.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React60__default.default.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React60__default.default.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React60__default.default.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React60__default.default.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React60__default.default.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React60__default.default.createElement("p", { style: detailStyle }, "Click to edit signature"));
|
|
5224
5963
|
if (layout === "vertical") {
|
|
5225
|
-
return /* @__PURE__ */
|
|
5964
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React60__default.default.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
5226
5965
|
}
|
|
5227
|
-
return /* @__PURE__ */
|
|
5966
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React60__default.default.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React60__default.default.createElement("tbody", null, /* @__PURE__ */ React60__default.default.createElement("tr", null, imageElement && /* @__PURE__ */ React60__default.default.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React60__default.default.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
5228
5967
|
}
|
|
5229
5968
|
function getFontFamily10(fontFamily) {
|
|
5230
5969
|
switch (fontFamily) {
|
|
@@ -5284,11 +6023,11 @@ function TextEditor({ style, props }) {
|
|
|
5284
6023
|
const document2 = useDocument();
|
|
5285
6024
|
const isSelected = selectedBlockId === blockId;
|
|
5286
6025
|
const textContent = (_a = props == null ? void 0 : props.text) != null ? _a : TextPropsDefaults.text;
|
|
5287
|
-
const [localText, setLocalText] =
|
|
6026
|
+
const [localText, setLocalText] = React60.useState(textContent);
|
|
5288
6027
|
const isMarkdown = (_b = props == null ? void 0 : props.markdown) != null ? _b : false;
|
|
5289
6028
|
const rootBlock = document2.root;
|
|
5290
6029
|
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily10(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
5291
|
-
|
|
6030
|
+
React60.useEffect(() => {
|
|
5292
6031
|
setLocalText(textContent);
|
|
5293
6032
|
}, [textContent]);
|
|
5294
6033
|
const fontFamily = getFontFamily10(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
@@ -5338,8 +6077,8 @@ function TextEditor({ style, props }) {
|
|
|
5338
6077
|
element.style.height = `${element.scrollHeight}px`;
|
|
5339
6078
|
}
|
|
5340
6079
|
};
|
|
5341
|
-
if (isSelected
|
|
5342
|
-
return /* @__PURE__ */
|
|
6080
|
+
if (isSelected) {
|
|
6081
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
5343
6082
|
"textarea",
|
|
5344
6083
|
{
|
|
5345
6084
|
value: localText,
|
|
@@ -5353,36 +6092,36 @@ function TextEditor({ style, props }) {
|
|
|
5353
6092
|
);
|
|
5354
6093
|
}
|
|
5355
6094
|
if (isMarkdown) {
|
|
5356
|
-
return /* @__PURE__ */
|
|
6095
|
+
return /* @__PURE__ */ React60__default.default.createElement(EmailMarkdown, { style: wStyle, markdown: textContent });
|
|
5357
6096
|
}
|
|
5358
|
-
return /* @__PURE__ */
|
|
6097
|
+
return /* @__PURE__ */ React60__default.default.createElement("div", { style: wStyle }, textContent);
|
|
5359
6098
|
}
|
|
5360
6099
|
|
|
5361
6100
|
// src/editor/core.tsx
|
|
5362
6101
|
var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
5363
6102
|
Avatar: {
|
|
5364
6103
|
schema: AvatarPropsSchema,
|
|
5365
|
-
Component: (props) => /* @__PURE__ */
|
|
6104
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(avatar_default, __spreadValues({}, props)))
|
|
5366
6105
|
},
|
|
5367
6106
|
Button: {
|
|
5368
6107
|
schema: ButtonPropsSchema,
|
|
5369
|
-
Component: (props) => /* @__PURE__ */
|
|
6108
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(ButtonEditor, __spreadValues({}, props)))
|
|
5370
6109
|
},
|
|
5371
6110
|
Container: {
|
|
5372
6111
|
schema: container_props_schema_default,
|
|
5373
|
-
Component: (props) => /* @__PURE__ */
|
|
6112
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(ContainerEditor, __spreadValues({}, props)))
|
|
5374
6113
|
},
|
|
5375
6114
|
ColumnsContainer: {
|
|
5376
6115
|
schema: columns_container_props_schema_default2,
|
|
5377
|
-
Component: (props) => /* @__PURE__ */
|
|
6116
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
|
|
5378
6117
|
},
|
|
5379
6118
|
Heading: {
|
|
5380
6119
|
schema: HeadingPropsSchema,
|
|
5381
|
-
Component: (props) => /* @__PURE__ */
|
|
6120
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(HeadingEditor, __spreadValues({}, props)))
|
|
5382
6121
|
},
|
|
5383
6122
|
Html: {
|
|
5384
6123
|
schema: HtmlPropsSchema,
|
|
5385
|
-
Component: (props) => /* @__PURE__ */
|
|
6124
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(HtmlEditor, __spreadValues({}, props)))
|
|
5386
6125
|
},
|
|
5387
6126
|
Image: {
|
|
5388
6127
|
schema: ImagePropsSchema,
|
|
@@ -5394,28 +6133,28 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
5394
6133
|
linkHref: null
|
|
5395
6134
|
})
|
|
5396
6135
|
});
|
|
5397
|
-
return /* @__PURE__ */
|
|
6136
|
+
return /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(image_default, __spreadValues({}, props)));
|
|
5398
6137
|
}
|
|
5399
6138
|
},
|
|
5400
6139
|
Text: {
|
|
5401
6140
|
schema: TextPropsSchema,
|
|
5402
|
-
Component: (props) => /* @__PURE__ */
|
|
6141
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(TextEditor, __spreadValues({}, props)))
|
|
5403
6142
|
},
|
|
5404
6143
|
EmailLayout: {
|
|
5405
6144
|
schema: email_layout_props_schema_default,
|
|
5406
|
-
Component: (p) => /* @__PURE__ */
|
|
6145
|
+
Component: (p) => /* @__PURE__ */ React60__default.default.createElement(EmailLayoutEditor, __spreadValues({}, p))
|
|
5407
6146
|
},
|
|
5408
6147
|
Spacer: {
|
|
5409
6148
|
schema: SpacerPropsSchema,
|
|
5410
|
-
Component: (props) => /* @__PURE__ */
|
|
6149
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(spacer_default, __spreadValues({}, props)))
|
|
5411
6150
|
},
|
|
5412
6151
|
Divider: {
|
|
5413
6152
|
schema: DividerPropsSchema,
|
|
5414
|
-
Component: (props) => /* @__PURE__ */
|
|
6153
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(divider_default, __spreadValues({}, props)))
|
|
5415
6154
|
},
|
|
5416
6155
|
Signature: {
|
|
5417
6156
|
schema: SignaturePropsSchema,
|
|
5418
|
-
Component: (props) => /* @__PURE__ */
|
|
6157
|
+
Component: (props) => /* @__PURE__ */ React60__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React60__default.default.createElement(SignatureEditor, __spreadValues({}, props)))
|
|
5419
6158
|
}
|
|
5420
6159
|
});
|
|
5421
6160
|
var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
|
|
@@ -5423,15 +6162,15 @@ var EditorBlockSchema = buildBlockConfigurationSchema(EDITOR_DICTIONARY);
|
|
|
5423
6162
|
zod.z.record(zod.z.string(), EditorBlockSchema);
|
|
5424
6163
|
|
|
5425
6164
|
// src/editor/editor-block.tsx
|
|
5426
|
-
var EditorBlockContext =
|
|
5427
|
-
var useCurrentBlockId = () =>
|
|
6165
|
+
var EditorBlockContext = React60.createContext(null);
|
|
6166
|
+
var useCurrentBlockId = () => React60.useContext(EditorBlockContext);
|
|
5428
6167
|
function EditorBlock({ id }) {
|
|
5429
6168
|
const document2 = useDocument();
|
|
5430
6169
|
const block = document2[id];
|
|
5431
6170
|
if (!block) {
|
|
5432
6171
|
throw new Error("Could not find block");
|
|
5433
6172
|
}
|
|
5434
|
-
return /* @__PURE__ */
|
|
6173
|
+
return /* @__PURE__ */ React60__default.default.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React60__default.default.createElement(EditorBlock2, __spreadValues({}, block)));
|
|
5435
6174
|
}
|
|
5436
6175
|
function ToggleInspectorPanelButton() {
|
|
5437
6176
|
const inspectorDrawerOpen = useInspectorDrawerOpen();
|
|
@@ -5439,20 +6178,20 @@ function ToggleInspectorPanelButton() {
|
|
|
5439
6178
|
toggleInspectorDrawerOpen();
|
|
5440
6179
|
};
|
|
5441
6180
|
if (inspectorDrawerOpen) {
|
|
5442
|
-
return /* @__PURE__ */
|
|
6181
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: handleClick }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.LastPageOutlined, { fontSize: "small" }));
|
|
5443
6182
|
}
|
|
5444
|
-
return /* @__PURE__ */
|
|
6183
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: handleClick }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.AppRegistrationOutlined, { fontSize: "small" }));
|
|
5445
6184
|
}
|
|
5446
6185
|
function useIcon() {
|
|
5447
6186
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
5448
6187
|
if (samplesDrawerOpen) {
|
|
5449
|
-
return /* @__PURE__ */
|
|
6188
|
+
return /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.FirstPageOutlined, { fontSize: "small" });
|
|
5450
6189
|
}
|
|
5451
|
-
return /* @__PURE__ */
|
|
6190
|
+
return /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.MenuOutlined, { fontSize: "small" });
|
|
5452
6191
|
}
|
|
5453
6192
|
function ToggleSamplesPanelButton() {
|
|
5454
6193
|
const icon = useIcon();
|
|
5455
|
-
return /* @__PURE__ */
|
|
6194
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
|
|
5456
6195
|
}
|
|
5457
6196
|
function formatHtml(html2, spaces = 2) {
|
|
5458
6197
|
try {
|
|
@@ -5500,8 +6239,8 @@ function json(value) {
|
|
|
5500
6239
|
|
|
5501
6240
|
// src/app/email-canvas/helper/highlighted-code-panel.tsx
|
|
5502
6241
|
function HighlightedCodePanel({ type, value }) {
|
|
5503
|
-
const [code, setCode] =
|
|
5504
|
-
|
|
6242
|
+
const [code, setCode] = React60.useState(null);
|
|
6243
|
+
React60.useEffect(() => {
|
|
5505
6244
|
switch (type) {
|
|
5506
6245
|
case "html":
|
|
5507
6246
|
html(value).then(setCode);
|
|
@@ -5514,7 +6253,7 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
5514
6253
|
if (code === null) {
|
|
5515
6254
|
return null;
|
|
5516
6255
|
}
|
|
5517
|
-
return /* @__PURE__ */
|
|
6256
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
5518
6257
|
"pre",
|
|
5519
6258
|
{
|
|
5520
6259
|
style: {
|
|
@@ -5539,18 +6278,18 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
5539
6278
|
// src/app/email-canvas/html-panel.tsx
|
|
5540
6279
|
function HtmlPanel() {
|
|
5541
6280
|
const document2 = useDocument();
|
|
5542
|
-
const code =
|
|
5543
|
-
return /* @__PURE__ */
|
|
6281
|
+
const code = React60.useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
|
|
6282
|
+
return /* @__PURE__ */ React60__default.default.createElement(HighlightedCodePanel, { type: "html", value: code });
|
|
5544
6283
|
}
|
|
5545
6284
|
function JsonPanel() {
|
|
5546
6285
|
const document2 = useDocument();
|
|
5547
|
-
const code =
|
|
5548
|
-
return /* @__PURE__ */
|
|
6286
|
+
const code = React60.useMemo(() => JSON.stringify(document2, null, " "), [document2]);
|
|
6287
|
+
return /* @__PURE__ */ React60__default.default.createElement(HighlightedCodePanel, { type: "json", value: code });
|
|
5549
6288
|
}
|
|
5550
6289
|
function TextPanel() {
|
|
5551
6290
|
const document2 = useDocument();
|
|
5552
|
-
const text =
|
|
5553
|
-
return /* @__PURE__ */
|
|
6291
|
+
const text = React60.useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
|
|
6292
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
5554
6293
|
"pre",
|
|
5555
6294
|
{
|
|
5556
6295
|
style: {
|
|
@@ -5586,185 +6325,47 @@ function MainTabsGroup() {
|
|
|
5586
6325
|
setSelectedMainTab("editor");
|
|
5587
6326
|
}
|
|
5588
6327
|
};
|
|
5589
|
-
return /* @__PURE__ */
|
|
6328
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React60__default.default.createElement(
|
|
5590
6329
|
material.Tab,
|
|
5591
6330
|
{
|
|
5592
6331
|
value: "editor",
|
|
5593
|
-
label: /* @__PURE__ */
|
|
6332
|
+
label: /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Edit" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.EditOutlined, { fontSize: "small" }))
|
|
5594
6333
|
}
|
|
5595
|
-
), /* @__PURE__ */
|
|
6334
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5596
6335
|
material.Tab,
|
|
5597
6336
|
{
|
|
5598
6337
|
value: "preview",
|
|
5599
|
-
label: /* @__PURE__ */
|
|
6338
|
+
label: /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Preview" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.PreviewOutlined, { fontSize: "small" }))
|
|
5600
6339
|
}
|
|
5601
|
-
), /* @__PURE__ */
|
|
6340
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5602
6341
|
material.Tab,
|
|
5603
6342
|
{
|
|
5604
6343
|
value: "html",
|
|
5605
|
-
label: /* @__PURE__ */
|
|
6344
|
+
label: /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "HTML output" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.CodeOutlined, { fontSize: "small" }))
|
|
5606
6345
|
}
|
|
5607
|
-
), /* @__PURE__ */
|
|
6346
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5608
6347
|
material.Tab,
|
|
5609
6348
|
{
|
|
5610
6349
|
value: "text",
|
|
5611
|
-
label: /* @__PURE__ */
|
|
6350
|
+
label: /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.SubjectOutlined, { fontSize: "small" }))
|
|
5612
6351
|
}
|
|
5613
|
-
), /* @__PURE__ */
|
|
6352
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5614
6353
|
material.Tab,
|
|
5615
6354
|
{
|
|
5616
6355
|
value: "json",
|
|
5617
|
-
label: /* @__PURE__ */
|
|
5618
|
-
}
|
|
5619
|
-
));
|
|
5620
|
-
}
|
|
5621
|
-
var SnackbarContext = React72.createContext(null);
|
|
5622
|
-
function useSnackbar() {
|
|
5623
|
-
const context = React72.useContext(SnackbarContext);
|
|
5624
|
-
if (!context) {
|
|
5625
|
-
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
5626
|
-
}
|
|
5627
|
-
return context;
|
|
5628
|
-
}
|
|
5629
|
-
function SnackbarProvider({ children }) {
|
|
5630
|
-
const [message, setMessage] = React72.useState(null);
|
|
5631
|
-
const [duration, setDuration] = React72.useState(3e3);
|
|
5632
|
-
const showMessage = (text, customDuration = 3e3) => {
|
|
5633
|
-
setMessage(text);
|
|
5634
|
-
setDuration(customDuration);
|
|
5635
|
-
};
|
|
5636
|
-
const handleClose = () => {
|
|
5637
|
-
setMessage(null);
|
|
5638
|
-
};
|
|
5639
|
-
return /* @__PURE__ */ React72__default.default.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React72__default.default.createElement(
|
|
5640
|
-
material.Snackbar,
|
|
5641
|
-
{
|
|
5642
|
-
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
5643
|
-
open: message !== null,
|
|
5644
|
-
onClose: handleClose,
|
|
5645
|
-
message,
|
|
5646
|
-
autoHideDuration: duration,
|
|
5647
|
-
sx: {
|
|
5648
|
-
zIndex: 1e4,
|
|
5649
|
-
// Very high z-index
|
|
5650
|
-
position: "fixed"
|
|
5651
|
-
// Make sure it's fixed positioned
|
|
5652
|
-
}
|
|
6356
|
+
label: /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "JSON output" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.DataObjectOutlined, { fontSize: "small" }))
|
|
5653
6357
|
}
|
|
5654
6358
|
));
|
|
5655
6359
|
}
|
|
5656
|
-
function SaveTemplateDialog({
|
|
5657
|
-
open,
|
|
5658
|
-
onClose,
|
|
5659
|
-
onSave,
|
|
5660
|
-
onNameChange,
|
|
5661
|
-
defaultName = "",
|
|
5662
|
-
error: externalError = null
|
|
5663
|
-
}) {
|
|
5664
|
-
const [templateName, setTemplateName] = React72.useState(defaultName);
|
|
5665
|
-
const [internalError, setInternalError] = React72.useState("");
|
|
5666
|
-
const [isSubmitting, setIsSubmitting] = React72.useState(false);
|
|
5667
|
-
React72.useEffect(() => {
|
|
5668
|
-
if (open) {
|
|
5669
|
-
setTemplateName(defaultName);
|
|
5670
|
-
setInternalError("");
|
|
5671
|
-
setIsSubmitting(false);
|
|
5672
|
-
}
|
|
5673
|
-
}, [open, defaultName]);
|
|
5674
|
-
const displayError = externalError || internalError;
|
|
5675
|
-
const handleNameChange = (e) => {
|
|
5676
|
-
setTemplateName(e.target.value);
|
|
5677
|
-
if (e.target.value.trim()) {
|
|
5678
|
-
setInternalError("");
|
|
5679
|
-
}
|
|
5680
|
-
if (onNameChange) {
|
|
5681
|
-
onNameChange();
|
|
5682
|
-
}
|
|
5683
|
-
};
|
|
5684
|
-
const handleSave = () => __async(null, null, function* () {
|
|
5685
|
-
if (!templateName.trim()) {
|
|
5686
|
-
setInternalError("Please enter a template name");
|
|
5687
|
-
return;
|
|
5688
|
-
}
|
|
5689
|
-
setIsSubmitting(true);
|
|
5690
|
-
try {
|
|
5691
|
-
const result = onSave(templateName);
|
|
5692
|
-
if (result instanceof Promise) {
|
|
5693
|
-
const success = yield result;
|
|
5694
|
-
if (success) {
|
|
5695
|
-
setTemplateName("");
|
|
5696
|
-
setInternalError("");
|
|
5697
|
-
onClose();
|
|
5698
|
-
}
|
|
5699
|
-
} else if (result !== false) {
|
|
5700
|
-
setTemplateName("");
|
|
5701
|
-
setInternalError("");
|
|
5702
|
-
onClose();
|
|
5703
|
-
}
|
|
5704
|
-
} catch (error) {
|
|
5705
|
-
console.error("Error saving template:", error);
|
|
5706
|
-
} finally {
|
|
5707
|
-
setIsSubmitting(false);
|
|
5708
|
-
}
|
|
5709
|
-
});
|
|
5710
|
-
const handleCancel = () => {
|
|
5711
|
-
setTemplateName("");
|
|
5712
|
-
setInternalError("");
|
|
5713
|
-
onClose();
|
|
5714
|
-
};
|
|
5715
|
-
return /* @__PURE__ */ React72__default.default.createElement(
|
|
5716
|
-
material.Dialog,
|
|
5717
|
-
{
|
|
5718
|
-
open,
|
|
5719
|
-
onClose: handleCancel,
|
|
5720
|
-
maxWidth: "sm",
|
|
5721
|
-
fullWidth: true
|
|
5722
|
-
},
|
|
5723
|
-
/* @__PURE__ */ React72__default.default.createElement(material.DialogTitle, null, "Save Email Template"),
|
|
5724
|
-
/* @__PURE__ */ React72__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React72__default.default.createElement(material.Box, { sx: { pt: 1 } }, /* @__PURE__ */ React72__default.default.createElement(
|
|
5725
|
-
material.TextField,
|
|
5726
|
-
{
|
|
5727
|
-
autoFocus: true,
|
|
5728
|
-
margin: "dense",
|
|
5729
|
-
id: "template-name",
|
|
5730
|
-
label: "Template Name",
|
|
5731
|
-
type: "text",
|
|
5732
|
-
fullWidth: true,
|
|
5733
|
-
variant: "outlined",
|
|
5734
|
-
value: templateName,
|
|
5735
|
-
onChange: handleNameChange,
|
|
5736
|
-
error: !!displayError,
|
|
5737
|
-
helperText: displayError,
|
|
5738
|
-
onKeyPress: (e) => {
|
|
5739
|
-
if (e.key === "Enter" && templateName.trim() && !displayError && !isSubmitting) {
|
|
5740
|
-
handleSave();
|
|
5741
|
-
}
|
|
5742
|
-
},
|
|
5743
|
-
disabled: isSubmitting
|
|
5744
|
-
}
|
|
5745
|
-
))),
|
|
5746
|
-
/* @__PURE__ */ React72__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React72__default.default.createElement(material.Button, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React72__default.default.createElement(
|
|
5747
|
-
material.Button,
|
|
5748
|
-
{
|
|
5749
|
-
onClick: handleSave,
|
|
5750
|
-
variant: "contained",
|
|
5751
|
-
color: "primary",
|
|
5752
|
-
disabled: !templateName.trim() || !!displayError || isSubmitting
|
|
5753
|
-
},
|
|
5754
|
-
isSubmitting ? "Saving..." : "Save Template"
|
|
5755
|
-
))
|
|
5756
|
-
);
|
|
5757
|
-
}
|
|
5758
|
-
|
|
5759
|
-
// src/app/email-canvas/save-button.tsx
|
|
5760
6360
|
function SaveButton({ loadTemplates, saveAs }) {
|
|
5761
|
-
const { saveTemplate, currentTemplateId, setCurrentTemplate } = useEmailEditor();
|
|
6361
|
+
const { saveTemplate, currentTemplateId, currentTemplateKind, setCurrentTemplate } = useEmailEditor();
|
|
5762
6362
|
const { showMessage } = useSnackbar();
|
|
5763
|
-
const [saveDialogOpen, setSaveDialogOpen] =
|
|
6363
|
+
const [saveDialogOpen, setSaveDialogOpen] = React60.useState(false);
|
|
5764
6364
|
const document2 = useDocument();
|
|
6365
|
+
const isSample = currentTemplateKind === "sample";
|
|
5765
6366
|
const handleSave = () => __async(null, null, function* () {
|
|
5766
6367
|
try {
|
|
5767
|
-
if (!currentTemplateId ||
|
|
6368
|
+
if (!currentTemplateId || isSample) {
|
|
5768
6369
|
setSaveDialogOpen(true);
|
|
5769
6370
|
return;
|
|
5770
6371
|
}
|
|
@@ -5781,8 +6382,8 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5781
6382
|
const handleSaveAs = (templateName) => __async(null, null, function* () {
|
|
5782
6383
|
try {
|
|
5783
6384
|
if (saveAs) {
|
|
5784
|
-
const { id: templateId,
|
|
5785
|
-
setCurrentTemplate(templateId,
|
|
6385
|
+
const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(document2));
|
|
6386
|
+
setCurrentTemplate(templateId, slug, "template");
|
|
5786
6387
|
if (loadTemplates) {
|
|
5787
6388
|
yield loadTemplates();
|
|
5788
6389
|
}
|
|
@@ -5798,7 +6399,7 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5798
6399
|
return false;
|
|
5799
6400
|
}
|
|
5800
6401
|
});
|
|
5801
|
-
return /* @__PURE__ */
|
|
6402
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
5802
6403
|
material.IconButton,
|
|
5803
6404
|
{
|
|
5804
6405
|
onClick: handleSave,
|
|
@@ -5809,23 +6410,23 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
5809
6410
|
}
|
|
5810
6411
|
}
|
|
5811
6412
|
},
|
|
5812
|
-
/* @__PURE__ */
|
|
5813
|
-
), /* @__PURE__ */
|
|
6413
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: isSample ? "Save as new template" : "Save template" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.SaveOutlined, { fontSize: "small" }))
|
|
6414
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5814
6415
|
SaveTemplateDialog,
|
|
5815
6416
|
{
|
|
5816
6417
|
open: saveDialogOpen,
|
|
5817
6418
|
onClose: () => setSaveDialogOpen(false),
|
|
5818
6419
|
onSave: handleSaveAs,
|
|
5819
|
-
defaultName:
|
|
6420
|
+
defaultName: isSample ? "New Template" : "New Template"
|
|
5820
6421
|
}
|
|
5821
6422
|
));
|
|
5822
6423
|
}
|
|
5823
6424
|
function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
5824
6425
|
const { setCurrentTemplate, loadTemplate } = useEmailEditor();
|
|
5825
6426
|
const { showMessage } = useSnackbar();
|
|
5826
|
-
const [saveDialogOpen, setSaveDialogOpen] =
|
|
5827
|
-
const [templates, setTemplates] =
|
|
5828
|
-
const [nameError, setNameError] =
|
|
6427
|
+
const [saveDialogOpen, setSaveDialogOpen] = React60.useState(false);
|
|
6428
|
+
const [templates, setTemplates] = React60.useState([]);
|
|
6429
|
+
const [nameError, setNameError] = React60.useState(null);
|
|
5829
6430
|
const fetchTemplates = () => __async(null, null, function* () {
|
|
5830
6431
|
if (loadTemplates) {
|
|
5831
6432
|
try {
|
|
@@ -5845,7 +6446,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5845
6446
|
});
|
|
5846
6447
|
const validateTemplateName = (name) => {
|
|
5847
6448
|
const nameExists = templates.some(
|
|
5848
|
-
(template) => template.
|
|
6449
|
+
(template) => template.slug.toLowerCase() === name.toLowerCase()
|
|
5849
6450
|
);
|
|
5850
6451
|
if (nameExists) {
|
|
5851
6452
|
setNameError("A template with this name already exists");
|
|
@@ -5863,10 +6464,10 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5863
6464
|
}
|
|
5864
6465
|
try {
|
|
5865
6466
|
if (saveAs) {
|
|
5866
|
-
const { id: templateId,
|
|
6467
|
+
const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(empty_email_message_default));
|
|
5867
6468
|
resetDocument(empty_email_message_default);
|
|
5868
|
-
setCurrentTemplate(templateId,
|
|
5869
|
-
loadTemplate(empty_email_message_default, templateId,
|
|
6469
|
+
setCurrentTemplate(templateId, slug, "template");
|
|
6470
|
+
loadTemplate(empty_email_message_default, templateId, slug, "template");
|
|
5870
6471
|
if (loadTemplates) {
|
|
5871
6472
|
yield loadTemplates();
|
|
5872
6473
|
}
|
|
@@ -5880,7 +6481,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5880
6481
|
}
|
|
5881
6482
|
return false;
|
|
5882
6483
|
});
|
|
5883
|
-
return /* @__PURE__ */
|
|
6484
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
5884
6485
|
material.IconButton,
|
|
5885
6486
|
{
|
|
5886
6487
|
onClick: handleNewTemplate,
|
|
@@ -5891,8 +6492,8 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5891
6492
|
}
|
|
5892
6493
|
}
|
|
5893
6494
|
},
|
|
5894
|
-
/* @__PURE__ */
|
|
5895
|
-
), /* @__PURE__ */
|
|
6495
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "New template" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.Add, { fontSize: "small" }))
|
|
6496
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
5896
6497
|
SaveTemplateDialog,
|
|
5897
6498
|
{
|
|
5898
6499
|
open: saveDialogOpen,
|
|
@@ -5907,6 +6508,48 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
5907
6508
|
}
|
|
5908
6509
|
));
|
|
5909
6510
|
}
|
|
6511
|
+
function SubjectInput() {
|
|
6512
|
+
var _a;
|
|
6513
|
+
const document2 = useDocument();
|
|
6514
|
+
const root = document2.root;
|
|
6515
|
+
if (!root || root.type !== "EmailLayout") return null;
|
|
6516
|
+
const data = root.data;
|
|
6517
|
+
const subject = (_a = data.subject) != null ? _a : "";
|
|
6518
|
+
const handleChange = (value) => {
|
|
6519
|
+
setDocument({
|
|
6520
|
+
root: __spreadProps(__spreadValues({}, root), { data: __spreadProps(__spreadValues({}, data), { subject: value }) })
|
|
6521
|
+
});
|
|
6522
|
+
};
|
|
6523
|
+
return /* @__PURE__ */ React60__default.default.createElement(
|
|
6524
|
+
material.Box,
|
|
6525
|
+
{
|
|
6526
|
+
sx: {
|
|
6527
|
+
px: 3,
|
|
6528
|
+
py: 1.25,
|
|
6529
|
+
borderBottom: 1,
|
|
6530
|
+
borderColor: "divider",
|
|
6531
|
+
backgroundColor: "white",
|
|
6532
|
+
position: "sticky",
|
|
6533
|
+
top: 49,
|
|
6534
|
+
zIndex: "appBar",
|
|
6535
|
+
display: "flex",
|
|
6536
|
+
alignItems: "center",
|
|
6537
|
+
gap: 1.5
|
|
6538
|
+
}
|
|
6539
|
+
},
|
|
6540
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
|
|
6541
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
6542
|
+
material.InputBase,
|
|
6543
|
+
{
|
|
6544
|
+
fullWidth: true,
|
|
6545
|
+
placeholder: "Email subject \u2014 supports {{variables}}",
|
|
6546
|
+
value: subject,
|
|
6547
|
+
onChange: (e) => handleChange(e.target.value),
|
|
6548
|
+
sx: { fontSize: 14 }
|
|
6549
|
+
}
|
|
6550
|
+
)
|
|
6551
|
+
);
|
|
6552
|
+
}
|
|
5910
6553
|
|
|
5911
6554
|
// src/app/email-canvas/index.tsx
|
|
5912
6555
|
function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true }) {
|
|
@@ -5939,19 +6582,19 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
5939
6582
|
const renderMainPanel = () => {
|
|
5940
6583
|
switch (selectedMainTab) {
|
|
5941
6584
|
case "editor":
|
|
5942
|
-
return /* @__PURE__ */
|
|
6585
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: mainBoxSx }, /* @__PURE__ */ React60__default.default.createElement(EditorBlock, { id: "root" }));
|
|
5943
6586
|
case "preview":
|
|
5944
|
-
return /* @__PURE__ */
|
|
6587
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: mainBoxSx }, /* @__PURE__ */ React60__default.default.createElement(Reader, { document: document2, rootBlockId: "root" }));
|
|
5945
6588
|
case "html":
|
|
5946
|
-
return /* @__PURE__ */
|
|
6589
|
+
return /* @__PURE__ */ React60__default.default.createElement(HtmlPanel, null);
|
|
5947
6590
|
case "text":
|
|
5948
|
-
return /* @__PURE__ */
|
|
6591
|
+
return /* @__PURE__ */ React60__default.default.createElement(TextPanel, null);
|
|
5949
6592
|
case "json":
|
|
5950
|
-
return /* @__PURE__ */
|
|
6593
|
+
return /* @__PURE__ */ React60__default.default.createElement(JsonPanel, null);
|
|
5951
6594
|
}
|
|
5952
6595
|
};
|
|
5953
6596
|
const showSaveButtons = persistenceEnabled;
|
|
5954
|
-
return /* @__PURE__ */
|
|
6597
|
+
return /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
5955
6598
|
material.Stack,
|
|
5956
6599
|
{
|
|
5957
6600
|
sx: {
|
|
@@ -5968,10 +6611,10 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
5968
6611
|
justifyContent: "space-between",
|
|
5969
6612
|
alignItems: "center"
|
|
5970
6613
|
},
|
|
5971
|
-
samplesDrawerEnabled && /* @__PURE__ */
|
|
5972
|
-
/* @__PURE__ */
|
|
5973
|
-
/* @__PURE__ */
|
|
5974
|
-
), /* @__PURE__ */
|
|
6614
|
+
samplesDrawerEnabled && /* @__PURE__ */ React60__default.default.createElement(ToggleSamplesPanelButton, null),
|
|
6615
|
+
/* @__PURE__ */ React60__default.default.createElement(material.Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60__default.default.createElement(MainTabsGroup, null)), /* @__PURE__ */ React60__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React60__default.default.createElement(material.ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "desktop" }, /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React60__default.default.createElement(material.ToggleButton, { value: "mobile" }, /* @__PURE__ */ React60__default.default.createElement(material.Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React60__default.default.createElement(iconsMaterial.PhoneIphoneOutlined, { fontSize: "small" })))), showSaveButtons && /* @__PURE__ */ React60__default.default.createElement(React60__default.default.Fragment, null, /* @__PURE__ */ React60__default.default.createElement(NewTemplateButton, { loadTemplates, saveAs }), /* @__PURE__ */ React60__default.default.createElement(SaveButton, { loadTemplates, saveAs })))),
|
|
6616
|
+
/* @__PURE__ */ React60__default.default.createElement(ToggleInspectorPanelButton, null)
|
|
6617
|
+
), selectedMainTab === "editor" && /* @__PURE__ */ React60__default.default.createElement(SubjectInput, null), /* @__PURE__ */ React60__default.default.createElement(material.Box, { sx: {
|
|
5975
6618
|
paddingBottom: "50px",
|
|
5976
6619
|
minWidth: 370
|
|
5977
6620
|
} }, renderMainPanel()));
|
|
@@ -6010,7 +6653,7 @@ function useDrawerTransition(cssProperty, open) {
|
|
|
6010
6653
|
duration: !open ? transitions.duration.leavingScreen : transitions.duration.enteringScreen
|
|
6011
6654
|
});
|
|
6012
6655
|
}
|
|
6013
|
-
var EmailEditorInternal =
|
|
6656
|
+
var EmailEditorInternal = React60.forwardRef((props, ref) => {
|
|
6014
6657
|
const {
|
|
6015
6658
|
drawerEnterDuration = 225,
|
|
6016
6659
|
drawerExitDuration = 225,
|
|
@@ -6021,6 +6664,8 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6021
6664
|
loadTemplate,
|
|
6022
6665
|
deleteTemplate,
|
|
6023
6666
|
copyTemplate,
|
|
6667
|
+
renameTemplate,
|
|
6668
|
+
setTemplateKind,
|
|
6024
6669
|
saveAs,
|
|
6025
6670
|
onChange
|
|
6026
6671
|
} = props;
|
|
@@ -6030,10 +6675,10 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6030
6675
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
6031
6676
|
const marginLeftTransition = useDrawerTransition("margin-left", samplesDrawerOpen);
|
|
6032
6677
|
const marginRightTransition = useDrawerTransition("margin-right", inspectorDrawerOpen);
|
|
6033
|
-
const onChangeRef =
|
|
6678
|
+
const onChangeRef = React60.useRef(onChange);
|
|
6034
6679
|
onChangeRef.current = onChange;
|
|
6035
|
-
const prevDocJsonRef =
|
|
6036
|
-
|
|
6680
|
+
const prevDocJsonRef = React60.useRef("");
|
|
6681
|
+
React60.useEffect(() => {
|
|
6037
6682
|
var _a;
|
|
6038
6683
|
const docJson = JSON.stringify(currentDocument);
|
|
6039
6684
|
if (docJson !== prevDocJsonRef.current) {
|
|
@@ -6041,7 +6686,7 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6041
6686
|
(_a = onChangeRef.current) == null ? void 0 : _a.call(onChangeRef, currentDocument);
|
|
6042
6687
|
}
|
|
6043
6688
|
}, [currentDocument]);
|
|
6044
|
-
|
|
6689
|
+
React60.useImperativeHandle(ref, () => ({
|
|
6045
6690
|
saveTemplate: () => {
|
|
6046
6691
|
return saveTemplate();
|
|
6047
6692
|
},
|
|
@@ -6053,7 +6698,7 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6053
6698
|
return getDocument();
|
|
6054
6699
|
}
|
|
6055
6700
|
}));
|
|
6056
|
-
return /* @__PURE__ */
|
|
6701
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React60__default.default.createElement(
|
|
6057
6702
|
InspectorDrawer,
|
|
6058
6703
|
{
|
|
6059
6704
|
enterDuration: drawerEnterDuration,
|
|
@@ -6061,7 +6706,7 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6061
6706
|
deleteTemplate,
|
|
6062
6707
|
copyTemplate
|
|
6063
6708
|
}
|
|
6064
|
-
), /* @__PURE__ */
|
|
6709
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
6065
6710
|
SamplesDrawer,
|
|
6066
6711
|
{
|
|
6067
6712
|
enterDuration: drawerEnterDuration,
|
|
@@ -6071,9 +6716,13 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6071
6716
|
loadTemplates,
|
|
6072
6717
|
loadTemplate,
|
|
6073
6718
|
currentTemplateId,
|
|
6074
|
-
deleteTemplate
|
|
6719
|
+
deleteTemplate,
|
|
6720
|
+
copyTemplate,
|
|
6721
|
+
renameTemplate,
|
|
6722
|
+
setTemplateKind,
|
|
6723
|
+
saveAs
|
|
6075
6724
|
}
|
|
6076
|
-
), /* @__PURE__ */
|
|
6725
|
+
), /* @__PURE__ */ React60__default.default.createElement(
|
|
6077
6726
|
material.Stack,
|
|
6078
6727
|
{
|
|
6079
6728
|
sx: {
|
|
@@ -6082,10 +6731,10 @@ var EmailEditorInternal = React72.forwardRef((props, ref) => {
|
|
|
6082
6731
|
transition: [marginLeftTransition, marginRightTransition].join(", ")
|
|
6083
6732
|
}
|
|
6084
6733
|
},
|
|
6085
|
-
/* @__PURE__ */
|
|
6734
|
+
/* @__PURE__ */ React60__default.default.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
|
|
6086
6735
|
));
|
|
6087
6736
|
});
|
|
6088
|
-
var EmailEditor =
|
|
6737
|
+
var EmailEditor = React60.forwardRef((props, ref) => {
|
|
6089
6738
|
const {
|
|
6090
6739
|
initialTemplate: initialTemplateProp,
|
|
6091
6740
|
initialTemplateId,
|
|
@@ -6102,22 +6751,24 @@ var EmailEditor = React72.forwardRef((props, ref) => {
|
|
|
6102
6751
|
loadTemplate,
|
|
6103
6752
|
deleteTemplate,
|
|
6104
6753
|
copyTemplate,
|
|
6754
|
+
renameTemplate,
|
|
6755
|
+
setTemplateKind,
|
|
6105
6756
|
saveAs,
|
|
6106
6757
|
theme
|
|
6107
6758
|
} = props;
|
|
6108
|
-
const resolvedTemplate =
|
|
6759
|
+
const resolvedTemplate = React60.useMemo(
|
|
6109
6760
|
() => typeof initialTemplateProp === "string" ? htmlToEditorConfig(initialTemplateProp) : initialTemplateProp,
|
|
6110
6761
|
[initialTemplateProp]
|
|
6111
6762
|
);
|
|
6112
|
-
const prevTemplateRef =
|
|
6763
|
+
const prevTemplateRef = React60.useRef(void 0);
|
|
6113
6764
|
if (resolvedTemplate && resolvedTemplate !== prevTemplateRef.current) {
|
|
6114
6765
|
prevTemplateRef.current = resolvedTemplate;
|
|
6115
6766
|
resetDocument(resolvedTemplate);
|
|
6116
6767
|
}
|
|
6117
|
-
|
|
6768
|
+
React60.useEffect(() => {
|
|
6118
6769
|
setPersistenceEnabled(persistenceEnabled);
|
|
6119
6770
|
}, [persistenceEnabled]);
|
|
6120
|
-
return /* @__PURE__ */
|
|
6771
|
+
return /* @__PURE__ */ React60__default.default.createElement(material.ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React60__default.default.createElement(material.CssBaseline, null), /* @__PURE__ */ React60__default.default.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React60__default.default.createElement(SnackbarProvider, null, /* @__PURE__ */ React60__default.default.createElement(
|
|
6121
6772
|
EmailEditorProvider,
|
|
6122
6773
|
{
|
|
6123
6774
|
initialTemplate: resolvedTemplate,
|
|
@@ -6126,7 +6777,7 @@ var EmailEditor = React72.forwardRef((props, ref) => {
|
|
|
6126
6777
|
onSave,
|
|
6127
6778
|
onChange
|
|
6128
6779
|
},
|
|
6129
|
-
/* @__PURE__ */
|
|
6780
|
+
/* @__PURE__ */ React60__default.default.createElement(
|
|
6130
6781
|
EmailEditorInternal,
|
|
6131
6782
|
{
|
|
6132
6783
|
ref,
|
|
@@ -6139,6 +6790,8 @@ var EmailEditor = React72.forwardRef((props, ref) => {
|
|
|
6139
6790
|
loadTemplate,
|
|
6140
6791
|
deleteTemplate,
|
|
6141
6792
|
copyTemplate,
|
|
6793
|
+
renameTemplate,
|
|
6794
|
+
setTemplateKind,
|
|
6142
6795
|
saveAs,
|
|
6143
6796
|
onChange
|
|
6144
6797
|
}
|
|
@@ -6197,6 +6850,7 @@ exports.Spacer = spacer_default;
|
|
|
6197
6850
|
exports.SpacerProps = SpacerProps;
|
|
6198
6851
|
exports.SpacerPropsDefaults = SpacerPropsDefaults;
|
|
6199
6852
|
exports.SpacerPropsSchema = SpacerPropsSchema;
|
|
6853
|
+
exports.TemplateVariableSchema = TemplateVariableSchema;
|
|
6200
6854
|
exports.Text = Text;
|
|
6201
6855
|
exports.TextProps = TextProps;
|
|
6202
6856
|
exports.TextPropsDefaults = TextPropsDefaults;
|