@kontakto/email-template-editor 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +966 -765
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +772 -572
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
package/dist/index.cjs
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var DOMPurify = require('dompurify');
|
|
4
4
|
var marked = require('marked');
|
|
5
|
-
var
|
|
5
|
+
var React57 = require('react');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
var server = require('react-dom/server');
|
|
8
8
|
var Handlebars = require('handlebars');
|
|
9
9
|
var styles = require('@mui/material/styles');
|
|
10
|
+
var react = require('@lingui/react');
|
|
10
11
|
var material = require('@mui/material');
|
|
12
|
+
var core = require('@lingui/core');
|
|
11
13
|
var zustand = require('zustand');
|
|
12
14
|
var iconsMaterial = require('@mui/icons-material');
|
|
13
15
|
var reactColorful = require('react-colorful');
|
|
@@ -19,7 +21,7 @@ var htmlfy = require('htmlfy');
|
|
|
19
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
22
|
|
|
21
23
|
var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
|
|
22
|
-
var
|
|
24
|
+
var React57__default = /*#__PURE__*/_interopDefault(React57);
|
|
23
25
|
var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
|
|
24
26
|
var hljs__default = /*#__PURE__*/_interopDefault(hljs);
|
|
25
27
|
var jsonHighlighter__default = /*#__PURE__*/_interopDefault(jsonHighlighter);
|
|
@@ -191,8 +193,8 @@ function renderInlineMarkdownString(str) {
|
|
|
191
193
|
}
|
|
192
194
|
function EmailMarkdown(_a) {
|
|
193
195
|
var _b = _a, { markdown } = _b, props = __objRest(_b, ["markdown"]);
|
|
194
|
-
const data =
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
+
const data = React57.useMemo(() => renderMarkdownString(markdown), [markdown]);
|
|
197
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", __spreadProps(__spreadValues({}, props), { dangerouslySetInnerHTML: { __html: data } }));
|
|
196
198
|
}
|
|
197
199
|
var FONT_FAMILY_SCHEMA = zod.z.enum([
|
|
198
200
|
"MODERN_SANS",
|
|
@@ -272,9 +274,9 @@ function Text({ style, props }) {
|
|
|
272
274
|
};
|
|
273
275
|
const text = (_g = props == null ? void 0 : props.text) != null ? _g : TextPropsDefaults.text;
|
|
274
276
|
if (props == null ? void 0 : props.markdown) {
|
|
275
|
-
return /* @__PURE__ */
|
|
277
|
+
return /* @__PURE__ */ React57__default.default.createElement(EmailMarkdown, { style: wStyle, markdown: text });
|
|
276
278
|
}
|
|
277
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wStyle }, text);
|
|
278
280
|
}
|
|
279
281
|
var PADDING_SCHEMA2 = zod.z.object({
|
|
280
282
|
top: zod.z.number(),
|
|
@@ -323,7 +325,7 @@ function Avatar({ style, props }) {
|
|
|
323
325
|
textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
|
|
324
326
|
padding: getPadding2(style == null ? void 0 : style.padding)
|
|
325
327
|
};
|
|
326
|
-
return /* @__PURE__ */
|
|
328
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React57__default.default.createElement(
|
|
327
329
|
"img",
|
|
328
330
|
{
|
|
329
331
|
alt,
|
|
@@ -475,14 +477,14 @@ function Button({ style, props }) {
|
|
|
475
477
|
padding: `${padding[0]}px ${padding[1]}px`,
|
|
476
478
|
textDecoration: "none"
|
|
477
479
|
};
|
|
478
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React57__default.default.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
479
481
|
"span",
|
|
480
482
|
{
|
|
481
483
|
dangerouslySetInnerHTML: {
|
|
482
484
|
__html: `<!--[if mso]><i style="letter-spacing: ${padding[1]}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
483
485
|
}
|
|
484
486
|
}
|
|
485
|
-
), /* @__PURE__ */
|
|
487
|
+
), /* @__PURE__ */ React57__default.default.createElement("span", null, text), /* @__PURE__ */ React57__default.default.createElement(
|
|
486
488
|
"span",
|
|
487
489
|
{
|
|
488
490
|
dangerouslySetInnerHTML: {
|
|
@@ -531,7 +533,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
531
533
|
contentAlignment: (_d = props == null ? void 0 : props.contentAlignment) != null ? _d : ColumnsContainerPropsDefaults.contentAlignment,
|
|
532
534
|
fixedWidths: props == null ? void 0 : props.fixedWidths
|
|
533
535
|
};
|
|
534
|
-
return /* @__PURE__ */
|
|
536
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wStyle }, /* @__PURE__ */ React57__default.default.createElement(
|
|
535
537
|
"table",
|
|
536
538
|
{
|
|
537
539
|
align: "center",
|
|
@@ -540,7 +542,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
540
542
|
border: 0,
|
|
541
543
|
style: { tableLayout: "fixed", borderCollapse: "collapse" }
|
|
542
544
|
},
|
|
543
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ React57__default.default.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React57__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React57__default.default.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React57__default.default.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React57__default.default.createElement(TableCell, { index: 2, props: blockProps, columns })))
|
|
544
546
|
));
|
|
545
547
|
}
|
|
546
548
|
function TableCell({ index, props, columns }) {
|
|
@@ -558,7 +560,7 @@ function TableCell({ index, props, columns }) {
|
|
|
558
560
|
width: (_d = (_c = props.fixedWidths) == null ? void 0 : _c[index]) != null ? _d : void 0
|
|
559
561
|
};
|
|
560
562
|
const children = (_e = columns && columns[index]) != null ? _e : null;
|
|
561
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ React57__default.default.createElement("td", { style }, children);
|
|
562
564
|
}
|
|
563
565
|
function getPaddingBefore(index, { columnsGap, columnsCount }) {
|
|
564
566
|
if (index === 0) {
|
|
@@ -620,9 +622,9 @@ function Container({ style, children }) {
|
|
|
620
622
|
padding: getPadding5(style == null ? void 0 : style.padding)
|
|
621
623
|
};
|
|
622
624
|
if (!children) {
|
|
623
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wStyle });
|
|
624
626
|
}
|
|
625
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wStyle }, children);
|
|
626
628
|
}
|
|
627
629
|
var container_default = Container;
|
|
628
630
|
var COLOR_SCHEMA5 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
@@ -656,7 +658,7 @@ function Divider({ style, props }) {
|
|
|
656
658
|
};
|
|
657
659
|
const borderTopWidth = (_b = props == null ? void 0 : props.lineHeight) != null ? _b : DividerPropsDefaults.lineHeight;
|
|
658
660
|
const borderTopColor = (_c = props == null ? void 0 : props.lineColor) != null ? _c : DividerPropsDefaults.lineColor;
|
|
659
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: st }, /* @__PURE__ */ React57__default.default.createElement(
|
|
660
662
|
"hr",
|
|
661
663
|
{
|
|
662
664
|
style: {
|
|
@@ -750,15 +752,15 @@ function Heading({ props, style }) {
|
|
|
750
752
|
fontSize: getFontSize(level),
|
|
751
753
|
padding: getPadding7(style == null ? void 0 : style.padding)
|
|
752
754
|
};
|
|
753
|
-
const html2 =
|
|
755
|
+
const html2 = React57.useMemo(() => isMarkdown ? renderInlineMarkdownString(text) : null, [isMarkdown, text]);
|
|
754
756
|
const renderProps = isMarkdown ? { style: hStyle, dangerouslySetInnerHTML: { __html: html2 != null ? html2 : "" } } : { style: hStyle, children: text };
|
|
755
757
|
switch (level) {
|
|
756
758
|
case "h1":
|
|
757
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ React57__default.default.createElement("h1", __spreadValues({}, renderProps));
|
|
758
760
|
case "h2":
|
|
759
|
-
return /* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ React57__default.default.createElement("h2", __spreadValues({}, renderProps));
|
|
760
762
|
case "h3":
|
|
761
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ React57__default.default.createElement("h3", __spreadValues({}, renderProps));
|
|
762
764
|
}
|
|
763
765
|
}
|
|
764
766
|
function getFontSize(level) {
|
|
@@ -840,9 +842,9 @@ function Html({ style, props }) {
|
|
|
840
842
|
padding: getPadding8(style == null ? void 0 : style.padding)
|
|
841
843
|
};
|
|
842
844
|
if (!children) {
|
|
843
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: cssStyle });
|
|
844
846
|
}
|
|
845
|
-
return /* @__PURE__ */
|
|
847
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
846
848
|
}
|
|
847
849
|
var html_default = Html;
|
|
848
850
|
var PADDING_SCHEMA9 = zod.z.object({
|
|
@@ -878,7 +880,7 @@ function Image({ style, props }) {
|
|
|
878
880
|
const linkHref = (_c = props == null ? void 0 : props.linkHref) != null ? _c : null;
|
|
879
881
|
const width = (_d = props == null ? void 0 : props.width) != null ? _d : void 0;
|
|
880
882
|
const height = (_e = props == null ? void 0 : props.height) != null ? _e : void 0;
|
|
881
|
-
const imageElement = /* @__PURE__ */
|
|
883
|
+
const imageElement = /* @__PURE__ */ React57__default.default.createElement(
|
|
882
884
|
"img",
|
|
883
885
|
{
|
|
884
886
|
alt: (_f = props == null ? void 0 : props.alt) != null ? _f : "",
|
|
@@ -898,9 +900,9 @@ function Image({ style, props }) {
|
|
|
898
900
|
}
|
|
899
901
|
);
|
|
900
902
|
if (!linkHref) {
|
|
901
|
-
return /* @__PURE__ */
|
|
903
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: sectionStyle }, imageElement);
|
|
902
904
|
}
|
|
903
|
-
return /* @__PURE__ */
|
|
905
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React57__default.default.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
|
|
904
906
|
}
|
|
905
907
|
var image_default = Image;
|
|
906
908
|
var FONT_FAMILY_SCHEMA5 = zod.z.enum([
|
|
@@ -1046,7 +1048,7 @@ function Signature({ style, props }) {
|
|
|
1046
1048
|
color: linkColor,
|
|
1047
1049
|
textDecoration: "none"
|
|
1048
1050
|
};
|
|
1049
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
1051
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React57__default.default.createElement(
|
|
1050
1052
|
"img",
|
|
1051
1053
|
{
|
|
1052
1054
|
src: imageUrl,
|
|
@@ -1065,18 +1067,18 @@ function Signature({ style, props }) {
|
|
|
1065
1067
|
}
|
|
1066
1068
|
) : null;
|
|
1067
1069
|
const contactParts = [];
|
|
1068
|
-
if (email) contactParts.push(/* @__PURE__ */
|
|
1069
|
-
if (phone) contactParts.push(/* @__PURE__ */
|
|
1070
|
+
if (email) contactParts.push(/* @__PURE__ */ React57__default.default.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
|
|
1071
|
+
if (phone) contactParts.push(/* @__PURE__ */ React57__default.default.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
|
|
1070
1072
|
if (website) {
|
|
1071
1073
|
const href = website.startsWith("http") ? website : `https://${website}`;
|
|
1072
|
-
contactParts.push(/* @__PURE__ */
|
|
1074
|
+
contactParts.push(/* @__PURE__ */ React57__default.default.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
|
|
1073
1075
|
}
|
|
1074
|
-
const textContent = /* @__PURE__ */
|
|
1075
|
-
const greetingElement = greeting ? /* @__PURE__ */
|
|
1076
|
+
const textContent = /* @__PURE__ */ React57__default.default.createElement("div", null, name && /* @__PURE__ */ React57__default.default.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React57__default.default.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React57__default.default.createElement("span", { style: detailStyle }, " \xB7 "), part))));
|
|
1077
|
+
const greetingElement = greeting ? /* @__PURE__ */ React57__default.default.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
1076
1078
|
if (layout === "vertical") {
|
|
1077
|
-
return /* @__PURE__ */
|
|
1079
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React57__default.default.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
1078
1080
|
}
|
|
1079
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React57__default.default.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React57__default.default.createElement("tbody", null, /* @__PURE__ */ React57__default.default.createElement("tr", null, imageElement && /* @__PURE__ */ React57__default.default.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React57__default.default.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
1080
1082
|
}
|
|
1081
1083
|
var signature_default = Signature;
|
|
1082
1084
|
var SpacerPropsSchema = zod.z.object({
|
|
@@ -1093,13 +1095,13 @@ function Spacer({ props }) {
|
|
|
1093
1095
|
const style = {
|
|
1094
1096
|
height: (_a = props == null ? void 0 : props.height) != null ? _a : SpacerPropsDefaults.height
|
|
1095
1097
|
};
|
|
1096
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style });
|
|
1097
1099
|
}
|
|
1098
1100
|
var spacer_default = Spacer;
|
|
1099
1101
|
function buildBlockComponent(blocks) {
|
|
1100
1102
|
return function BlockComponent({ type, data }) {
|
|
1101
1103
|
const Component = blocks[type].Component;
|
|
1102
|
-
return /* @__PURE__ */
|
|
1104
|
+
return /* @__PURE__ */ React57__default.default.createElement(Component, __spreadValues({}, data));
|
|
1103
1105
|
};
|
|
1104
1106
|
}
|
|
1105
1107
|
function buildBlockConfigurationSchema(blocks) {
|
|
@@ -1168,9 +1170,9 @@ function ColumnsContainerReader({ style, props }) {
|
|
|
1168
1170
|
const _a = props != null ? props : {}, { columns } = _a, restProps = __objRest(_a, ["columns"]);
|
|
1169
1171
|
let cols = void 0;
|
|
1170
1172
|
if (columns) {
|
|
1171
|
-
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */
|
|
1173
|
+
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React57__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1172
1174
|
}
|
|
1173
|
-
return /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ React57__default.default.createElement(columns_container_default, { props: restProps, columns: cols, style });
|
|
1174
1176
|
}
|
|
1175
1177
|
var ContainerPropsSchema2 = zod.z.object({
|
|
1176
1178
|
style: ContainerPropsSchema.shape.style,
|
|
@@ -1181,7 +1183,7 @@ var ContainerPropsSchema2 = zod.z.object({
|
|
|
1181
1183
|
function ContainerReader({ style, props }) {
|
|
1182
1184
|
var _a;
|
|
1183
1185
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
1184
|
-
return /* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ React57__default.default.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React57__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1185
1187
|
}
|
|
1186
1188
|
var COLOR_SCHEMA9 = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
1187
1189
|
var FONT_FAMILY_SCHEMA6 = zod.z.enum([
|
|
@@ -1254,9 +1256,9 @@ function EmailLayoutReader(props) {
|
|
|
1254
1256
|
margin: "0"
|
|
1255
1257
|
};
|
|
1256
1258
|
if (props.backdropDisabled) {
|
|
1257
|
-
return /* @__PURE__ */
|
|
1259
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React57__default.default.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
1258
1260
|
}
|
|
1259
|
-
return /* @__PURE__ */
|
|
1261
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
1260
1262
|
"div",
|
|
1261
1263
|
{
|
|
1262
1264
|
style: __spreadProps(__spreadValues({}, baseStyle), {
|
|
@@ -1266,7 +1268,7 @@ function EmailLayoutReader(props) {
|
|
|
1266
1268
|
width: "100%"
|
|
1267
1269
|
})
|
|
1268
1270
|
},
|
|
1269
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
1270
1272
|
"table",
|
|
1271
1273
|
{
|
|
1272
1274
|
align: "center",
|
|
@@ -1284,19 +1286,19 @@ function EmailLayoutReader(props) {
|
|
|
1284
1286
|
cellPadding: "0",
|
|
1285
1287
|
border: 0
|
|
1286
1288
|
},
|
|
1287
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ React57__default.default.createElement("tbody", null, /* @__PURE__ */ React57__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React57__default.default.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React57__default.default.createElement(ReaderBlock, { key: childId, id: childId })))))
|
|
1288
1290
|
)
|
|
1289
1291
|
);
|
|
1290
1292
|
}
|
|
1291
1293
|
|
|
1292
1294
|
// src/email-builder/reader/core.tsx
|
|
1293
|
-
var ReaderContext =
|
|
1295
|
+
var ReaderContext = React57.createContext({});
|
|
1294
1296
|
function useReaderDocument() {
|
|
1295
|
-
return
|
|
1297
|
+
return React57.useContext(ReaderContext);
|
|
1296
1298
|
}
|
|
1297
1299
|
function ReaderBlock({ id }) {
|
|
1298
1300
|
const document2 = useReaderDocument();
|
|
1299
|
-
return document2[id] ? /* @__PURE__ */
|
|
1301
|
+
return document2[id] ? /* @__PURE__ */ React57__default.default.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
|
|
1300
1302
|
}
|
|
1301
1303
|
var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
1302
1304
|
ColumnsContainer: {
|
|
@@ -1353,13 +1355,13 @@ var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
|
|
|
1353
1355
|
var ReaderDocumentSchema = zod.z.record(zod.z.string(), ReaderBlockSchema);
|
|
1354
1356
|
var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
|
|
1355
1357
|
function Reader({ document: document2, rootBlockId }) {
|
|
1356
|
-
return /* @__PURE__ */
|
|
1358
|
+
return /* @__PURE__ */ React57__default.default.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React57__default.default.createElement(ReaderBlock, { id: rootBlockId }));
|
|
1357
1359
|
}
|
|
1358
1360
|
|
|
1359
1361
|
// src/email-builder/renderers/render-to-static-markup.tsx
|
|
1360
1362
|
function renderToStaticMarkup(document2, { rootBlockId, variables }) {
|
|
1361
1363
|
const html2 = "<!DOCTYPE html>" + server.renderToStaticMarkup(
|
|
1362
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ React57__default.default.createElement("html", null, /* @__PURE__ */ React57__default.default.createElement("body", null, /* @__PURE__ */ React57__default.default.createElement(Reader, { document: document2, rootBlockId })))
|
|
1363
1365
|
);
|
|
1364
1366
|
if (!variables) return html2;
|
|
1365
1367
|
return evaluateHandlebars(html2, variables);
|
|
@@ -2011,6 +2013,37 @@ var THEME = styles.createTheme(BASE_THEME, {
|
|
|
2011
2013
|
]
|
|
2012
2014
|
});
|
|
2013
2015
|
var theme_default = THEME;
|
|
2016
|
+
|
|
2017
|
+
// src/locales/en/messages.ts
|
|
2018
|
+
var messages = JSON.parse('{"drawer.library":["Library"],"drawer.new-sample":["New sample"],"drawer.new-template":["New template"],"drawer.no-samples":["No samples available"],"drawer.no-samples-match":["No samples match your filters"],"drawer.no-templates":["No saved templates yet"],"drawer.no-templates-match":["No templates match your filters"],"drawer.search-samples":["Search samples"],"drawer.search-templates":["Search templates"],"drawer.sort-by":["Sort by"],"drawer.tab.outline":["Outline"],"drawer.tab.samples":["Samples"],"drawer.tab.templates":["Templates"],"drawer.tag.all":["All"],"panel.avatar-block":["Avatar block"],"panel.button-block":["Button block"],"panel.columns-block":["Columns block"],"panel.container-block":["Container block"],"panel.divider-block":["Divider block"],"panel.editor-appearance":["Editor appearance"],"panel.export":["Export"],"panel.global":["Global"],"panel.heading-block":["Heading block"],"panel.html-block":["HTML block"],"panel.image-block":["Image block"],"panel.signature-block":["Signature block"],"panel.spacer-block":["Spacer block"],"panel.template":["Template"],"panel.text-block":["Text block"],"savebar.error-saving":["Error saving"],"savebar.new":["New"],"savebar.new-template-created":["New template created"],"savebar.sample-prefix":["Sample"],"savebar.sample-saved":["Sample saved"],"savebar.save":["Save"],"savebar.save-as":["Save as\u2026"],"savebar.save-as-new":["Save as new\u2026"],"savebar.save-as-new-template":["Save as a new template"],"savebar.save-changes":["Save changes"],"savebar.save-changes-to-sample":["Save changes to this sample"],"savebar.start-fresh":["Start a fresh template"],"savebar.template-saved":["Template saved"],"sort.last-updated":["Last updated"],"sort.name":["Name (A\u2013Z)"],"sort.recently-created":["Recently created"],"style.alignment":["Alignment"],"style.background-color":["Background color"],"style.border-color":["Border color"],"style.border-radius":["Border radius"],"style.font-family":["Font family"],"style.font-size":["Font size"],"style.font-weight":["Font weight"],"style.letter-spacing":["Letter spacing"],"style.line-height":["Line height"],"style.padding":["Padding"],"style.text-color":["Text color"],"toolbar.bold":["Bold"],"toolbar.bold-shortcut":["Bold (Cmd+B)"],"toolbar.italic":["Italic"],"toolbar.italic-shortcut":["Italic (Cmd+I)"],"toolbar.link":["Link"],"toolbar.link-shortcut":["Link (Cmd+K)"],"tune.copy":["Copy block"],"tune.delete":["Delete"],"tune.move-down":["Move down"],"tune.move-up":["Move up"]}');
|
|
2019
|
+
|
|
2020
|
+
// src/locales/fi/messages.ts
|
|
2021
|
+
var messages2 = JSON.parse('{"drawer.library":["Kirjasto"],"drawer.new-sample":["Uusi malli"],"drawer.new-template":["Uusi pohja"],"drawer.no-samples":["Ei malleja saatavilla"],"drawer.no-samples-match":["Mik\xE4\xE4n malli ei vastaa hakua"],"drawer.no-templates":["Ei tallennettuja pohjia"],"drawer.no-templates-match":["Mik\xE4\xE4n pohja ei vastaa hakua"],"drawer.search-samples":["Etsi malleja"],"drawer.search-templates":["Etsi pohjia"],"drawer.sort-by":["J\xE4rjestys"],"drawer.tab.outline":["Rakenne"],"drawer.tab.samples":["Mallit"],"drawer.tab.templates":["Pohjat"],"drawer.tag.all":["Kaikki"],"panel.avatar-block":["Avatarlohko"],"panel.button-block":["Painikelohko"],"panel.columns-block":["Sarakkeet"],"panel.container-block":["S\xE4ili\xF6lohko"],"panel.divider-block":["Erotin"],"panel.editor-appearance":["Editorin ulkoasu"],"panel.export":["Vienti"],"panel.global":["Yleiset"],"panel.heading-block":["Otsikkolohko"],"panel.html-block":["HTML-lohko"],"panel.image-block":["Kuvalohko"],"panel.signature-block":["Allekirjoituslohko"],"panel.spacer-block":["V\xE4lilohko"],"panel.template":["Pohja"],"panel.text-block":["Tekstilohko"],"savebar.error-saving":["Tallennus ep\xE4onnistui"],"savebar.new":["Uusi"],"savebar.new-template-created":["Uusi pohja luotu"],"savebar.sample-prefix":["Malli"],"savebar.sample-saved":["Malli tallennettu"],"savebar.save":["Tallenna"],"savebar.save-as":["Tallenna nimell\xE4\u2026"],"savebar.save-as-new":["Tallenna uutena\u2026"],"savebar.save-as-new-template":["Tallenna uutena pohjana"],"savebar.save-changes":["Tallenna muutokset"],"savebar.save-changes-to-sample":["Tallenna muutokset t\xE4h\xE4n malliin"],"savebar.start-fresh":["Aloita tyhj\xE4st\xE4 pohjasta"],"savebar.template-saved":["Pohja tallennettu"],"sort.last-updated":["Viimeksi p\xE4ivitetty"],"sort.name":["Nimi (A\u2013\xD6)"],"sort.recently-created":["\xC4skett\xE4in luotu"],"style.alignment":["Tasaus"],"style.background-color":["Taustav\xE4ri"],"style.border-color":["Reunan v\xE4ri"],"style.border-radius":["Reunan py\xF6ristys"],"style.font-family":["Fontti"],"style.font-size":["Fonttikoko"],"style.font-weight":["Fontin paksuus"],"style.letter-spacing":["Kirjainv\xE4li"],"style.line-height":["Rivikorkeus"],"style.padding":["T\xE4yte"],"style.text-color":["Tekstin v\xE4ri"],"toolbar.bold":["Lihavointi"],"toolbar.bold-shortcut":["Lihavointi (Cmd+B)"],"toolbar.italic":["Kursivointi"],"toolbar.italic-shortcut":["Kursivointi (Cmd+I)"],"toolbar.link":["Linkki"],"toolbar.link-shortcut":["Linkki (Cmd+K)"],"tune.copy":["Kopioi lohko"],"tune.delete":["Poista"],"tune.move-down":["Siirr\xE4 alas"],"tune.move-up":["Siirr\xE4 yl\xF6s"]}');
|
|
2022
|
+
|
|
2023
|
+
// src/locales/sv/messages.ts
|
|
2024
|
+
var messages3 = JSON.parse('{"drawer.library":["Bibliotek"],"drawer.new-sample":["Ny mall"],"drawer.new-template":["Ny e-postmall"],"drawer.no-samples":["Inga exempel tillg\xE4ngliga"],"drawer.no-samples-match":["Inga exempel matchar dina filter"],"drawer.no-templates":["Inga sparade mallar \xE4nnu"],"drawer.no-templates-match":["Inga mallar matchar dina filter"],"drawer.search-samples":["S\xF6k exempel"],"drawer.search-templates":["S\xF6k mallar"],"drawer.sort-by":["Sortera efter"],"drawer.tab.outline":["Struktur"],"drawer.tab.samples":["Exempel"],"drawer.tab.templates":["Mallar"],"drawer.tag.all":["Alla"],"panel.avatar-block":["Avatarblock"],"panel.button-block":["Knappblock"],"panel.columns-block":["Kolumner"],"panel.container-block":["Beh\xE5llarblock"],"panel.divider-block":["Avgr\xE4nsare"],"panel.editor-appearance":["Editorns utseende"],"panel.export":["Exportera"],"panel.global":["Allm\xE4nt"],"panel.heading-block":["Rubrikblock"],"panel.html-block":["HTML-block"],"panel.image-block":["Bildblock"],"panel.signature-block":["Signaturblock"],"panel.spacer-block":["Mellanrumsblock"],"panel.template":["Mall"],"panel.text-block":["Textblock"],"savebar.error-saving":["Fel vid sparande"],"savebar.new":["Ny"],"savebar.new-template-created":["Ny mall skapad"],"savebar.sample-prefix":["Exempel"],"savebar.sample-saved":["Exempel sparat"],"savebar.save":["Spara"],"savebar.save-as":["Spara som\u2026"],"savebar.save-as-new":["Spara som ny\u2026"],"savebar.save-as-new-template":["Spara som en ny mall"],"savebar.save-changes":["Spara \xE4ndringar"],"savebar.save-changes-to-sample":["Spara \xE4ndringar till detta exempel"],"savebar.start-fresh":["Starta en ny mall"],"savebar.template-saved":["Mall sparad"],"sort.last-updated":["Senast uppdaterad"],"sort.name":["Namn (A\u2013\xD6)"],"sort.recently-created":["Nyligen skapad"],"style.alignment":["Justering"],"style.background-color":["Bakgrundsf\xE4rg"],"style.border-color":["Kantf\xE4rg"],"style.border-radius":["Kantradie"],"style.font-family":["Typsnitt"],"style.font-size":["Typsnittsstorlek"],"style.font-weight":["Typsnittsvikt"],"style.letter-spacing":["Teckenavst\xE5nd"],"style.line-height":["Radh\xF6jd"],"style.padding":["Utrymme"],"style.text-color":["Textf\xE4rg"],"toolbar.bold":["Fet"],"toolbar.bold-shortcut":["Fet (Cmd+B)"],"toolbar.italic":["Kursiv"],"toolbar.italic-shortcut":["Kursiv (Cmd+I)"],"toolbar.link":["L\xE4nk"],"toolbar.link-shortcut":["L\xE4nk (Cmd+K)"],"tune.copy":["Kopiera block"],"tune.delete":["Ta bort"],"tune.move-down":["Flytta ner"],"tune.move-up":["Flytta upp"]}');
|
|
2025
|
+
var SUPPORTED_LOCALES = ["en", "sv", "fi"];
|
|
2026
|
+
var CATALOGS = {
|
|
2027
|
+
en: messages,
|
|
2028
|
+
sv: messages3,
|
|
2029
|
+
fi: messages2
|
|
2030
|
+
};
|
|
2031
|
+
var loaded = false;
|
|
2032
|
+
function activateLocale(locale) {
|
|
2033
|
+
const resolved = SUPPORTED_LOCALES.includes(locale != null ? locale : "") ? locale : "en";
|
|
2034
|
+
if (locale && resolved !== locale) {
|
|
2035
|
+
console.warn(`[email-template-editor] Unsupported locale "${locale}", falling back to "en".`);
|
|
2036
|
+
}
|
|
2037
|
+
if (!loaded) {
|
|
2038
|
+
core.i18n.load({ en: CATALOGS.en, sv: CATALOGS.sv, fi: CATALOGS.fi });
|
|
2039
|
+
loaded = true;
|
|
2040
|
+
}
|
|
2041
|
+
core.i18n.activate(resolved);
|
|
2042
|
+
return resolved;
|
|
2043
|
+
}
|
|
2044
|
+
function t(id, fallback) {
|
|
2045
|
+
return core.i18n._(id, {}, { message: fallback != null ? fallback : id });
|
|
2046
|
+
}
|
|
2014
2047
|
var EMPTY_DOCUMENT = {
|
|
2015
2048
|
root: {
|
|
2016
2049
|
type: "EmailLayout",
|
|
@@ -2155,20 +2188,21 @@ function buildSavePayload(doc) {
|
|
|
2155
2188
|
}
|
|
2156
2189
|
|
|
2157
2190
|
// src/app/context.tsx
|
|
2158
|
-
var EmailEditorContext =
|
|
2191
|
+
var EmailEditorContext = React57.createContext(null);
|
|
2159
2192
|
var EmailEditorProvider = ({
|
|
2160
2193
|
children,
|
|
2161
2194
|
initialTemplateId = null,
|
|
2162
2195
|
initialTemplateName = null,
|
|
2163
2196
|
onSave
|
|
2164
2197
|
}) => {
|
|
2165
|
-
const [currentTemplateId, setCurrentTemplateId] =
|
|
2166
|
-
const [currentTemplateName, setCurrentTemplateName] =
|
|
2167
|
-
const [currentTemplateKind, setCurrentTemplateKind] =
|
|
2168
|
-
const
|
|
2169
|
-
const
|
|
2198
|
+
const [currentTemplateId, setCurrentTemplateId] = React57.useState(initialTemplateId);
|
|
2199
|
+
const [currentTemplateName, setCurrentTemplateName] = React57.useState(initialTemplateName);
|
|
2200
|
+
const [currentTemplateKind, setCurrentTemplateKind] = React57.useState(null);
|
|
2201
|
+
const [currentTemplateTags, setCurrentTemplateTagsState] = React57.useState([]);
|
|
2202
|
+
const saveListenersRef = React57.useRef([]);
|
|
2203
|
+
const onSaveRef = React57.useRef(onSave);
|
|
2170
2204
|
onSaveRef.current = onSave;
|
|
2171
|
-
const saveTemplate =
|
|
2205
|
+
const saveTemplate = React57.useCallback(() => {
|
|
2172
2206
|
const currentDoc = getDocument();
|
|
2173
2207
|
saveListenersRef.current.forEach((listener) => listener(currentDoc));
|
|
2174
2208
|
if (onSaveRef.current) {
|
|
@@ -2176,67 +2210,104 @@ var EmailEditorProvider = ({
|
|
|
2176
2210
|
}
|
|
2177
2211
|
return currentDoc;
|
|
2178
2212
|
}, []);
|
|
2179
|
-
const loadTemplate =
|
|
2180
|
-
|
|
2213
|
+
const loadTemplate = React57.useCallback(
|
|
2214
|
+
(_newTemplate, templateId, templateName, kind, tags) => {
|
|
2215
|
+
if (templateId !== void 0) setCurrentTemplateId(templateId);
|
|
2216
|
+
if (templateName !== void 0) setCurrentTemplateName(templateName);
|
|
2217
|
+
if (kind !== void 0) setCurrentTemplateKind(kind);
|
|
2218
|
+
if (tags !== void 0) setCurrentTemplateTagsState(tags != null ? tags : []);
|
|
2219
|
+
},
|
|
2220
|
+
[]
|
|
2221
|
+
);
|
|
2222
|
+
const setCurrentTemplate = React57.useCallback(
|
|
2223
|
+
(templateId, templateName, kind, tags) => {
|
|
2181
2224
|
setCurrentTemplateId(templateId);
|
|
2182
|
-
}
|
|
2183
|
-
if (templateName !== void 0) {
|
|
2184
2225
|
setCurrentTemplateName(templateName);
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
setCurrentTemplateName(templateName);
|
|
2193
|
-
if (kind !== void 0) {
|
|
2194
|
-
setCurrentTemplateKind(kind);
|
|
2195
|
-
}
|
|
2226
|
+
if (kind !== void 0) setCurrentTemplateKind(kind);
|
|
2227
|
+
if (tags !== void 0) setCurrentTemplateTagsState(tags != null ? tags : []);
|
|
2228
|
+
},
|
|
2229
|
+
[]
|
|
2230
|
+
);
|
|
2231
|
+
const setCurrentTemplateTags = React57.useCallback((tags) => {
|
|
2232
|
+
setCurrentTemplateTagsState(tags);
|
|
2196
2233
|
}, []);
|
|
2197
|
-
const registerSaveListener =
|
|
2234
|
+
const registerSaveListener = React57.useCallback((callback) => {
|
|
2198
2235
|
saveListenersRef.current = [...saveListenersRef.current, callback];
|
|
2199
2236
|
return () => {
|
|
2200
2237
|
saveListenersRef.current = saveListenersRef.current.filter((listener) => listener !== callback);
|
|
2201
2238
|
};
|
|
2202
2239
|
}, []);
|
|
2203
|
-
const value =
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2240
|
+
const value = React57.useMemo(
|
|
2241
|
+
() => ({
|
|
2242
|
+
currentTemplateId,
|
|
2243
|
+
currentTemplateName,
|
|
2244
|
+
currentTemplateKind,
|
|
2245
|
+
currentTemplateTags,
|
|
2246
|
+
saveTemplate,
|
|
2247
|
+
loadTemplate,
|
|
2248
|
+
registerSaveListener,
|
|
2249
|
+
setCurrentTemplate,
|
|
2250
|
+
setCurrentTemplateTags
|
|
2251
|
+
}),
|
|
2252
|
+
[
|
|
2253
|
+
currentTemplateId,
|
|
2254
|
+
currentTemplateName,
|
|
2255
|
+
currentTemplateKind,
|
|
2256
|
+
currentTemplateTags,
|
|
2257
|
+
saveTemplate,
|
|
2258
|
+
loadTemplate,
|
|
2259
|
+
registerSaveListener,
|
|
2260
|
+
setCurrentTemplate,
|
|
2261
|
+
setCurrentTemplateTags
|
|
2262
|
+
]
|
|
2263
|
+
);
|
|
2264
|
+
return /* @__PURE__ */ React57__default.default.createElement(EmailEditorContext.Provider, { value }, children);
|
|
2213
2265
|
};
|
|
2214
2266
|
var useEmailEditor = () => {
|
|
2215
|
-
const context =
|
|
2267
|
+
const context = React57.useContext(EmailEditorContext);
|
|
2216
2268
|
if (!context) {
|
|
2217
2269
|
throw new Error("useEmailEditor must be used within an EmailEditorProvider");
|
|
2218
2270
|
}
|
|
2219
2271
|
return context;
|
|
2220
2272
|
};
|
|
2221
|
-
var ImageCallbacksContext =
|
|
2273
|
+
var ImageCallbacksContext = React57.createContext({});
|
|
2222
2274
|
function ImageCallbacksProvider({
|
|
2223
2275
|
callbacks,
|
|
2224
2276
|
children
|
|
2225
2277
|
}) {
|
|
2226
|
-
return /* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ React57__default.default.createElement(ImageCallbacksContext.Provider, { value: callbacks }, children);
|
|
2227
2279
|
}
|
|
2228
2280
|
function useImageCallbacks() {
|
|
2229
|
-
return
|
|
2230
|
-
}
|
|
2281
|
+
return React57.useContext(ImageCallbacksContext);
|
|
2282
|
+
}
|
|
2283
|
+
var TITLE_KEYS = {
|
|
2284
|
+
"Editor appearance": "panel.editor-appearance",
|
|
2285
|
+
Template: "panel.template",
|
|
2286
|
+
Export: "panel.export",
|
|
2287
|
+
Global: "panel.global",
|
|
2288
|
+
"Text block": "panel.text-block",
|
|
2289
|
+
"Heading block": "panel.heading-block",
|
|
2290
|
+
"Button block": "panel.button-block",
|
|
2291
|
+
"Image block": "panel.image-block",
|
|
2292
|
+
"Avatar block": "panel.avatar-block",
|
|
2293
|
+
"Signature block": "panel.signature-block",
|
|
2294
|
+
"Spacer block": "panel.spacer-block",
|
|
2295
|
+
"Divider block": "panel.divider-block",
|
|
2296
|
+
"Columns block": "panel.columns-block",
|
|
2297
|
+
"Container block": "panel.container-block",
|
|
2298
|
+
"Html block": "panel.html-block"
|
|
2299
|
+
};
|
|
2231
2300
|
function BaseSidebarPanel({ title, children }) {
|
|
2232
|
-
|
|
2301
|
+
const key = TITLE_KEYS[title];
|
|
2302
|
+
const displayTitle = key ? t(key, title) : title;
|
|
2303
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, displayTitle), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 5, mb: 3 }, children));
|
|
2233
2304
|
}
|
|
2234
2305
|
function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
2235
|
-
const [value, setValue] =
|
|
2236
|
-
|
|
2306
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
2307
|
+
React57.useEffect(() => {
|
|
2237
2308
|
setValue(defaultValue);
|
|
2238
2309
|
}, [defaultValue]);
|
|
2239
|
-
return /* @__PURE__ */
|
|
2310
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React57__default.default.createElement(
|
|
2240
2311
|
material.ToggleButtonGroup,
|
|
2241
2312
|
{
|
|
2242
2313
|
exclusive: true,
|
|
@@ -2256,7 +2327,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
|
2256
2327
|
}
|
|
2257
2328
|
function RawSliderInput(_a) {
|
|
2258
2329
|
var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
|
|
2259
|
-
return /* @__PURE__ */
|
|
2330
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React57__default.default.createElement(
|
|
2260
2331
|
material.Slider,
|
|
2261
2332
|
__spreadProps(__spreadValues({}, props), {
|
|
2262
2333
|
value,
|
|
@@ -2267,14 +2338,14 @@ function RawSliderInput(_a) {
|
|
|
2267
2338
|
setValue(value2);
|
|
2268
2339
|
}
|
|
2269
2340
|
})
|
|
2270
|
-
), /* @__PURE__ */
|
|
2341
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
|
|
2271
2342
|
}
|
|
2272
2343
|
|
|
2273
2344
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
|
|
2274
2345
|
function SliderInput(_a) {
|
|
2275
2346
|
var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
|
|
2276
|
-
const [value, setValue] =
|
|
2277
|
-
return /* @__PURE__ */
|
|
2347
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
2348
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React57__default.default.createElement(
|
|
2278
2349
|
RawSliderInput,
|
|
2279
2350
|
__spreadValues({
|
|
2280
2351
|
value,
|
|
@@ -2286,12 +2357,12 @@ function SliderInput(_a) {
|
|
|
2286
2357
|
));
|
|
2287
2358
|
}
|
|
2288
2359
|
function TextInput({ helperText, label, placeholder, rows, InputProps: InputProps2, defaultValue, onChange }) {
|
|
2289
|
-
const [value, setValue] =
|
|
2360
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
2290
2361
|
const isMultiline = typeof rows === "number" && rows > 1;
|
|
2291
|
-
|
|
2362
|
+
React57.useEffect(() => {
|
|
2292
2363
|
setValue(defaultValue);
|
|
2293
2364
|
}, [defaultValue]);
|
|
2294
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2295
2366
|
material.TextField,
|
|
2296
2367
|
{
|
|
2297
2368
|
fullWidth: true,
|
|
@@ -2317,7 +2388,7 @@ var TILE_BUTTON = {
|
|
|
2317
2388
|
};
|
|
2318
2389
|
function Swatch({ paletteColors, value, onChange }) {
|
|
2319
2390
|
const renderButton2 = (colorValue) => {
|
|
2320
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2321
2392
|
material.Button,
|
|
2322
2393
|
{
|
|
2323
2394
|
key: colorValue,
|
|
@@ -2336,7 +2407,7 @@ function Swatch({ paletteColors, value, onChange }) {
|
|
|
2336
2407
|
}
|
|
2337
2408
|
);
|
|
2338
2409
|
};
|
|
2339
|
-
return /* @__PURE__ */
|
|
2410
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
|
|
2340
2411
|
}
|
|
2341
2412
|
|
|
2342
2413
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
|
|
@@ -2403,7 +2474,7 @@ var SX = {
|
|
|
2403
2474
|
}
|
|
2404
2475
|
};
|
|
2405
2476
|
function Picker({ value, onChange }) {
|
|
2406
|
-
return /* @__PURE__ */
|
|
2477
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React57__default.default.createElement(reactColorful.HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React57__default.default.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React57__default.default.createElement(material.Box, { pt: 1 }, /* @__PURE__ */ React57__default.default.createElement(reactColorful.HexColorInput, { prefixed: true, color: value, onChange })));
|
|
2407
2478
|
}
|
|
2408
2479
|
|
|
2409
2480
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
|
|
@@ -2416,8 +2487,8 @@ var BUTTON_SX = {
|
|
|
2416
2487
|
bgcolor: "#FFFFFF"
|
|
2417
2488
|
};
|
|
2418
2489
|
function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
2419
|
-
const [anchorEl, setAnchorEl] =
|
|
2420
|
-
const [value, setValue] =
|
|
2490
|
+
const [anchorEl, setAnchorEl] = React57.useState(null);
|
|
2491
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
2421
2492
|
const handleClickOpen = (event) => {
|
|
2422
2493
|
setAnchorEl(event.currentTarget);
|
|
2423
2494
|
};
|
|
@@ -2428,7 +2499,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2428
2499
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2429
2500
|
return null;
|
|
2430
2501
|
}
|
|
2431
|
-
return /* @__PURE__ */
|
|
2502
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2432
2503
|
material.ButtonBase,
|
|
2433
2504
|
{
|
|
2434
2505
|
onClick: () => {
|
|
@@ -2436,16 +2507,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2436
2507
|
onChange(null);
|
|
2437
2508
|
}
|
|
2438
2509
|
},
|
|
2439
|
-
/* @__PURE__ */
|
|
2510
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
|
|
2440
2511
|
);
|
|
2441
2512
|
};
|
|
2442
2513
|
const renderOpenButton = () => {
|
|
2443
2514
|
if (value) {
|
|
2444
|
-
return /* @__PURE__ */
|
|
2515
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
|
|
2445
2516
|
}
|
|
2446
|
-
return /* @__PURE__ */
|
|
2517
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" }));
|
|
2447
2518
|
};
|
|
2448
|
-
return /* @__PURE__ */
|
|
2519
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React57__default.default.createElement(
|
|
2449
2520
|
material.Menu,
|
|
2450
2521
|
{
|
|
2451
2522
|
anchorEl,
|
|
@@ -2455,7 +2526,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2455
2526
|
sx: { height: "auto", padding: 0 }
|
|
2456
2527
|
}
|
|
2457
2528
|
},
|
|
2458
|
-
/* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
2459
2530
|
Picker,
|
|
2460
2531
|
{
|
|
2461
2532
|
value: value || "",
|
|
@@ -2470,10 +2541,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
2470
2541
|
|
|
2471
2542
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
|
|
2472
2543
|
function ColorInput2(props) {
|
|
2473
|
-
return /* @__PURE__ */
|
|
2544
|
+
return /* @__PURE__ */ React57__default.default.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
|
|
2474
2545
|
}
|
|
2475
2546
|
function NullableColorInput(props) {
|
|
2476
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ React57__default.default.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
|
|
2477
2548
|
}
|
|
2478
2549
|
|
|
2479
2550
|
// src/editor/blocks/helpers/font-family.ts
|
|
@@ -2526,13 +2597,13 @@ var FONT_FAMILIES = [
|
|
|
2526
2597
|
];
|
|
2527
2598
|
|
|
2528
2599
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
|
|
2529
|
-
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */
|
|
2600
|
+
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
|
|
2530
2601
|
function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
2531
|
-
const [value, setValue] =
|
|
2532
|
-
|
|
2602
|
+
const [value, setValue] = React57.useState(defaultValue != null ? defaultValue : "inherit");
|
|
2603
|
+
React57.useEffect(() => {
|
|
2533
2604
|
setValue(defaultValue != null ? defaultValue : "inherit");
|
|
2534
2605
|
}, [defaultValue]);
|
|
2535
|
-
return /* @__PURE__ */
|
|
2606
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2536
2607
|
material.TextField,
|
|
2537
2608
|
{
|
|
2538
2609
|
select: true,
|
|
@@ -2545,23 +2616,23 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
|
2545
2616
|
onChange(v === null ? null : v);
|
|
2546
2617
|
}
|
|
2547
2618
|
},
|
|
2548
|
-
/* @__PURE__ */
|
|
2619
|
+
/* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { value: "inherit" }, "Match email settings"),
|
|
2549
2620
|
OPTIONS
|
|
2550
2621
|
);
|
|
2551
2622
|
}
|
|
2552
2623
|
function FontSizeInput({ label, defaultValue, onChange }) {
|
|
2553
|
-
const [value, setValue] =
|
|
2554
|
-
|
|
2624
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
2625
|
+
React57.useEffect(() => {
|
|
2555
2626
|
setValue(defaultValue);
|
|
2556
2627
|
}, [defaultValue]);
|
|
2557
2628
|
const handleChange = (value2) => {
|
|
2558
2629
|
setValue(value2);
|
|
2559
2630
|
onChange(value2);
|
|
2560
2631
|
};
|
|
2561
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React57__default.default.createElement(
|
|
2562
2633
|
RawSliderInput,
|
|
2563
2634
|
{
|
|
2564
|
-
iconLabel: /* @__PURE__ */
|
|
2635
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.TextFieldsOutlined, { sx: { fontSize: 16 } }),
|
|
2565
2636
|
value,
|
|
2566
2637
|
setValue: handleChange,
|
|
2567
2638
|
units: "px",
|
|
@@ -2572,11 +2643,11 @@ function FontSizeInput({ label, defaultValue, onChange }) {
|
|
|
2572
2643
|
));
|
|
2573
2644
|
}
|
|
2574
2645
|
function FontWeightInput({ label, defaultValue, onChange }) {
|
|
2575
|
-
const [value, setValue] =
|
|
2576
|
-
|
|
2646
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
2647
|
+
React57.useEffect(() => {
|
|
2577
2648
|
setValue(defaultValue);
|
|
2578
2649
|
}, [defaultValue]);
|
|
2579
|
-
return /* @__PURE__ */
|
|
2650
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2580
2651
|
RadioGroupInput,
|
|
2581
2652
|
{
|
|
2582
2653
|
label,
|
|
@@ -2586,23 +2657,23 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2586
2657
|
onChange(fontWeight);
|
|
2587
2658
|
}
|
|
2588
2659
|
},
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2660
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "normal" }, "Regular"),
|
|
2661
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "bold" }, "Bold")
|
|
2591
2662
|
);
|
|
2592
2663
|
}
|
|
2593
2664
|
function LetterSpacingInput({ label, defaultValue, onChange }) {
|
|
2594
|
-
const [value, setValue] =
|
|
2595
|
-
|
|
2665
|
+
const [value, setValue] = React57.useState(defaultValue != null ? defaultValue : 0);
|
|
2666
|
+
React57.useEffect(() => {
|
|
2596
2667
|
setValue(defaultValue != null ? defaultValue : 0);
|
|
2597
2668
|
}, [defaultValue]);
|
|
2598
2669
|
const handleChange = (v) => {
|
|
2599
2670
|
setValue(v);
|
|
2600
2671
|
onChange(v === 0 ? null : v);
|
|
2601
2672
|
};
|
|
2602
|
-
return /* @__PURE__ */
|
|
2673
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React57__default.default.createElement(
|
|
2603
2674
|
RawSliderInput,
|
|
2604
2675
|
{
|
|
2605
|
-
iconLabel: /* @__PURE__ */
|
|
2676
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SpaceBarOutlined, { sx: { fontSize: 16 } }),
|
|
2606
2677
|
value,
|
|
2607
2678
|
setValue: handleChange,
|
|
2608
2679
|
units: "px",
|
|
@@ -2613,18 +2684,18 @@ function LetterSpacingInput({ label, defaultValue, onChange }) {
|
|
|
2613
2684
|
));
|
|
2614
2685
|
}
|
|
2615
2686
|
function LineHeightInput({ label, defaultValue, onChange }) {
|
|
2616
|
-
const [value, setValue] =
|
|
2617
|
-
|
|
2687
|
+
const [value, setValue] = React57.useState(defaultValue != null ? defaultValue : 0);
|
|
2688
|
+
React57.useEffect(() => {
|
|
2618
2689
|
setValue(defaultValue != null ? defaultValue : 0);
|
|
2619
2690
|
}, [defaultValue]);
|
|
2620
2691
|
const handleChange = (v) => {
|
|
2621
2692
|
setValue(v);
|
|
2622
2693
|
onChange(v === 0 ? null : v);
|
|
2623
2694
|
};
|
|
2624
|
-
return /* @__PURE__ */
|
|
2695
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React57__default.default.createElement(
|
|
2625
2696
|
RawSliderInput,
|
|
2626
2697
|
{
|
|
2627
|
-
iconLabel: /* @__PURE__ */
|
|
2698
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FormatLineSpacingOutlined, { sx: { fontSize: 16 } }),
|
|
2628
2699
|
value,
|
|
2629
2700
|
setValue: handleChange,
|
|
2630
2701
|
units: "",
|
|
@@ -2635,7 +2706,7 @@ function LineHeightInput({ label, defaultValue, onChange }) {
|
|
|
2635
2706
|
));
|
|
2636
2707
|
}
|
|
2637
2708
|
function PaddingInput({ label, defaultValue, onChange }) {
|
|
2638
|
-
const [value, setValue] =
|
|
2709
|
+
const [value, setValue] = React57.useState(() => {
|
|
2639
2710
|
if (defaultValue) {
|
|
2640
2711
|
return defaultValue;
|
|
2641
2712
|
}
|
|
@@ -2653,10 +2724,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2653
2724
|
setValue(v);
|
|
2654
2725
|
onChange(v);
|
|
2655
2726
|
}
|
|
2656
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React57__default.default.createElement(material.InputLabel, { shrink: true }, label), /* @__PURE__ */ React57__default.default.createElement(
|
|
2657
2728
|
RawSliderInput,
|
|
2658
2729
|
{
|
|
2659
|
-
iconLabel: /* @__PURE__ */
|
|
2730
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
|
|
2660
2731
|
value: value.top,
|
|
2661
2732
|
setValue: (num) => handleChange("top", num),
|
|
2662
2733
|
units: "px",
|
|
@@ -2665,10 +2736,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2665
2736
|
max: 80,
|
|
2666
2737
|
marks: true
|
|
2667
2738
|
}
|
|
2668
|
-
), /* @__PURE__ */
|
|
2739
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2669
2740
|
RawSliderInput,
|
|
2670
2741
|
{
|
|
2671
|
-
iconLabel: /* @__PURE__ */
|
|
2742
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
|
|
2672
2743
|
value: value.bottom,
|
|
2673
2744
|
setValue: (num) => handleChange("bottom", num),
|
|
2674
2745
|
units: "px",
|
|
@@ -2677,10 +2748,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2677
2748
|
max: 80,
|
|
2678
2749
|
marks: true
|
|
2679
2750
|
}
|
|
2680
|
-
), /* @__PURE__ */
|
|
2751
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2681
2752
|
RawSliderInput,
|
|
2682
2753
|
{
|
|
2683
|
-
iconLabel: /* @__PURE__ */
|
|
2754
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
|
|
2684
2755
|
value: value.left,
|
|
2685
2756
|
setValue: (num) => handleChange("left", num),
|
|
2686
2757
|
units: "px",
|
|
@@ -2689,10 +2760,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2689
2760
|
max: 80,
|
|
2690
2761
|
marks: true
|
|
2691
2762
|
}
|
|
2692
|
-
), /* @__PURE__ */
|
|
2763
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2693
2764
|
RawSliderInput,
|
|
2694
2765
|
{
|
|
2695
|
-
iconLabel: /* @__PURE__ */
|
|
2766
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
|
|
2696
2767
|
value: value.right,
|
|
2697
2768
|
setValue: (num) => handleChange("right", num),
|
|
2698
2769
|
units: "px",
|
|
@@ -2704,11 +2775,11 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2704
2775
|
));
|
|
2705
2776
|
}
|
|
2706
2777
|
function TextAlignInput({ label, defaultValue, onChange }) {
|
|
2707
|
-
const [value, setValue] =
|
|
2708
|
-
|
|
2778
|
+
const [value, setValue] = React57.useState(defaultValue != null ? defaultValue : "left");
|
|
2779
|
+
React57.useEffect(() => {
|
|
2709
2780
|
setValue(defaultValue != null ? defaultValue : "left");
|
|
2710
2781
|
}, [defaultValue]);
|
|
2711
|
-
return /* @__PURE__ */
|
|
2782
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2712
2783
|
RadioGroupInput,
|
|
2713
2784
|
{
|
|
2714
2785
|
label,
|
|
@@ -2718,9 +2789,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2718
2789
|
onChange(value2);
|
|
2719
2790
|
}
|
|
2720
2791
|
},
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "left" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FormatAlignLeftOutlined, { fontSize: "small" })),
|
|
2793
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "center" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FormatAlignCenterOutlined, { fontSize: "small" })),
|
|
2794
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "right" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FormatAlignRightOutlined, { fontSize: "small" }))
|
|
2724
2795
|
);
|
|
2725
2796
|
}
|
|
2726
2797
|
|
|
@@ -2733,52 +2804,52 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2733
2804
|
};
|
|
2734
2805
|
switch (name) {
|
|
2735
2806
|
case "backgroundColor":
|
|
2736
|
-
return /* @__PURE__ */
|
|
2807
|
+
return /* @__PURE__ */ React57__default.default.createElement(NullableColorInput, { label: t("style.background-color", "Background color"), defaultValue, onChange: handleChange });
|
|
2737
2808
|
case "borderColor":
|
|
2738
|
-
return /* @__PURE__ */
|
|
2809
|
+
return /* @__PURE__ */ React57__default.default.createElement(NullableColorInput, { label: t("style.border-color", "Border color"), defaultValue, onChange: handleChange });
|
|
2739
2810
|
case "borderRadius":
|
|
2740
|
-
return /* @__PURE__ */
|
|
2811
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2741
2812
|
SliderInput,
|
|
2742
2813
|
{
|
|
2743
|
-
iconLabel: /* @__PURE__ */
|
|
2814
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.RoundedCornerOutlined, null),
|
|
2744
2815
|
units: "px",
|
|
2745
2816
|
step: 4,
|
|
2746
2817
|
marks: true,
|
|
2747
2818
|
min: 0,
|
|
2748
2819
|
max: 48,
|
|
2749
|
-
label: "Border radius",
|
|
2820
|
+
label: t("style.border-radius", "Border radius"),
|
|
2750
2821
|
defaultValue,
|
|
2751
2822
|
onChange: handleChange
|
|
2752
2823
|
}
|
|
2753
2824
|
);
|
|
2754
2825
|
case "color":
|
|
2755
|
-
return /* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ React57__default.default.createElement(NullableColorInput, { label: t("style.text-color", "Text color"), defaultValue, onChange: handleChange });
|
|
2756
2827
|
case "fontFamily":
|
|
2757
|
-
return /* @__PURE__ */
|
|
2828
|
+
return /* @__PURE__ */ React57__default.default.createElement(NullableFontFamily, { label: t("style.font-family", "Font family"), defaultValue, onChange: handleChange });
|
|
2758
2829
|
case "fontSize":
|
|
2759
|
-
return /* @__PURE__ */
|
|
2830
|
+
return /* @__PURE__ */ React57__default.default.createElement(FontSizeInput, { label: t("style.font-size", "Font size"), defaultValue, onChange: handleChange });
|
|
2760
2831
|
case "fontWeight":
|
|
2761
|
-
return /* @__PURE__ */
|
|
2832
|
+
return /* @__PURE__ */ React57__default.default.createElement(FontWeightInput, { label: t("style.font-weight", "Font weight"), defaultValue, onChange: handleChange });
|
|
2762
2833
|
case "lineHeight":
|
|
2763
|
-
return /* @__PURE__ */
|
|
2834
|
+
return /* @__PURE__ */ React57__default.default.createElement(LineHeightInput, { label: t("style.line-height", "Line height"), defaultValue, onChange: handleChange });
|
|
2764
2835
|
case "letterSpacing":
|
|
2765
|
-
return /* @__PURE__ */
|
|
2836
|
+
return /* @__PURE__ */ React57__default.default.createElement(LetterSpacingInput, { label: t("style.letter-spacing", "Letter spacing"), defaultValue, onChange: handleChange });
|
|
2766
2837
|
case "textAlign":
|
|
2767
|
-
return /* @__PURE__ */
|
|
2838
|
+
return /* @__PURE__ */ React57__default.default.createElement(TextAlignInput, { label: t("style.alignment", "Alignment"), defaultValue, onChange: handleChange });
|
|
2768
2839
|
case "padding":
|
|
2769
|
-
return /* @__PURE__ */
|
|
2840
|
+
return /* @__PURE__ */ React57__default.default.createElement(PaddingInput, { label: t("style.padding", "Padding"), defaultValue, onChange: handleChange });
|
|
2770
2841
|
}
|
|
2771
2842
|
}
|
|
2772
2843
|
|
|
2773
2844
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
|
|
2774
2845
|
function MultiStylePropertyPanel({ names, value, onChange }) {
|
|
2775
|
-
return /* @__PURE__ */
|
|
2846
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, names.map((name) => /* @__PURE__ */ React57__default.default.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
|
|
2776
2847
|
}
|
|
2777
2848
|
|
|
2778
2849
|
// src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
|
|
2779
2850
|
function AvatarSidebarPanel({ data, setData }) {
|
|
2780
2851
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2781
|
-
const [, setErrors] =
|
|
2852
|
+
const [, setErrors] = React57.useState(null);
|
|
2782
2853
|
const updateData = (d) => {
|
|
2783
2854
|
const res = AvatarPropsSchema.safeParse(d);
|
|
2784
2855
|
if (res.success) {
|
|
@@ -2792,11 +2863,11 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2792
2863
|
const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
|
|
2793
2864
|
const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
|
|
2794
2865
|
const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
|
|
2795
|
-
return /* @__PURE__ */
|
|
2866
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
2796
2867
|
SliderInput,
|
|
2797
2868
|
{
|
|
2798
2869
|
label: "Size",
|
|
2799
|
-
iconLabel: /* @__PURE__ */
|
|
2870
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
2800
2871
|
units: "px",
|
|
2801
2872
|
step: 3,
|
|
2802
2873
|
min: 32,
|
|
@@ -2806,7 +2877,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2806
2877
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
|
|
2807
2878
|
}
|
|
2808
2879
|
}
|
|
2809
|
-
), /* @__PURE__ */
|
|
2880
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2810
2881
|
RadioGroupInput,
|
|
2811
2882
|
{
|
|
2812
2883
|
label: "Shape",
|
|
@@ -2815,10 +2886,10 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2815
2886
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
|
|
2816
2887
|
}
|
|
2817
2888
|
},
|
|
2818
|
-
/* @__PURE__ */
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
), /* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "circle" }, "Circle"),
|
|
2890
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "square" }, "Square"),
|
|
2891
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded")
|
|
2892
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2822
2893
|
TextInput,
|
|
2823
2894
|
{
|
|
2824
2895
|
label: "Image URL",
|
|
@@ -2827,7 +2898,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2827
2898
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
|
|
2828
2899
|
}
|
|
2829
2900
|
}
|
|
2830
|
-
), /* @__PURE__ */
|
|
2901
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2831
2902
|
TextInput,
|
|
2832
2903
|
{
|
|
2833
2904
|
label: "Alt text",
|
|
@@ -2836,7 +2907,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2836
2907
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
|
|
2837
2908
|
}
|
|
2838
2909
|
}
|
|
2839
|
-
), /* @__PURE__ */
|
|
2910
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2840
2911
|
MultiStylePropertyPanel,
|
|
2841
2912
|
{
|
|
2842
2913
|
names: ["textAlign", "padding"],
|
|
@@ -2847,7 +2918,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2847
2918
|
}
|
|
2848
2919
|
function ButtonSidebarPanel({ data, setData }) {
|
|
2849
2920
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2850
|
-
const [, setErrors] =
|
|
2921
|
+
const [, setErrors] = React57.useState(null);
|
|
2851
2922
|
const updateData = (d) => {
|
|
2852
2923
|
const res = ButtonPropsSchema.safeParse(d);
|
|
2853
2924
|
if (res.success) {
|
|
@@ -2864,65 +2935,65 @@ function ButtonSidebarPanel({ data, setData }) {
|
|
|
2864
2935
|
const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
|
|
2865
2936
|
const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
|
|
2866
2937
|
const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
|
|
2867
|
-
return /* @__PURE__ */
|
|
2938
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
2868
2939
|
TextInput,
|
|
2869
2940
|
{
|
|
2870
2941
|
label: "Text",
|
|
2871
2942
|
defaultValue: text,
|
|
2872
2943
|
onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
|
|
2873
2944
|
}
|
|
2874
|
-
), /* @__PURE__ */
|
|
2945
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2875
2946
|
TextInput,
|
|
2876
2947
|
{
|
|
2877
2948
|
label: "Url",
|
|
2878
2949
|
defaultValue: url,
|
|
2879
2950
|
onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
|
|
2880
2951
|
}
|
|
2881
|
-
), /* @__PURE__ */
|
|
2952
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2882
2953
|
RadioGroupInput,
|
|
2883
2954
|
{
|
|
2884
2955
|
label: "Width",
|
|
2885
2956
|
defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
|
|
2886
2957
|
onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
|
|
2887
2958
|
},
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
/* @__PURE__ */
|
|
2890
|
-
), /* @__PURE__ */
|
|
2959
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "FULL_WIDTH" }, "Full"),
|
|
2960
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "AUTO" }, "Auto")
|
|
2961
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2891
2962
|
RadioGroupInput,
|
|
2892
2963
|
{
|
|
2893
2964
|
label: "Size",
|
|
2894
2965
|
defaultValue: size,
|
|
2895
2966
|
onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
|
|
2896
2967
|
},
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
/* @__PURE__ */
|
|
2899
|
-
/* @__PURE__ */
|
|
2900
|
-
/* @__PURE__ */
|
|
2901
|
-
), /* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "x-small" }, "Xs"),
|
|
2969
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "small" }, "Sm"),
|
|
2970
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "medium" }, "Md"),
|
|
2971
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "large" }, "Lg")
|
|
2972
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2902
2973
|
RadioGroupInput,
|
|
2903
2974
|
{
|
|
2904
2975
|
label: "Style",
|
|
2905
2976
|
defaultValue: buttonStyle,
|
|
2906
2977
|
onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
|
|
2907
2978
|
},
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
), /* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "rectangle" }, "Rectangle"),
|
|
2980
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded"),
|
|
2981
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "pill" }, "Pill")
|
|
2982
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2912
2983
|
ColorInput2,
|
|
2913
2984
|
{
|
|
2914
2985
|
label: "Text color",
|
|
2915
2986
|
defaultValue: buttonTextColor,
|
|
2916
2987
|
onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
|
|
2917
2988
|
}
|
|
2918
|
-
), /* @__PURE__ */
|
|
2989
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2919
2990
|
ColorInput2,
|
|
2920
2991
|
{
|
|
2921
2992
|
label: "Button color",
|
|
2922
2993
|
defaultValue: buttonBackgroundColor,
|
|
2923
2994
|
onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
|
|
2924
2995
|
}
|
|
2925
|
-
), /* @__PURE__ */
|
|
2996
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
2926
2997
|
MultiStylePropertyPanel,
|
|
2927
2998
|
{
|
|
2928
2999
|
names: [
|
|
@@ -2957,7 +3028,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2957
3028
|
const value = parseInt(ev.target.value);
|
|
2958
3029
|
onChange(isNaN(value) ? null : value);
|
|
2959
3030
|
};
|
|
2960
|
-
return /* @__PURE__ */
|
|
3031
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
2961
3032
|
material.TextField,
|
|
2962
3033
|
{
|
|
2963
3034
|
fullWidth: true,
|
|
@@ -2968,7 +3039,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2968
3039
|
placeholder: "auto",
|
|
2969
3040
|
size: "small",
|
|
2970
3041
|
InputProps: {
|
|
2971
|
-
endAdornment: /* @__PURE__ */
|
|
3042
|
+
endAdornment: /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2972
3043
|
}
|
|
2973
3044
|
}
|
|
2974
3045
|
);
|
|
@@ -2976,7 +3047,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2976
3047
|
|
|
2977
3048
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/column-widths-input.tsx
|
|
2978
3049
|
function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
2979
|
-
const [currentValue, setCurrentValue] =
|
|
3050
|
+
const [currentValue, setCurrentValue] = React57.useState(() => {
|
|
2980
3051
|
if (defaultValue) {
|
|
2981
3052
|
return defaultValue;
|
|
2982
3053
|
}
|
|
@@ -2990,7 +3061,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2990
3061
|
};
|
|
2991
3062
|
let column3 = null;
|
|
2992
3063
|
{
|
|
2993
|
-
column3 = /* @__PURE__ */
|
|
3064
|
+
column3 = /* @__PURE__ */ React57__default.default.createElement(
|
|
2994
3065
|
TextDimensionInput,
|
|
2995
3066
|
{
|
|
2996
3067
|
label: "Column 3",
|
|
@@ -3001,7 +3072,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
3001
3072
|
}
|
|
3002
3073
|
);
|
|
3003
3074
|
}
|
|
3004
|
-
return /* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3005
3076
|
TextDimensionInput,
|
|
3006
3077
|
{
|
|
3007
3078
|
label: "Column 1",
|
|
@@ -3010,7 +3081,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
3010
3081
|
setIndexValue(0, v);
|
|
3011
3082
|
}
|
|
3012
3083
|
}
|
|
3013
|
-
), /* @__PURE__ */
|
|
3084
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3014
3085
|
TextDimensionInput,
|
|
3015
3086
|
{
|
|
3016
3087
|
label: "Column 2",
|
|
@@ -3025,7 +3096,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
3025
3096
|
// src/app/inspector-drawer/configuration-panel/input-panels/columns-container-sidebar-panel.tsx
|
|
3026
3097
|
function ColumnsContainerPanel({ data, setData }) {
|
|
3027
3098
|
var _a, _b, _c, _d, _e, _f;
|
|
3028
|
-
const [, setErrors] =
|
|
3099
|
+
const [, setErrors] = React57.useState(null);
|
|
3029
3100
|
const updateData = (d) => {
|
|
3030
3101
|
const res = columns_container_props_schema_default2.safeParse(d);
|
|
3031
3102
|
if (res.success) {
|
|
@@ -3035,7 +3106,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
3035
3106
|
setErrors(res.error);
|
|
3036
3107
|
}
|
|
3037
3108
|
};
|
|
3038
|
-
return /* @__PURE__ */
|
|
3109
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3039
3110
|
RadioGroupInput,
|
|
3040
3111
|
{
|
|
3041
3112
|
label: "Number of columns",
|
|
@@ -3044,9 +3115,9 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
3044
3115
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
|
|
3045
3116
|
}
|
|
3046
3117
|
},
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
/* @__PURE__ */
|
|
3049
|
-
), /* @__PURE__ */
|
|
3118
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "2" }, "2"),
|
|
3119
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "3" }, "3")
|
|
3120
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3050
3121
|
ColumnWidthsInput,
|
|
3051
3122
|
{
|
|
3052
3123
|
defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
|
|
@@ -3054,11 +3125,11 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
3054
3125
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
|
|
3055
3126
|
}
|
|
3056
3127
|
}
|
|
3057
|
-
), /* @__PURE__ */
|
|
3128
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3058
3129
|
SliderInput,
|
|
3059
3130
|
{
|
|
3060
3131
|
label: "Columns gap",
|
|
3061
|
-
iconLabel: /* @__PURE__ */
|
|
3132
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SpaceBarOutlined, { sx: { color: "text.secondary" } }),
|
|
3062
3133
|
units: "px",
|
|
3063
3134
|
step: 4,
|
|
3064
3135
|
marks: true,
|
|
@@ -3067,7 +3138,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
3067
3138
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
|
|
3068
3139
|
onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
|
|
3069
3140
|
}
|
|
3070
|
-
), /* @__PURE__ */
|
|
3141
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3071
3142
|
RadioGroupInput,
|
|
3072
3143
|
{
|
|
3073
3144
|
label: "Alignment",
|
|
@@ -3076,10 +3147,10 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
3076
3147
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
|
|
3077
3148
|
}
|
|
3078
3149
|
},
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3082
|
-
), /* @__PURE__ */
|
|
3150
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "top" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3151
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "middle" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3152
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "bottom" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3153
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3083
3154
|
MultiStylePropertyPanel,
|
|
3084
3155
|
{
|
|
3085
3156
|
names: ["backgroundColor", "padding"],
|
|
@@ -3098,7 +3169,7 @@ var container_props_schema_default = ContainerPropsSchema3;
|
|
|
3098
3169
|
|
|
3099
3170
|
// src/app/inspector-drawer/configuration-panel/input-panels/container-sidebar-panel.tsx
|
|
3100
3171
|
function ContainerSidebarPanel({ data, setData }) {
|
|
3101
|
-
const [, setErrors] =
|
|
3172
|
+
const [, setErrors] = React57.useState(null);
|
|
3102
3173
|
const updateData = (d) => {
|
|
3103
3174
|
const res = container_props_schema_default.safeParse(d);
|
|
3104
3175
|
if (res.success) {
|
|
@@ -3108,7 +3179,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
3108
3179
|
setErrors(res.error);
|
|
3109
3180
|
}
|
|
3110
3181
|
};
|
|
3111
|
-
return /* @__PURE__ */
|
|
3182
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3112
3183
|
MultiStylePropertyPanel,
|
|
3113
3184
|
{
|
|
3114
3185
|
names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
|
|
@@ -3119,7 +3190,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
3119
3190
|
}
|
|
3120
3191
|
function DividerSidebarPanel({ data, setData }) {
|
|
3121
3192
|
var _a, _b, _c, _d;
|
|
3122
|
-
const [, setErrors] =
|
|
3193
|
+
const [, setErrors] = React57.useState(null);
|
|
3123
3194
|
const updateData = (d) => {
|
|
3124
3195
|
const res = DividerPropsSchema.safeParse(d);
|
|
3125
3196
|
if (res.success) {
|
|
@@ -3131,18 +3202,18 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
3131
3202
|
};
|
|
3132
3203
|
const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
|
|
3133
3204
|
const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
|
|
3134
|
-
return /* @__PURE__ */
|
|
3205
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3135
3206
|
ColorInput2,
|
|
3136
3207
|
{
|
|
3137
3208
|
label: "Color",
|
|
3138
3209
|
defaultValue: lineColor,
|
|
3139
3210
|
onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
|
|
3140
3211
|
}
|
|
3141
|
-
), /* @__PURE__ */
|
|
3212
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3142
3213
|
SliderInput,
|
|
3143
3214
|
{
|
|
3144
3215
|
label: "Height",
|
|
3145
|
-
iconLabel: /* @__PURE__ */
|
|
3216
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
3146
3217
|
units: "px",
|
|
3147
3218
|
step: 1,
|
|
3148
3219
|
min: 1,
|
|
@@ -3150,7 +3221,7 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
3150
3221
|
defaultValue: lineHeight,
|
|
3151
3222
|
onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
|
|
3152
3223
|
}
|
|
3153
|
-
), /* @__PURE__ */
|
|
3224
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3154
3225
|
MultiStylePropertyPanel,
|
|
3155
3226
|
{
|
|
3156
3227
|
names: ["backgroundColor", "padding"],
|
|
@@ -3190,15 +3261,15 @@ var EmailLayoutPropsSchema2 = zod.z.object({
|
|
|
3190
3261
|
});
|
|
3191
3262
|
var email_layout_props_schema_default = EmailLayoutPropsSchema2;
|
|
3192
3263
|
function BooleanInput({ label, defaultValue, onChange }) {
|
|
3193
|
-
const [value, setValue] =
|
|
3194
|
-
|
|
3264
|
+
const [value, setValue] = React57.useState(defaultValue);
|
|
3265
|
+
React57.useEffect(() => {
|
|
3195
3266
|
setValue(defaultValue);
|
|
3196
3267
|
}, [defaultValue]);
|
|
3197
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
3198
3269
|
material.FormControlLabel,
|
|
3199
3270
|
{
|
|
3200
3271
|
label,
|
|
3201
|
-
control: /* @__PURE__ */
|
|
3272
|
+
control: /* @__PURE__ */ React57__default.default.createElement(
|
|
3202
3273
|
material.Switch,
|
|
3203
3274
|
{
|
|
3204
3275
|
checked: value,
|
|
@@ -3215,7 +3286,7 @@ function BooleanInput({ label, defaultValue, onChange }) {
|
|
|
3215
3286
|
// src/app/inspector-drawer/configuration-panel/input-panels/email-layout-sidebar-panel.tsx
|
|
3216
3287
|
function EmailLayoutSidebarFields({ data, setData }) {
|
|
3217
3288
|
var _a, _b, _c, _d, _e, _f;
|
|
3218
|
-
const [, setErrors] =
|
|
3289
|
+
const [, setErrors] = React57.useState(null);
|
|
3219
3290
|
const updateData = (d) => {
|
|
3220
3291
|
const res = email_layout_props_schema_default.safeParse(d);
|
|
3221
3292
|
if (res.success) {
|
|
@@ -3226,38 +3297,38 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3226
3297
|
}
|
|
3227
3298
|
};
|
|
3228
3299
|
const backdropDisabled = (_a = data.backdropDisabled) != null ? _a : false;
|
|
3229
|
-
return /* @__PURE__ */
|
|
3300
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3230
3301
|
BooleanInput,
|
|
3231
3302
|
{
|
|
3232
3303
|
label: "Disable backdrop",
|
|
3233
3304
|
defaultValue: backdropDisabled,
|
|
3234
3305
|
onChange: (backdropDisabled2) => updateData(__spreadProps(__spreadValues({}, data), { backdropDisabled: backdropDisabled2 }))
|
|
3235
3306
|
}
|
|
3236
|
-
), !backdropDisabled && /* @__PURE__ */
|
|
3307
|
+
), !backdropDisabled && /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
3237
3308
|
ColorInput2,
|
|
3238
3309
|
{
|
|
3239
3310
|
label: "Backdrop color",
|
|
3240
3311
|
defaultValue: (_b = data.backdropColor) != null ? _b : "#F5F5F5",
|
|
3241
3312
|
onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
|
|
3242
3313
|
}
|
|
3243
|
-
), /* @__PURE__ */
|
|
3314
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3244
3315
|
ColorInput2,
|
|
3245
3316
|
{
|
|
3246
3317
|
label: "Canvas color",
|
|
3247
3318
|
defaultValue: (_c = data.canvasColor) != null ? _c : "#FFFFFF",
|
|
3248
3319
|
onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
|
|
3249
3320
|
}
|
|
3250
|
-
), /* @__PURE__ */
|
|
3321
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3251
3322
|
NullableColorInput,
|
|
3252
3323
|
{
|
|
3253
3324
|
label: "Canvas border color",
|
|
3254
3325
|
defaultValue: (_d = data.borderColor) != null ? _d : null,
|
|
3255
3326
|
onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
|
|
3256
3327
|
}
|
|
3257
|
-
), /* @__PURE__ */
|
|
3328
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3258
3329
|
SliderInput,
|
|
3259
3330
|
{
|
|
3260
|
-
iconLabel: /* @__PURE__ */
|
|
3331
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.RoundedCornerOutlined, null),
|
|
3261
3332
|
units: "px",
|
|
3262
3333
|
step: 4,
|
|
3263
3334
|
marks: true,
|
|
@@ -3267,14 +3338,14 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3267
3338
|
defaultValue: (_e = data.borderRadius) != null ? _e : 0,
|
|
3268
3339
|
onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
|
|
3269
3340
|
}
|
|
3270
|
-
)), /* @__PURE__ */
|
|
3341
|
+
)), /* @__PURE__ */ React57__default.default.createElement(
|
|
3271
3342
|
NullableFontFamily,
|
|
3272
3343
|
{
|
|
3273
3344
|
label: "Font family",
|
|
3274
3345
|
defaultValue: "MODERN_SANS",
|
|
3275
3346
|
onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
|
|
3276
3347
|
}
|
|
3277
|
-
), /* @__PURE__ */
|
|
3348
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3278
3349
|
ColorInput2,
|
|
3279
3350
|
{
|
|
3280
3351
|
label: "Text color",
|
|
@@ -3285,7 +3356,7 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
3285
3356
|
}
|
|
3286
3357
|
function HeadingSidebarPanel({ data, setData }) {
|
|
3287
3358
|
var _a, _b, _c, _d;
|
|
3288
|
-
const [, setErrors] =
|
|
3359
|
+
const [, setErrors] = React57.useState(null);
|
|
3289
3360
|
const updateData = (d) => {
|
|
3290
3361
|
const res = HeadingPropsSchema.safeParse(d);
|
|
3291
3362
|
if (res.success) {
|
|
@@ -3295,7 +3366,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3295
3366
|
setErrors(res.error);
|
|
3296
3367
|
}
|
|
3297
3368
|
};
|
|
3298
|
-
return /* @__PURE__ */
|
|
3369
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3299
3370
|
TextInput,
|
|
3300
3371
|
{
|
|
3301
3372
|
label: "Content",
|
|
@@ -3305,7 +3376,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3305
3376
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
|
|
3306
3377
|
}
|
|
3307
3378
|
}
|
|
3308
|
-
), /* @__PURE__ */
|
|
3379
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3309
3380
|
RadioGroupInput,
|
|
3310
3381
|
{
|
|
3311
3382
|
label: "Level",
|
|
@@ -3314,10 +3385,10 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3314
3385
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
|
|
3315
3386
|
}
|
|
3316
3387
|
},
|
|
3317
|
-
/* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
), /* @__PURE__ */
|
|
3388
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "h1" }, "H1"),
|
|
3389
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "h2" }, "H2"),
|
|
3390
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "h3" }, "H3")
|
|
3391
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3321
3392
|
MultiStylePropertyPanel,
|
|
3322
3393
|
{
|
|
3323
3394
|
names: [
|
|
@@ -3337,7 +3408,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
3337
3408
|
}
|
|
3338
3409
|
function HtmlSidebarPanel({ data, setData }) {
|
|
3339
3410
|
var _a, _b;
|
|
3340
|
-
const [, setErrors] =
|
|
3411
|
+
const [, setErrors] = React57.useState(null);
|
|
3341
3412
|
const updateData = (d) => {
|
|
3342
3413
|
const res = HtmlPropsSchema.safeParse(d);
|
|
3343
3414
|
if (res.success) {
|
|
@@ -3347,7 +3418,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3347
3418
|
setErrors(res.error);
|
|
3348
3419
|
}
|
|
3349
3420
|
};
|
|
3350
|
-
return /* @__PURE__ */
|
|
3421
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3351
3422
|
TextInput,
|
|
3352
3423
|
{
|
|
3353
3424
|
label: "Content",
|
|
@@ -3355,7 +3426,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3355
3426
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
|
|
3356
3427
|
onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
|
|
3357
3428
|
}
|
|
3358
|
-
), /* @__PURE__ */
|
|
3429
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3359
3430
|
MultiStylePropertyPanel,
|
|
3360
3431
|
{
|
|
3361
3432
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
|
|
@@ -3366,10 +3437,10 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
3366
3437
|
}
|
|
3367
3438
|
function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
3368
3439
|
const { loadImages, deleteImage } = useImageCallbacks();
|
|
3369
|
-
const [images, setImages] =
|
|
3370
|
-
const [error, setError] =
|
|
3371
|
-
const [query, setQuery] =
|
|
3372
|
-
const [busy, setBusy] =
|
|
3440
|
+
const [images, setImages] = React57.useState(null);
|
|
3441
|
+
const [error, setError] = React57.useState(null);
|
|
3442
|
+
const [query, setQuery] = React57.useState("");
|
|
3443
|
+
const [busy, setBusy] = React57.useState(false);
|
|
3373
3444
|
const refresh = () => __async(null, null, function* () {
|
|
3374
3445
|
if (!loadImages) return;
|
|
3375
3446
|
setBusy(true);
|
|
@@ -3383,13 +3454,13 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
|
3383
3454
|
setBusy(false);
|
|
3384
3455
|
}
|
|
3385
3456
|
});
|
|
3386
|
-
|
|
3457
|
+
React57.useEffect(() => {
|
|
3387
3458
|
if (open) {
|
|
3388
3459
|
setQuery("");
|
|
3389
3460
|
void refresh();
|
|
3390
3461
|
}
|
|
3391
3462
|
}, [open]);
|
|
3392
|
-
const filtered =
|
|
3463
|
+
const filtered = React57.useMemo(() => {
|
|
3393
3464
|
if (!images) return null;
|
|
3394
3465
|
const q = query.trim().toLowerCase();
|
|
3395
3466
|
if (!q) return images;
|
|
@@ -3412,7 +3483,7 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
|
3412
3483
|
setBusy(false);
|
|
3413
3484
|
}
|
|
3414
3485
|
});
|
|
3415
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Dialog, { open, onClose, maxWidth: "md", fullWidth: true }, /* @__PURE__ */ React57__default.default.createElement(material.DialogTitle, null, "Image library"), /* @__PURE__ */ React57__default.default.createElement(material.DialogContent, { dividers: true }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3416
3487
|
material.TextField,
|
|
3417
3488
|
{
|
|
3418
3489
|
fullWidth: true,
|
|
@@ -3422,11 +3493,11 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
|
3422
3493
|
onChange: (e) => setQuery(e.target.value),
|
|
3423
3494
|
autoFocus: true,
|
|
3424
3495
|
InputProps: {
|
|
3425
|
-
startAdornment: /* @__PURE__ */
|
|
3496
|
+
startAdornment: /* @__PURE__ */ React57__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SearchOutlined, { fontSize: "small" }))
|
|
3426
3497
|
},
|
|
3427
3498
|
sx: { mb: 2 }
|
|
3428
3499
|
}
|
|
3429
|
-
), error && /* @__PURE__ */
|
|
3500
|
+
), error && /* @__PURE__ */ React57__default.default.createElement(material.Alert, { severity: "error", sx: { mb: 2 } }, error), busy && !images && /* @__PURE__ */ React57__default.default.createElement(material.Stack, { alignItems: "center", sx: { py: 4 } }, /* @__PURE__ */ React57__default.default.createElement(material.CircularProgress, { size: 28 })), filtered && filtered.length === 0 && /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", textAlign: "center", py: 4 } }, query ? "No images match your search." : "No images in the library yet."), filtered && filtered.length > 0 && /* @__PURE__ */ React57__default.default.createElement(
|
|
3430
3501
|
material.Box,
|
|
3431
3502
|
{
|
|
3432
3503
|
sx: {
|
|
@@ -3435,7 +3506,7 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
|
3435
3506
|
gap: 1.5
|
|
3436
3507
|
}
|
|
3437
3508
|
},
|
|
3438
|
-
filtered.map((img) => /* @__PURE__ */
|
|
3509
|
+
filtered.map((img) => /* @__PURE__ */ React57__default.default.createElement(
|
|
3439
3510
|
ImageTile,
|
|
3440
3511
|
{
|
|
3441
3512
|
key: img.url,
|
|
@@ -3444,7 +3515,7 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
|
|
|
3444
3515
|
onDelete: deleteImage ? () => handleDelete(img.url) : void 0
|
|
3445
3516
|
}
|
|
3446
3517
|
))
|
|
3447
|
-
)), /* @__PURE__ */
|
|
3518
|
+
)), /* @__PURE__ */ React57__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React57__default.default.createElement(material.Button, { onClick: onClose }, "Close")));
|
|
3448
3519
|
}
|
|
3449
3520
|
function ImageTile({
|
|
3450
3521
|
image,
|
|
@@ -3454,7 +3525,7 @@ function ImageTile({
|
|
|
3454
3525
|
var _a, _b;
|
|
3455
3526
|
const src = (_a = image.thumbnailUrl) != null ? _a : image.url;
|
|
3456
3527
|
const label = image.alt || image.url.split("/").pop() || "image";
|
|
3457
|
-
return /* @__PURE__ */
|
|
3528
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
3458
3529
|
material.Box,
|
|
3459
3530
|
{
|
|
3460
3531
|
sx: {
|
|
@@ -3470,7 +3541,7 @@ function ImageTile({
|
|
|
3470
3541
|
},
|
|
3471
3542
|
onClick: onPick
|
|
3472
3543
|
},
|
|
3473
|
-
/* @__PURE__ */
|
|
3544
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
3474
3545
|
material.Box,
|
|
3475
3546
|
{
|
|
3476
3547
|
component: "img",
|
|
@@ -3479,8 +3550,8 @@ function ImageTile({
|
|
|
3479
3550
|
sx: { display: "block", width: "100%", aspectRatio: "1 / 1", objectFit: "cover", backgroundColor: "#f5f5f5" }
|
|
3480
3551
|
}
|
|
3481
3552
|
),
|
|
3482
|
-
/* @__PURE__ */
|
|
3483
|
-
onDelete && /* @__PURE__ */
|
|
3553
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { p: 0.75, fontSize: 11, color: "text.secondary", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, label),
|
|
3554
|
+
onDelete && /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Delete from library" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3484
3555
|
material.IconButton,
|
|
3485
3556
|
{
|
|
3486
3557
|
size: "small",
|
|
@@ -3500,7 +3571,7 @@ function ImageTile({
|
|
|
3500
3571
|
},
|
|
3501
3572
|
"aria-label": "Delete image"
|
|
3502
3573
|
},
|
|
3503
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DeleteOutline, { fontSize: "small" })
|
|
3504
3575
|
))
|
|
3505
3576
|
);
|
|
3506
3577
|
}
|
|
@@ -3512,12 +3583,12 @@ function isHttpUrl(value) {
|
|
|
3512
3583
|
}
|
|
3513
3584
|
function ImageSidebarPanel({ data, setData }) {
|
|
3514
3585
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3515
|
-
const [, setErrors] =
|
|
3586
|
+
const [, setErrors] = React57.useState(null);
|
|
3516
3587
|
const { uploadImage, loadImages } = useImageCallbacks();
|
|
3517
|
-
const fileInputRef =
|
|
3518
|
-
const [uploading, setUploading] =
|
|
3519
|
-
const [uploadError, setUploadError] =
|
|
3520
|
-
const [libraryOpen, setLibraryOpen] =
|
|
3588
|
+
const fileInputRef = React57.useRef(null);
|
|
3589
|
+
const [uploading, setUploading] = React57.useState(false);
|
|
3590
|
+
const [uploadError, setUploadError] = React57.useState(null);
|
|
3591
|
+
const [libraryOpen, setLibraryOpen] = React57.useState(false);
|
|
3521
3592
|
const updateData = (d) => {
|
|
3522
3593
|
const res = ImagePropsSchema.safeParse(d);
|
|
3523
3594
|
if (res.success) {
|
|
@@ -3553,13 +3624,13 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3553
3624
|
});
|
|
3554
3625
|
const url = (_b = (_a = data.props) == null ? void 0 : _a.url) != null ? _b : "";
|
|
3555
3626
|
const showHttpWarning = isHttpUrl(url);
|
|
3556
|
-
return /* @__PURE__ */
|
|
3627
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Image block" }, (uploadImage || loadImages) && /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 1 }, uploadImage && /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
3557
3628
|
material.Button,
|
|
3558
3629
|
{
|
|
3559
3630
|
fullWidth: true,
|
|
3560
3631
|
variant: "outlined",
|
|
3561
3632
|
size: "small",
|
|
3562
|
-
startIcon: uploading ? /* @__PURE__ */
|
|
3633
|
+
startIcon: uploading ? /* @__PURE__ */ React57__default.default.createElement(material.CircularProgress, { size: 14 }) : /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.CloudUploadOutlined, { fontSize: "small" }),
|
|
3563
3634
|
disabled: uploading,
|
|
3564
3635
|
onClick: () => {
|
|
3565
3636
|
var _a2;
|
|
@@ -3567,7 +3638,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3567
3638
|
}
|
|
3568
3639
|
},
|
|
3569
3640
|
uploading ? "Uploading\u2026" : "Upload"
|
|
3570
|
-
), /* @__PURE__ */
|
|
3641
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3571
3642
|
"input",
|
|
3572
3643
|
{
|
|
3573
3644
|
ref: fileInputRef,
|
|
@@ -3581,17 +3652,17 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3581
3652
|
if (file) yield handleFile(file);
|
|
3582
3653
|
})
|
|
3583
3654
|
}
|
|
3584
|
-
)), loadImages && /* @__PURE__ */
|
|
3655
|
+
)), loadImages && /* @__PURE__ */ React57__default.default.createElement(
|
|
3585
3656
|
material.Button,
|
|
3586
3657
|
{
|
|
3587
3658
|
fullWidth: true,
|
|
3588
3659
|
variant: "outlined",
|
|
3589
3660
|
size: "small",
|
|
3590
|
-
startIcon: /* @__PURE__ */
|
|
3661
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.CollectionsOutlined, { fontSize: "small" }),
|
|
3591
3662
|
onClick: () => setLibraryOpen(true)
|
|
3592
3663
|
},
|
|
3593
3664
|
"Library"
|
|
3594
|
-
)), uploadError && /* @__PURE__ */
|
|
3665
|
+
)), uploadError && /* @__PURE__ */ React57__default.default.createElement(material.Alert, { severity: "error", onClose: () => setUploadError(null), sx: { mt: 1 } }, uploadError), /* @__PURE__ */ React57__default.default.createElement(
|
|
3595
3666
|
TextInput,
|
|
3596
3667
|
{
|
|
3597
3668
|
label: "Source URL",
|
|
@@ -3601,14 +3672,14 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3601
3672
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: next }) }));
|
|
3602
3673
|
}
|
|
3603
3674
|
}
|
|
3604
|
-
), showHttpWarning && /* @__PURE__ */
|
|
3675
|
+
), showHttpWarning && /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { mt: -1, mb: 1, display: "flex", alignItems: "flex-start", gap: 0.75 } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ErrorOutlineOutlined, { fontSize: "small", sx: { color: "warning.main", mt: "2px" } }), /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { fontSize: 12, color: "warning.dark" } }, "Non-HTTPS URL: Gmail and other clients strip mixed content. Use https:// for reliable delivery.")), /* @__PURE__ */ React57__default.default.createElement(
|
|
3605
3676
|
TextInput,
|
|
3606
3677
|
{
|
|
3607
3678
|
label: "Alt text",
|
|
3608
3679
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
|
|
3609
3680
|
onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
|
|
3610
3681
|
}
|
|
3611
|
-
), /* @__PURE__ */
|
|
3682
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3612
3683
|
TextInput,
|
|
3613
3684
|
{
|
|
3614
3685
|
label: "Click through URL",
|
|
@@ -3618,38 +3689,38 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3618
3689
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
|
|
3619
3690
|
}
|
|
3620
3691
|
}
|
|
3621
|
-
), /* @__PURE__ */
|
|
3692
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3622
3693
|
TextDimensionInput,
|
|
3623
3694
|
{
|
|
3624
3695
|
label: "Width",
|
|
3625
3696
|
defaultValue: (_g = data.props) == null ? void 0 : _g.width,
|
|
3626
3697
|
onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
|
|
3627
3698
|
}
|
|
3628
|
-
), /* @__PURE__ */
|
|
3699
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3629
3700
|
TextDimensionInput,
|
|
3630
3701
|
{
|
|
3631
3702
|
label: "Height",
|
|
3632
3703
|
defaultValue: (_h = data.props) == null ? void 0 : _h.height,
|
|
3633
3704
|
onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
|
|
3634
3705
|
}
|
|
3635
|
-
)), /* @__PURE__ */
|
|
3706
|
+
)), /* @__PURE__ */ React57__default.default.createElement(
|
|
3636
3707
|
RadioGroupInput,
|
|
3637
3708
|
{
|
|
3638
3709
|
label: "Alignment",
|
|
3639
3710
|
defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
|
|
3640
3711
|
onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
|
|
3641
3712
|
},
|
|
3642
|
-
/* @__PURE__ */
|
|
3643
|
-
/* @__PURE__ */
|
|
3644
|
-
/* @__PURE__ */
|
|
3645
|
-
), /* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "top" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3714
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "middle" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3715
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "bottom" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3716
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3646
3717
|
MultiStylePropertyPanel,
|
|
3647
3718
|
{
|
|
3648
3719
|
names: ["backgroundColor", "textAlign", "padding"],
|
|
3649
3720
|
value: data.style,
|
|
3650
3721
|
onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
|
|
3651
3722
|
}
|
|
3652
|
-
), loadImages && /* @__PURE__ */
|
|
3723
|
+
), loadImages && /* @__PURE__ */ React57__default.default.createElement(
|
|
3653
3724
|
ImageLibraryDialog,
|
|
3654
3725
|
{
|
|
3655
3726
|
open: libraryOpen,
|
|
@@ -3663,7 +3734,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
3663
3734
|
}
|
|
3664
3735
|
function SignatureSidebarPanel({ data, setData }) {
|
|
3665
3736
|
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;
|
|
3666
|
-
const [, setErrors] =
|
|
3737
|
+
const [, setErrors] = React57.useState(null);
|
|
3667
3738
|
const updateData = (d) => {
|
|
3668
3739
|
const res = SignaturePropsSchema.safeParse(d);
|
|
3669
3740
|
if (res.success) {
|
|
@@ -3688,74 +3759,74 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3688
3759
|
const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
|
|
3689
3760
|
const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
|
|
3690
3761
|
const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
|
|
3691
|
-
return /* @__PURE__ */
|
|
3762
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3692
3763
|
TextInput,
|
|
3693
3764
|
{
|
|
3694
3765
|
label: "Greeting",
|
|
3695
3766
|
defaultValue: greeting,
|
|
3696
3767
|
onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
|
|
3697
3768
|
}
|
|
3698
|
-
), /* @__PURE__ */
|
|
3769
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3699
3770
|
TextInput,
|
|
3700
3771
|
{
|
|
3701
3772
|
label: "Name",
|
|
3702
3773
|
defaultValue: name,
|
|
3703
3774
|
onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
|
|
3704
3775
|
}
|
|
3705
|
-
), /* @__PURE__ */
|
|
3776
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3706
3777
|
TextInput,
|
|
3707
3778
|
{
|
|
3708
3779
|
label: "Title",
|
|
3709
3780
|
defaultValue: title,
|
|
3710
3781
|
onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
|
|
3711
3782
|
}
|
|
3712
|
-
), /* @__PURE__ */
|
|
3783
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3713
3784
|
TextInput,
|
|
3714
3785
|
{
|
|
3715
3786
|
label: "Company",
|
|
3716
3787
|
defaultValue: company,
|
|
3717
3788
|
onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
|
|
3718
3789
|
}
|
|
3719
|
-
), /* @__PURE__ */
|
|
3790
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3720
3791
|
TextInput,
|
|
3721
3792
|
{
|
|
3722
3793
|
label: "Address",
|
|
3723
3794
|
defaultValue: address,
|
|
3724
3795
|
onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
|
|
3725
3796
|
}
|
|
3726
|
-
), /* @__PURE__ */
|
|
3797
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3727
3798
|
TextInput,
|
|
3728
3799
|
{
|
|
3729
3800
|
label: "Email",
|
|
3730
3801
|
defaultValue: email,
|
|
3731
3802
|
onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
|
|
3732
3803
|
}
|
|
3733
|
-
), /* @__PURE__ */
|
|
3804
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3734
3805
|
TextInput,
|
|
3735
3806
|
{
|
|
3736
3807
|
label: "Phone",
|
|
3737
3808
|
defaultValue: phone,
|
|
3738
3809
|
onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
|
|
3739
3810
|
}
|
|
3740
|
-
), /* @__PURE__ */
|
|
3811
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3741
3812
|
TextInput,
|
|
3742
3813
|
{
|
|
3743
3814
|
label: "Website",
|
|
3744
3815
|
defaultValue: website,
|
|
3745
3816
|
onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
|
|
3746
3817
|
}
|
|
3747
|
-
), /* @__PURE__ */
|
|
3818
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3748
3819
|
TextInput,
|
|
3749
3820
|
{
|
|
3750
3821
|
label: "Image URL",
|
|
3751
3822
|
defaultValue: imageUrl,
|
|
3752
3823
|
onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
|
|
3753
3824
|
}
|
|
3754
|
-
), /* @__PURE__ */
|
|
3825
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3755
3826
|
SliderInput,
|
|
3756
3827
|
{
|
|
3757
3828
|
label: "Image size",
|
|
3758
|
-
iconLabel: /* @__PURE__ */
|
|
3829
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
3759
3830
|
units: "px",
|
|
3760
3831
|
step: 4,
|
|
3761
3832
|
min: 32,
|
|
@@ -3763,47 +3834,47 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3763
3834
|
defaultValue: imageSize,
|
|
3764
3835
|
onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
|
|
3765
3836
|
}
|
|
3766
|
-
), /* @__PURE__ */
|
|
3837
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3767
3838
|
RadioGroupInput,
|
|
3768
3839
|
{
|
|
3769
3840
|
label: "Image shape",
|
|
3770
3841
|
defaultValue: imageShape,
|
|
3771
3842
|
onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
|
|
3772
3843
|
},
|
|
3773
|
-
/* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
3776
|
-
), /* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "circle" }, "Circle"),
|
|
3845
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "square" }, "Square"),
|
|
3846
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "rounded" }, "Rounded")
|
|
3847
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3777
3848
|
RadioGroupInput,
|
|
3778
3849
|
{
|
|
3779
3850
|
label: "Layout",
|
|
3780
3851
|
defaultValue: layout,
|
|
3781
3852
|
onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
|
|
3782
3853
|
},
|
|
3783
|
-
/* @__PURE__ */
|
|
3784
|
-
/* @__PURE__ */
|
|
3785
|
-
), /* @__PURE__ */
|
|
3854
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "horizontal" }, "Horizontal"),
|
|
3855
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "vertical" }, "Vertical")
|
|
3856
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3786
3857
|
ColorInput2,
|
|
3787
3858
|
{
|
|
3788
3859
|
label: "Name color",
|
|
3789
3860
|
defaultValue: nameColor,
|
|
3790
3861
|
onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
|
|
3791
3862
|
}
|
|
3792
|
-
), /* @__PURE__ */
|
|
3863
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3793
3864
|
ColorInput2,
|
|
3794
3865
|
{
|
|
3795
3866
|
label: "Text color",
|
|
3796
3867
|
defaultValue: textColor,
|
|
3797
3868
|
onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
|
|
3798
3869
|
}
|
|
3799
|
-
), /* @__PURE__ */
|
|
3870
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3800
3871
|
ColorInput2,
|
|
3801
3872
|
{
|
|
3802
3873
|
label: "Link color",
|
|
3803
3874
|
defaultValue: linkColor,
|
|
3804
3875
|
onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
|
|
3805
3876
|
}
|
|
3806
|
-
), /* @__PURE__ */
|
|
3877
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3807
3878
|
MultiStylePropertyPanel,
|
|
3808
3879
|
{
|
|
3809
3880
|
names: ["backgroundColor", "fontFamily", "padding"],
|
|
@@ -3814,7 +3885,7 @@ function SignatureSidebarPanel({ data, setData }) {
|
|
|
3814
3885
|
}
|
|
3815
3886
|
function SpacerSidebarPanel({ data, setData }) {
|
|
3816
3887
|
var _a, _b;
|
|
3817
|
-
const [, setErrors] =
|
|
3888
|
+
const [, setErrors] = React57.useState(null);
|
|
3818
3889
|
const updateData = (d) => {
|
|
3819
3890
|
const res = SpacerPropsSchema.safeParse(d);
|
|
3820
3891
|
if (res.success) {
|
|
@@ -3824,11 +3895,11 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3824
3895
|
setErrors(res.error);
|
|
3825
3896
|
}
|
|
3826
3897
|
};
|
|
3827
|
-
return /* @__PURE__ */
|
|
3898
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3828
3899
|
SliderInput,
|
|
3829
3900
|
{
|
|
3830
3901
|
label: "Height",
|
|
3831
|
-
iconLabel: /* @__PURE__ */
|
|
3902
|
+
iconLabel: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
3832
3903
|
units: "px",
|
|
3833
3904
|
step: 4,
|
|
3834
3905
|
min: 4,
|
|
@@ -3840,7 +3911,7 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
3840
3911
|
}
|
|
3841
3912
|
function TextSidebarPanel({ data, setData }) {
|
|
3842
3913
|
var _a, _b, _c, _d;
|
|
3843
|
-
const [, setErrors] =
|
|
3914
|
+
const [, setErrors] = React57.useState(null);
|
|
3844
3915
|
const updateData = (d) => {
|
|
3845
3916
|
const res = TextPropsSchema.safeParse(d);
|
|
3846
3917
|
if (res.success) {
|
|
@@ -3850,7 +3921,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3850
3921
|
setErrors(res.error);
|
|
3851
3922
|
}
|
|
3852
3923
|
};
|
|
3853
|
-
return /* @__PURE__ */
|
|
3924
|
+
return /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
3854
3925
|
TextInput,
|
|
3855
3926
|
{
|
|
3856
3927
|
label: "Content",
|
|
@@ -3858,14 +3929,14 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3858
3929
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
|
|
3859
3930
|
onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
|
|
3860
3931
|
}
|
|
3861
|
-
), /* @__PURE__ */
|
|
3932
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3862
3933
|
BooleanInput,
|
|
3863
3934
|
{
|
|
3864
3935
|
label: "Markdown",
|
|
3865
3936
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
|
|
3866
3937
|
onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
|
|
3867
3938
|
}
|
|
3868
|
-
), /* @__PURE__ */
|
|
3939
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
3869
3940
|
MultiStylePropertyPanel,
|
|
3870
3941
|
{
|
|
3871
3942
|
names: [
|
|
@@ -3887,7 +3958,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
3887
3958
|
|
|
3888
3959
|
// src/app/inspector-drawer/configuration-panel/index.tsx
|
|
3889
3960
|
function renderMessage(val) {
|
|
3890
|
-
return /* @__PURE__ */
|
|
3961
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { color: "text.secondary" }, val));
|
|
3891
3962
|
}
|
|
3892
3963
|
function ConfigurationPanel() {
|
|
3893
3964
|
const document2 = useDocument();
|
|
@@ -3903,55 +3974,55 @@ function ConfigurationPanel() {
|
|
|
3903
3974
|
const { data, type } = block;
|
|
3904
3975
|
switch (type) {
|
|
3905
3976
|
case "Avatar":
|
|
3906
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ React57__default.default.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3907
3978
|
case "Button":
|
|
3908
|
-
return /* @__PURE__ */
|
|
3979
|
+
return /* @__PURE__ */ React57__default.default.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3909
3980
|
case "ColumnsContainer":
|
|
3910
|
-
return /* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ React57__default.default.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3911
3982
|
case "Container":
|
|
3912
|
-
return /* @__PURE__ */
|
|
3983
|
+
return /* @__PURE__ */ React57__default.default.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3913
3984
|
case "Divider":
|
|
3914
|
-
return /* @__PURE__ */
|
|
3985
|
+
return /* @__PURE__ */ React57__default.default.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3915
3986
|
case "Heading":
|
|
3916
|
-
return /* @__PURE__ */
|
|
3987
|
+
return /* @__PURE__ */ React57__default.default.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3917
3988
|
case "Html":
|
|
3918
|
-
return /* @__PURE__ */
|
|
3989
|
+
return /* @__PURE__ */ React57__default.default.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3919
3990
|
case "Image":
|
|
3920
|
-
return /* @__PURE__ */
|
|
3991
|
+
return /* @__PURE__ */ React57__default.default.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3921
3992
|
case "EmailLayout":
|
|
3922
|
-
return /* @__PURE__ */
|
|
3993
|
+
return /* @__PURE__ */ React57__default.default.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3923
3994
|
case "Spacer":
|
|
3924
|
-
return /* @__PURE__ */
|
|
3995
|
+
return /* @__PURE__ */ React57__default.default.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3925
3996
|
case "Signature":
|
|
3926
|
-
return /* @__PURE__ */
|
|
3997
|
+
return /* @__PURE__ */ React57__default.default.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3927
3998
|
case "Text":
|
|
3928
|
-
return /* @__PURE__ */
|
|
3999
|
+
return /* @__PURE__ */ React57__default.default.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3929
4000
|
default:
|
|
3930
|
-
return /* @__PURE__ */
|
|
4001
|
+
return /* @__PURE__ */ React57__default.default.createElement("pre", null, JSON.stringify(block, null, " "));
|
|
3931
4002
|
}
|
|
3932
4003
|
}
|
|
3933
4004
|
function StylesPanel() {
|
|
3934
4005
|
const block = useDocument().root;
|
|
3935
4006
|
if (!block) {
|
|
3936
|
-
return /* @__PURE__ */
|
|
4007
|
+
return /* @__PURE__ */ React57__default.default.createElement("p", null, "Block not found");
|
|
3937
4008
|
}
|
|
3938
4009
|
const { data, type } = block;
|
|
3939
4010
|
if (type !== "EmailLayout") {
|
|
3940
4011
|
throw new Error('Expected "root" element to be of type EmailLayout');
|
|
3941
4012
|
}
|
|
3942
|
-
return /* @__PURE__ */
|
|
4013
|
+
return /* @__PURE__ */ React57__default.default.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
|
|
3943
4014
|
}
|
|
3944
4015
|
function TemplateDownloadButton() {
|
|
3945
4016
|
const doc = useDocument();
|
|
3946
|
-
const href =
|
|
4017
|
+
const href = React57.useMemo(() => {
|
|
3947
4018
|
return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
|
|
3948
4019
|
}, [doc]);
|
|
3949
|
-
return /* @__PURE__ */
|
|
4020
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
3950
4021
|
material.Button,
|
|
3951
4022
|
{
|
|
3952
4023
|
variant: "outlined",
|
|
3953
4024
|
color: "primary",
|
|
3954
|
-
startIcon: /* @__PURE__ */
|
|
4025
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FileDownloadOutlined, null),
|
|
3955
4026
|
href,
|
|
3956
4027
|
download: "emailTemplate.json",
|
|
3957
4028
|
fullWidth: true
|
|
@@ -3961,8 +4032,18 @@ function TemplateDownloadButton() {
|
|
|
3961
4032
|
}
|
|
3962
4033
|
|
|
3963
4034
|
// src/app/inspector-drawer/template-panel.tsx
|
|
3964
|
-
function TemplatePanel({
|
|
3965
|
-
|
|
4035
|
+
function TemplatePanel({
|
|
4036
|
+
deleteTemplate,
|
|
4037
|
+
copyTemplate,
|
|
4038
|
+
renameTemplate
|
|
4039
|
+
}) {
|
|
4040
|
+
const {
|
|
4041
|
+
currentTemplateId,
|
|
4042
|
+
currentTemplateName,
|
|
4043
|
+
currentTemplateTags,
|
|
4044
|
+
setCurrentTemplate,
|
|
4045
|
+
setCurrentTemplateTags
|
|
4046
|
+
} = useEmailEditor();
|
|
3966
4047
|
const document2 = useDocument();
|
|
3967
4048
|
const persistenceEnabled = usePersistenceEnabled();
|
|
3968
4049
|
const workspaceBackground = useWorkspaceBackground();
|
|
@@ -3983,7 +4064,7 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3983
4064
|
window.alert("Template copied successfully!");
|
|
3984
4065
|
}
|
|
3985
4066
|
};
|
|
3986
|
-
const workspaceToggle = /* @__PURE__ */
|
|
4067
|
+
const workspaceToggle = /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Editor appearance" }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1 }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.secondary" } }, "Workspace background"), /* @__PURE__ */ React57__default.default.createElement(
|
|
3987
4068
|
material.ToggleButtonGroup,
|
|
3988
4069
|
{
|
|
3989
4070
|
value: workspaceBackground,
|
|
@@ -3991,13 +4072,27 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3991
4072
|
size: "small",
|
|
3992
4073
|
onChange: (_, v) => v && setWorkspaceBackground(v)
|
|
3993
4074
|
},
|
|
3994
|
-
/* @__PURE__ */
|
|
3995
|
-
/* @__PURE__ */
|
|
3996
|
-
), /* @__PURE__ */
|
|
4075
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "checkerboard", sx: { textTransform: "none", gap: 0.75 } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.GridOnOutlined, { fontSize: "small" }), "Checkerboard"),
|
|
4076
|
+
/* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "solid", sx: { textTransform: "none", gap: 0.75 } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SquareOutlined, { fontSize: "small" }), "Solid")
|
|
4077
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.disabled" } }, "Editor-only \u2014 never reaches the rendered email.")));
|
|
3997
4078
|
if (!currentTemplateId) {
|
|
3998
|
-
return /* @__PURE__ */
|
|
4079
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected"), workspaceToggle);
|
|
3999
4080
|
}
|
|
4000
|
-
return /* @__PURE__ */
|
|
4081
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Details" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4082
|
+
DetailsEditor,
|
|
4083
|
+
{
|
|
4084
|
+
templateId: currentTemplateId,
|
|
4085
|
+
currentName: currentTemplateName != null ? currentTemplateName : "",
|
|
4086
|
+
currentTags: currentTemplateTags,
|
|
4087
|
+
canEdit: Boolean(renameTemplate),
|
|
4088
|
+
onSave: (name, tags) => __async(null, null, function* () {
|
|
4089
|
+
if (!renameTemplate) return;
|
|
4090
|
+
yield renameTemplate(currentTemplateId, name, { tags });
|
|
4091
|
+
setCurrentTemplate(currentTemplateId, name);
|
|
4092
|
+
setCurrentTemplateTags(tags);
|
|
4093
|
+
})
|
|
4094
|
+
}
|
|
4095
|
+
)), /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React57__default.default.createElement(
|
|
4001
4096
|
material.Typography,
|
|
4002
4097
|
{
|
|
4003
4098
|
variant: "body2",
|
|
@@ -4010,29 +4105,127 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
4010
4105
|
}
|
|
4011
4106
|
},
|
|
4012
4107
|
"Save functionality is disabled. To enable saving, provide the necessary callback functions."
|
|
4013
|
-
), persistenceEnabled && /* @__PURE__ */
|
|
4108
|
+
), persistenceEnabled && /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
4014
4109
|
material.Button,
|
|
4015
4110
|
{
|
|
4016
4111
|
variant: "outlined",
|
|
4017
4112
|
color: "primary",
|
|
4018
|
-
startIcon: /* @__PURE__ */
|
|
4113
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ContentCopyOutlined, null),
|
|
4019
4114
|
onClick: handleCopyToSamples,
|
|
4020
4115
|
fullWidth: true,
|
|
4021
4116
|
disabled: !copyTemplate
|
|
4022
4117
|
},
|
|
4023
4118
|
"Save as Sample Template"
|
|
4024
|
-
), /* @__PURE__ */
|
|
4119
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
4025
4120
|
material.Button,
|
|
4026
4121
|
{
|
|
4027
4122
|
variant: "outlined",
|
|
4028
4123
|
color: "error",
|
|
4029
|
-
startIcon: /* @__PURE__ */
|
|
4124
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DeleteOutlined, null),
|
|
4030
4125
|
onClick: handleDelete,
|
|
4031
4126
|
fullWidth: true,
|
|
4032
4127
|
disabled: !deleteTemplate
|
|
4033
4128
|
},
|
|
4034
4129
|
"Delete Template"
|
|
4035
|
-
)))), persistenceEnabled && /* @__PURE__ */
|
|
4130
|
+
)))), persistenceEnabled && /* @__PURE__ */ React57__default.default.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 2 }, /* @__PURE__ */ React57__default.default.createElement(TemplateDownloadButton, null))), workspaceToggle);
|
|
4131
|
+
}
|
|
4132
|
+
function DetailsEditor({ templateId, currentName, currentTags, canEdit, onSave }) {
|
|
4133
|
+
const [name, setName] = React57.useState(currentName);
|
|
4134
|
+
const [tags, setTags] = React57.useState(currentTags);
|
|
4135
|
+
const [tagInput, setTagInput] = React57.useState("");
|
|
4136
|
+
const [saving, setSaving] = React57.useState(false);
|
|
4137
|
+
const [justSaved, setJustSaved] = React57.useState(false);
|
|
4138
|
+
React57.useEffect(() => {
|
|
4139
|
+
setName(currentName);
|
|
4140
|
+
}, [templateId, currentName]);
|
|
4141
|
+
React57.useEffect(() => {
|
|
4142
|
+
setTags(currentTags);
|
|
4143
|
+
}, [templateId, currentTags.join("")]);
|
|
4144
|
+
const addTag = () => {
|
|
4145
|
+
const trimmed = tagInput.trim();
|
|
4146
|
+
if (!trimmed) return;
|
|
4147
|
+
if (tags.some((t2) => t2.toLowerCase() === trimmed.toLowerCase())) {
|
|
4148
|
+
setTagInput("");
|
|
4149
|
+
return;
|
|
4150
|
+
}
|
|
4151
|
+
setTags([...tags, trimmed]);
|
|
4152
|
+
setTagInput("");
|
|
4153
|
+
};
|
|
4154
|
+
const removeTag = (tag) => setTags(tags.filter((t2) => t2 !== tag));
|
|
4155
|
+
const dirty = name !== currentName || tags.length !== currentTags.length || tags.some((t2, i) => t2 !== currentTags[i]);
|
|
4156
|
+
const handleSave = () => __async(null, null, function* () {
|
|
4157
|
+
if (!canEdit || !dirty || !name.trim()) return;
|
|
4158
|
+
setSaving(true);
|
|
4159
|
+
try {
|
|
4160
|
+
yield onSave(name.trim(), tags);
|
|
4161
|
+
setJustSaved(true);
|
|
4162
|
+
window.setTimeout(() => setJustSaved(false), 1600);
|
|
4163
|
+
} finally {
|
|
4164
|
+
setSaving(false);
|
|
4165
|
+
}
|
|
4166
|
+
});
|
|
4167
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 1.5 }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4168
|
+
material.TextField,
|
|
4169
|
+
{
|
|
4170
|
+
size: "small",
|
|
4171
|
+
label: "Name",
|
|
4172
|
+
value: name,
|
|
4173
|
+
onChange: (e) => setName(e.target.value),
|
|
4174
|
+
disabled: !canEdit || saving,
|
|
4175
|
+
fullWidth: true
|
|
4176
|
+
}
|
|
4177
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Box, null, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mb: 0.5 } }, "Tags"), tags.length > 0 ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { flexWrap: "wrap", gap: 0.5, mb: 1 } }, tags.map((tag) => /* @__PURE__ */ React57__default.default.createElement(
|
|
4178
|
+
material.Chip,
|
|
4179
|
+
{
|
|
4180
|
+
key: tag,
|
|
4181
|
+
label: tag,
|
|
4182
|
+
size: "small",
|
|
4183
|
+
onDelete: canEdit && !saving ? () => removeTag(tag) : void 0
|
|
4184
|
+
}
|
|
4185
|
+
))) : /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.disabled", display: "block", mb: 1 } }, "No tags. Suggested: ", /* @__PURE__ */ React57__default.default.createElement("i", null, "transactional"), ", ", /* @__PURE__ */ React57__default.default.createElement("i", null, "marketing"), "."), /* @__PURE__ */ React57__default.default.createElement(
|
|
4186
|
+
material.TextField,
|
|
4187
|
+
{
|
|
4188
|
+
size: "small",
|
|
4189
|
+
fullWidth: true,
|
|
4190
|
+
placeholder: "Add a tag",
|
|
4191
|
+
value: tagInput,
|
|
4192
|
+
onChange: (e) => setTagInput(e.target.value),
|
|
4193
|
+
disabled: !canEdit || saving,
|
|
4194
|
+
onKeyDown: (e) => {
|
|
4195
|
+
if (e.key === "Enter" || e.key === ",") {
|
|
4196
|
+
e.preventDefault();
|
|
4197
|
+
addTag();
|
|
4198
|
+
} else if (e.key === "Backspace" && !tagInput && tags.length > 0) {
|
|
4199
|
+
e.preventDefault();
|
|
4200
|
+
removeTag(tags[tags.length - 1]);
|
|
4201
|
+
}
|
|
4202
|
+
},
|
|
4203
|
+
InputProps: {
|
|
4204
|
+
endAdornment: /* @__PURE__ */ React57__default.default.createElement(material.InputAdornment, { position: "end" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4205
|
+
material.Button,
|
|
4206
|
+
{
|
|
4207
|
+
size: "small",
|
|
4208
|
+
onClick: addTag,
|
|
4209
|
+
disabled: !canEdit || saving || !tagInput.trim(),
|
|
4210
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" }),
|
|
4211
|
+
sx: { textTransform: "none" }
|
|
4212
|
+
},
|
|
4213
|
+
"Add"
|
|
4214
|
+
))
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
)), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: canEdit ? "" : "Wire a renameTemplate callback to enable editing from here", placement: "top" }, /* @__PURE__ */ React57__default.default.createElement("span", null, /* @__PURE__ */ React57__default.default.createElement(
|
|
4218
|
+
material.Button,
|
|
4219
|
+
{
|
|
4220
|
+
variant: "contained",
|
|
4221
|
+
size: "small",
|
|
4222
|
+
fullWidth: true,
|
|
4223
|
+
onClick: handleSave,
|
|
4224
|
+
disabled: !canEdit || saving || !dirty || !name.trim(),
|
|
4225
|
+
startIcon: justSaved ? /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.CheckOutlined, { fontSize: "small" }) : null
|
|
4226
|
+
},
|
|
4227
|
+
saving ? "Saving\u2026" : justSaved ? "Saved" : "Save details"
|
|
4228
|
+
))));
|
|
4036
4229
|
}
|
|
4037
4230
|
|
|
4038
4231
|
// src/app/variables/variable-utils.ts
|
|
@@ -4206,7 +4399,7 @@ function VariablesPanel() {
|
|
|
4206
4399
|
const lastFocused = useLastFocusedEditable();
|
|
4207
4400
|
const root = document2.root;
|
|
4208
4401
|
if (!root || root.type !== "EmailLayout") {
|
|
4209
|
-
return /* @__PURE__ */
|
|
4402
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React57__default.default.createElement(material.Alert, { severity: "info" }, "Open a template to manage variables."));
|
|
4210
4403
|
}
|
|
4211
4404
|
const data = root.data;
|
|
4212
4405
|
const variables = ((_a = data.variables) != null ? _a : []).map((v) => {
|
|
@@ -4217,9 +4410,9 @@ function VariablesPanel() {
|
|
|
4217
4410
|
sampleValue: (_b = v.sampleValue) != null ? _b : ""
|
|
4218
4411
|
};
|
|
4219
4412
|
});
|
|
4220
|
-
const usage =
|
|
4221
|
-
const declaredNames =
|
|
4222
|
-
const undeclared =
|
|
4413
|
+
const usage = React57.useMemo(() => collectTokenUsage(document2), [document2]);
|
|
4414
|
+
const declaredNames = React57.useMemo(() => new Set(variables.map((v) => v.name)), [variables]);
|
|
4415
|
+
const undeclared = React57.useMemo(
|
|
4223
4416
|
() => [...usage.keys()].filter((n) => n && !declaredNames.has(n)),
|
|
4224
4417
|
[usage, declaredNames]
|
|
4225
4418
|
);
|
|
@@ -4301,7 +4494,7 @@ function VariablesPanel() {
|
|
|
4301
4494
|
} catch (e) {
|
|
4302
4495
|
}
|
|
4303
4496
|
});
|
|
4304
|
-
return /* @__PURE__ */
|
|
4497
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { p: 2 }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { mb: 1 } }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "subtitle1", sx: { fontWeight: 600 } }, "Variables"), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Add variable" }, /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { size: "small", onClick: add, "aria-label": "Add variable" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })))), /* @__PURE__ */ React57__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__ */ React57__default.default.createElement(material.Box, { component: "code", sx: { fontFamily: "monospace" } }, "{{name}}"), ". In Preview mode, tokens render with the sample values below."), undeclared.length > 0 && /* @__PURE__ */ React57__default.default.createElement(material.Alert, { severity: "warning", sx: { mb: 2 } }, /* @__PURE__ */ React57__default.default.createElement(material.AlertTitle, { sx: { fontSize: 13 } }, "Undeclared in body"), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, useFlexGap: true, flexWrap: "wrap" }, undeclared.map((name) => /* @__PURE__ */ React57__default.default.createElement(
|
|
4305
4498
|
material.Chip,
|
|
4306
4499
|
{
|
|
4307
4500
|
key: name,
|
|
@@ -4309,12 +4502,12 @@ function VariablesPanel() {
|
|
|
4309
4502
|
label: name,
|
|
4310
4503
|
onClick: () => addFromToken(name),
|
|
4311
4504
|
onDelete: () => addFromToken(name),
|
|
4312
|
-
deleteIcon: /* @__PURE__ */
|
|
4505
|
+
deleteIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, null),
|
|
4313
4506
|
sx: { fontFamily: "monospace" }
|
|
4314
4507
|
}
|
|
4315
|
-
))), /* @__PURE__ */
|
|
4508
|
+
))), /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mt: 0.5 } }, "Click a token to declare it.")), variables.length === 0 ? /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary" } }, "No variables declared. Click + to add one.") : /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 2 }, variables.map((v, i) => {
|
|
4316
4509
|
var _a2;
|
|
4317
|
-
return /* @__PURE__ */
|
|
4510
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
4318
4511
|
VariableRow,
|
|
4319
4512
|
{
|
|
4320
4513
|
key: i,
|
|
@@ -4347,9 +4540,9 @@ function VariableRow({
|
|
|
4347
4540
|
onCopy
|
|
4348
4541
|
}) {
|
|
4349
4542
|
var _a, _b;
|
|
4350
|
-
const [draftName, setDraftName] =
|
|
4351
|
-
const [isEditing, setIsEditing] =
|
|
4352
|
-
|
|
4543
|
+
const [draftName, setDraftName] = React57.useState(variable.name);
|
|
4544
|
+
const [isEditing, setIsEditing] = React57.useState(false);
|
|
4545
|
+
React57.useEffect(() => {
|
|
4353
4546
|
if (!isEditing) setDraftName(variable.name);
|
|
4354
4547
|
}, [variable.name, isEditing]);
|
|
4355
4548
|
const nameError = validateVariableName(draftName, siblings, index);
|
|
@@ -4365,7 +4558,7 @@ function VariableRow({
|
|
|
4365
4558
|
onCommitRename(draftName.trim());
|
|
4366
4559
|
}
|
|
4367
4560
|
};
|
|
4368
|
-
return /* @__PURE__ */
|
|
4561
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 0.75, sx: { pb: 1, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4369
4562
|
material.TextField,
|
|
4370
4563
|
{
|
|
4371
4564
|
label: "Name",
|
|
@@ -4390,7 +4583,7 @@ function VariableRow({
|
|
|
4390
4583
|
error: Boolean(nameError),
|
|
4391
4584
|
helperText: nameError != null ? nameError : " "
|
|
4392
4585
|
}
|
|
4393
|
-
), /* @__PURE__ */
|
|
4586
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.25, sx: { mt: 0.5 } }, /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Copy {{name}}" }, /* @__PURE__ */ React57__default.default.createElement("span", null, /* @__PURE__ */ React57__default.default.createElement(
|
|
4394
4587
|
material.IconButton,
|
|
4395
4588
|
{
|
|
4396
4589
|
size: "small",
|
|
@@ -4398,8 +4591,8 @@ function VariableRow({
|
|
|
4398
4591
|
disabled: !hasName,
|
|
4399
4592
|
"aria-label": `Copy ${variable.name || "variable"} token`
|
|
4400
4593
|
},
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
))), /* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" })
|
|
4595
|
+
))), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: canInsert ? "Insert at cursor" : "Focus a text field first" }, /* @__PURE__ */ React57__default.default.createElement("span", null, /* @__PURE__ */ React57__default.default.createElement(
|
|
4403
4596
|
material.IconButton,
|
|
4404
4597
|
{
|
|
4405
4598
|
size: "small",
|
|
@@ -4407,16 +4600,16 @@ function VariableRow({
|
|
|
4407
4600
|
disabled: !hasName || !canInsert,
|
|
4408
4601
|
"aria-label": `Insert ${variable.name || "variable"} at cursor`
|
|
4409
4602
|
},
|
|
4410
|
-
/* @__PURE__ */
|
|
4411
|
-
))), /* @__PURE__ */
|
|
4603
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.InputOutlined, { fontSize: "small" })
|
|
4604
|
+
))), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Remove" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4412
4605
|
material.IconButton,
|
|
4413
4606
|
{
|
|
4414
4607
|
size: "small",
|
|
4415
4608
|
onClick: onRemove,
|
|
4416
4609
|
"aria-label": `Remove ${variable.name || "variable"}`
|
|
4417
4610
|
},
|
|
4418
|
-
/* @__PURE__ */
|
|
4419
|
-
)))), /* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DeleteOutline, { fontSize: "small" })
|
|
4612
|
+
)))), /* @__PURE__ */ React57__default.default.createElement(
|
|
4420
4613
|
material.TextField,
|
|
4421
4614
|
{
|
|
4422
4615
|
label: "Description",
|
|
@@ -4426,7 +4619,7 @@ function VariableRow({
|
|
|
4426
4619
|
onChange: (e) => onChangeDescription(e.target.value),
|
|
4427
4620
|
placeholder: "Optional"
|
|
4428
4621
|
}
|
|
4429
|
-
), /* @__PURE__ */
|
|
4622
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
4430
4623
|
material.TextField,
|
|
4431
4624
|
{
|
|
4432
4625
|
label: "Sample value",
|
|
@@ -4436,7 +4629,7 @@ function VariableRow({
|
|
|
4436
4629
|
onChange: (e) => onChangeSampleValue(e.target.value),
|
|
4437
4630
|
placeholder: "Shown in Preview mode",
|
|
4438
4631
|
InputProps: {
|
|
4439
|
-
startAdornment: /* @__PURE__ */
|
|
4632
|
+
startAdornment: /* @__PURE__ */ React57__default.default.createElement(
|
|
4440
4633
|
iconsMaterial.DataObjectOutlined,
|
|
4441
4634
|
{
|
|
4442
4635
|
fontSize: "small",
|
|
@@ -4445,7 +4638,7 @@ function VariableRow({
|
|
|
4445
4638
|
)
|
|
4446
4639
|
}
|
|
4447
4640
|
}
|
|
4448
|
-
), /* @__PURE__ */
|
|
4641
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { pt: 0.25 } }, hasName && (unused ? /* @__PURE__ */ React57__default.default.createElement(material.Chip, { size: "small", color: "warning", variant: "outlined", label: "Unused in body" }) : /* @__PURE__ */ React57__default.default.createElement(
|
|
4449
4642
|
material.Chip,
|
|
4450
4643
|
{
|
|
4451
4644
|
size: "small",
|
|
@@ -4462,6 +4655,7 @@ function InspectorDrawer({
|
|
|
4462
4655
|
exitDuration = 225,
|
|
4463
4656
|
deleteTemplate,
|
|
4464
4657
|
copyTemplate,
|
|
4658
|
+
renameTemplate,
|
|
4465
4659
|
savingEnabled = true
|
|
4466
4660
|
} = {}) {
|
|
4467
4661
|
const selectedSidebarTab = useSelectedSidebarTab();
|
|
@@ -4469,22 +4663,23 @@ function InspectorDrawer({
|
|
|
4469
4663
|
const renderCurrentSidebarPanel = () => {
|
|
4470
4664
|
switch (selectedSidebarTab) {
|
|
4471
4665
|
case "block-configuration":
|
|
4472
|
-
return /* @__PURE__ */
|
|
4666
|
+
return /* @__PURE__ */ React57__default.default.createElement(ConfigurationPanel, null);
|
|
4473
4667
|
case "styles":
|
|
4474
|
-
return /* @__PURE__ */
|
|
4668
|
+
return /* @__PURE__ */ React57__default.default.createElement(StylesPanel, null);
|
|
4475
4669
|
case "variables":
|
|
4476
|
-
return /* @__PURE__ */
|
|
4670
|
+
return /* @__PURE__ */ React57__default.default.createElement(VariablesPanel, null);
|
|
4477
4671
|
case "template-settings":
|
|
4478
|
-
return /* @__PURE__ */
|
|
4672
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
4479
4673
|
TemplatePanel,
|
|
4480
4674
|
{
|
|
4481
4675
|
deleteTemplate,
|
|
4482
|
-
copyTemplate
|
|
4676
|
+
copyTemplate,
|
|
4677
|
+
renameTemplate
|
|
4483
4678
|
}
|
|
4484
4679
|
);
|
|
4485
4680
|
}
|
|
4486
4681
|
};
|
|
4487
|
-
return /* @__PURE__ */
|
|
4682
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
4488
4683
|
material.Drawer,
|
|
4489
4684
|
{
|
|
4490
4685
|
variant: "persistent",
|
|
@@ -4506,7 +4701,7 @@ function InspectorDrawer({
|
|
|
4506
4701
|
width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
|
|
4507
4702
|
}
|
|
4508
4703
|
},
|
|
4509
|
-
/* @__PURE__ */
|
|
4704
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React57__default.default.createElement(material.Box, { px: 1 }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4510
4705
|
material.Tabs,
|
|
4511
4706
|
{
|
|
4512
4707
|
value: selectedSidebarTab,
|
|
@@ -4514,25 +4709,25 @@ function InspectorDrawer({
|
|
|
4514
4709
|
variant: "fullWidth",
|
|
4515
4710
|
sx: { "& .MuiTab-root": { minWidth: 0, px: 1, fontSize: 13 } }
|
|
4516
4711
|
},
|
|
4517
|
-
/* @__PURE__ */
|
|
4518
|
-
/* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4712
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "styles", label: "Styles" }),
|
|
4713
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "block-configuration", label: "Inspect" }),
|
|
4714
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "variables", label: "Variables" }),
|
|
4715
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "template-settings", label: "Settings" })
|
|
4521
4716
|
))),
|
|
4522
|
-
/* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
|
|
4523
4718
|
);
|
|
4524
4719
|
}
|
|
4525
|
-
var SnackbarContext =
|
|
4720
|
+
var SnackbarContext = React57.createContext(null);
|
|
4526
4721
|
function useSnackbar() {
|
|
4527
|
-
const context =
|
|
4722
|
+
const context = React57.useContext(SnackbarContext);
|
|
4528
4723
|
if (!context) {
|
|
4529
4724
|
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
4530
4725
|
}
|
|
4531
4726
|
return context;
|
|
4532
4727
|
}
|
|
4533
4728
|
function SnackbarProvider({ children }) {
|
|
4534
|
-
const [message, setMessage] =
|
|
4535
|
-
const [duration, setDuration] =
|
|
4729
|
+
const [message, setMessage] = React57.useState(null);
|
|
4730
|
+
const [duration, setDuration] = React57.useState(3e3);
|
|
4536
4731
|
const showMessage = (text, customDuration = 3e3) => {
|
|
4537
4732
|
setMessage(text);
|
|
4538
4733
|
setDuration(customDuration);
|
|
@@ -4540,7 +4735,7 @@ function SnackbarProvider({ children }) {
|
|
|
4540
4735
|
const handleClose = () => {
|
|
4541
4736
|
setMessage(null);
|
|
4542
4737
|
};
|
|
4543
|
-
return /* @__PURE__ */
|
|
4738
|
+
return /* @__PURE__ */ React57__default.default.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React57__default.default.createElement(
|
|
4544
4739
|
material.Snackbar,
|
|
4545
4740
|
{
|
|
4546
4741
|
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
@@ -4587,8 +4782,8 @@ function TemplateRow({
|
|
|
4587
4782
|
onDuplicateAsTemplate
|
|
4588
4783
|
}) {
|
|
4589
4784
|
const { setCurrentTemplate } = useEmailEditor();
|
|
4590
|
-
const [hover, setHover] =
|
|
4591
|
-
const [menuAnchor, setMenuAnchor] =
|
|
4785
|
+
const [hover, setHover] = React57.useState(false);
|
|
4786
|
+
const [menuAnchor, setMenuAnchor] = React57.useState(null);
|
|
4592
4787
|
const closeMenu = () => setMenuAnchor(null);
|
|
4593
4788
|
const openMenu = (e) => {
|
|
4594
4789
|
e.stopPropagation();
|
|
@@ -4599,11 +4794,12 @@ function TemplateRow({
|
|
|
4599
4794
|
fn == null ? void 0 : fn();
|
|
4600
4795
|
};
|
|
4601
4796
|
const handleClick = () => __async(null, null, function* () {
|
|
4797
|
+
var _a;
|
|
4602
4798
|
try {
|
|
4603
4799
|
const content = yield templateLoader();
|
|
4604
4800
|
if (content) {
|
|
4605
4801
|
resetDocument(content);
|
|
4606
|
-
setCurrentTemplate(template.id, template.slug, template.kind);
|
|
4802
|
+
setCurrentTemplate(template.id, template.slug, template.kind, (_a = template.tags) != null ? _a : []);
|
|
4607
4803
|
}
|
|
4608
4804
|
} catch (error) {
|
|
4609
4805
|
console.error("Error loading template:", error);
|
|
@@ -4616,7 +4812,7 @@ function TemplateRow({
|
|
|
4616
4812
|
const hasActions = Boolean(
|
|
4617
4813
|
onDuplicate || onRename || onDelete || onPromote || onDemote || onDuplicateAsTemplate
|
|
4618
4814
|
);
|
|
4619
|
-
return /* @__PURE__ */
|
|
4815
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
4620
4816
|
material.Box,
|
|
4621
4817
|
{
|
|
4622
4818
|
role: "button",
|
|
@@ -4642,7 +4838,7 @@ function TemplateRow({
|
|
|
4642
4838
|
"&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
|
|
4643
4839
|
}
|
|
4644
4840
|
},
|
|
4645
|
-
/* @__PURE__ */
|
|
4841
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", alignItems: "flex-start", spacing: 1 }, /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { flexGrow: 1, minWidth: 0, pr: hasActions ? 3 : 0 } }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", alignItems: "baseline", spacing: 1, sx: { minWidth: 0 } }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4646
4842
|
material.Typography,
|
|
4647
4843
|
{
|
|
4648
4844
|
variant: "body2",
|
|
@@ -4656,14 +4852,14 @@ function TemplateRow({
|
|
|
4656
4852
|
title: template.slug
|
|
4657
4853
|
},
|
|
4658
4854
|
template.slug
|
|
4659
|
-
), updated && !hasActions && /* @__PURE__ */
|
|
4855
|
+
), updated && !hasActions && /* @__PURE__ */ React57__default.default.createElement(
|
|
4660
4856
|
material.Typography,
|
|
4661
4857
|
{
|
|
4662
4858
|
variant: "caption",
|
|
4663
4859
|
sx: { color: "text.secondary", flexShrink: 0, fontSize: "0.7rem" }
|
|
4664
4860
|
},
|
|
4665
4861
|
updated
|
|
4666
|
-
)), template.description && /* @__PURE__ */
|
|
4862
|
+
)), template.description && /* @__PURE__ */ React57__default.default.createElement(
|
|
4667
4863
|
material.Typography,
|
|
4668
4864
|
{
|
|
4669
4865
|
variant: "caption",
|
|
@@ -4677,7 +4873,7 @@ function TemplateRow({
|
|
|
4677
4873
|
}
|
|
4678
4874
|
},
|
|
4679
4875
|
template.description
|
|
4680
|
-
), template.tags && template.tags.length > 0 && /* @__PURE__ */
|
|
4876
|
+
), template.tags && template.tags.length > 0 && /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { mt: 0.5, flexWrap: "wrap", gap: 0.5 } }, template.tags.map((tag) => /* @__PURE__ */ React57__default.default.createElement(
|
|
4681
4877
|
material.Chip,
|
|
4682
4878
|
{
|
|
4683
4879
|
key: tag,
|
|
@@ -4686,7 +4882,7 @@ function TemplateRow({
|
|
|
4686
4882
|
sx: { height: 18, fontSize: "0.65rem", "& .MuiChip-label": { px: 0.75 } }
|
|
4687
4883
|
}
|
|
4688
4884
|
))))),
|
|
4689
|
-
hasActions && /* @__PURE__ */
|
|
4885
|
+
hasActions && /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "More" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
4690
4886
|
material.IconButton,
|
|
4691
4887
|
{
|
|
4692
4888
|
size: "small",
|
|
@@ -4702,8 +4898,8 @@ function TemplateRow({
|
|
|
4702
4898
|
transition: "opacity 120ms"
|
|
4703
4899
|
}
|
|
4704
4900
|
},
|
|
4705
|
-
/* @__PURE__ */
|
|
4706
|
-
)), /* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.MoreVertOutlined, { fontSize: "small" })
|
|
4902
|
+
)), /* @__PURE__ */ React57__default.default.createElement(
|
|
4707
4903
|
material.Menu,
|
|
4708
4904
|
{
|
|
4709
4905
|
anchorEl: menuAnchor,
|
|
@@ -4714,14 +4910,14 @@ function TemplateRow({
|
|
|
4714
4910
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
4715
4911
|
slotProps: { paper: { sx: { minWidth: 200 } } }
|
|
4716
4912
|
},
|
|
4717
|
-
onRename && /* @__PURE__ */
|
|
4718
|
-
onDuplicate && /* @__PURE__ */
|
|
4719
|
-
onDuplicateAsTemplate && /* @__PURE__ */
|
|
4720
|
-
onPromote && /* @__PURE__ */
|
|
4721
|
-
onDemote && /* @__PURE__ */
|
|
4913
|
+
onRename && /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { onClick: runAction(onRename) }, /* @__PURE__ */ React57__default.default.createElement(material.ListItemIcon, null, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DriveFileRenameOutlineOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, null, "Edit name & tags\u2026")),
|
|
4914
|
+
onDuplicate && /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { onClick: runAction(onDuplicate) }, /* @__PURE__ */ React57__default.default.createElement(material.ListItemIcon, null, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, null, "Duplicate")),
|
|
4915
|
+
onDuplicateAsTemplate && /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { onClick: runAction(onDuplicateAsTemplate) }, /* @__PURE__ */ React57__default.default.createElement(material.ListItemIcon, null, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.LibraryAddOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, null, "Duplicate as template")),
|
|
4916
|
+
onPromote && /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { onClick: runAction(onPromote) }, /* @__PURE__ */ React57__default.default.createElement(material.ListItemIcon, null, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FileUploadOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, null, "Promote to sample")),
|
|
4917
|
+
onDemote && /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { onClick: runAction(onDemote) }, /* @__PURE__ */ React57__default.default.createElement(material.ListItemIcon, null, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FileDownloadOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, null, "Demote to template")),
|
|
4722
4918
|
onDelete && [
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Divider, { key: "divider" }),
|
|
4920
|
+
/* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { key: "delete", onClick: runAction(onDelete), sx: { color: "error.main" } }, /* @__PURE__ */ React57__default.default.createElement(material.ListItemIcon, { sx: { color: "error.main" } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DeleteOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, null, "Delete"))
|
|
4725
4921
|
]
|
|
4726
4922
|
))
|
|
4727
4923
|
);
|
|
@@ -4836,31 +5032,31 @@ var PREVIEW_MAX = 36;
|
|
|
4836
5032
|
function iconForType(type) {
|
|
4837
5033
|
switch (type) {
|
|
4838
5034
|
case "EmailLayout":
|
|
4839
|
-
return /* @__PURE__ */
|
|
5035
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DashboardOutlined, { fontSize: "small" });
|
|
4840
5036
|
case "Heading":
|
|
4841
|
-
return /* @__PURE__ */
|
|
5037
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HMobiledataOutlined, { fontSize: "small" });
|
|
4842
5038
|
case "Text":
|
|
4843
|
-
return /* @__PURE__ */
|
|
5039
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.NotesOutlined, { fontSize: "small" });
|
|
4844
5040
|
case "Button":
|
|
4845
|
-
return /* @__PURE__ */
|
|
5041
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SmartButtonOutlined, { fontSize: "small" });
|
|
4846
5042
|
case "Image":
|
|
4847
|
-
return /* @__PURE__ */
|
|
5043
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ImageOutlined, { fontSize: "small" });
|
|
4848
5044
|
case "Avatar":
|
|
4849
|
-
return /* @__PURE__ */
|
|
5045
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AccountCircleOutlined, { fontSize: "small" });
|
|
4850
5046
|
case "Signature":
|
|
4851
|
-
return /* @__PURE__ */
|
|
5047
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ContactMailOutlined, { fontSize: "small" });
|
|
4852
5048
|
case "Divider":
|
|
4853
|
-
return /* @__PURE__ */
|
|
5049
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HorizontalRuleOutlined, { fontSize: "small" });
|
|
4854
5050
|
case "Spacer":
|
|
4855
|
-
return /* @__PURE__ */
|
|
5051
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.Crop32Outlined, { fontSize: "small" });
|
|
4856
5052
|
case "Html":
|
|
4857
|
-
return /* @__PURE__ */
|
|
5053
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HtmlOutlined, { fontSize: "small" });
|
|
4858
5054
|
case "Container":
|
|
4859
|
-
return /* @__PURE__ */
|
|
5055
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.LibraryAddOutlined, { fontSize: "small" });
|
|
4860
5056
|
case "ColumnsContainer":
|
|
4861
|
-
return /* @__PURE__ */
|
|
5057
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ViewColumnOutlined, { fontSize: "small" });
|
|
4862
5058
|
default:
|
|
4863
|
-
return /* @__PURE__ */
|
|
5059
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.BusinessOutlined, { fontSize: "small" });
|
|
4864
5060
|
}
|
|
4865
5061
|
}
|
|
4866
5062
|
function previewText(text) {
|
|
@@ -4938,7 +5134,7 @@ function buildNode(id, doc, ctx) {
|
|
|
4938
5134
|
id: `${id}::col${colIdx}`,
|
|
4939
5135
|
label: `Column ${colIdx + 1}`,
|
|
4940
5136
|
preview: colChildren.length === 1 ? "1 child" : `${colChildren.length} children`,
|
|
4941
|
-
icon: /* @__PURE__ */
|
|
5137
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ViewColumnSharp, { fontSize: "small", sx: { opacity: 0.6 } }),
|
|
4942
5138
|
children: colChildren,
|
|
4943
5139
|
containerChildrenRef: parentForCol
|
|
4944
5140
|
});
|
|
@@ -4985,7 +5181,7 @@ var DRAG_MIME = "application/x-email-editor-block";
|
|
|
4985
5181
|
function OutlinePanel() {
|
|
4986
5182
|
const document2 = useDocument();
|
|
4987
5183
|
const selectedBlockId = useSelectedBlockId();
|
|
4988
|
-
const [dragging, setDragging] =
|
|
5184
|
+
const [dragging, setDragging] = React57.useState(null);
|
|
4989
5185
|
const tree = buildNode(ROOT_BLOCK_ID2, document2);
|
|
4990
5186
|
const performMove = (payload, targetParent, targetIndex) => {
|
|
4991
5187
|
const patch = buildMovePatch(
|
|
@@ -5000,7 +5196,7 @@ function OutlinePanel() {
|
|
|
5000
5196
|
setSelectedBlockId(payload.sourceId);
|
|
5001
5197
|
}
|
|
5002
5198
|
};
|
|
5003
|
-
return /* @__PURE__ */
|
|
5199
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, null, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5, px: 0.5 } }, "Outline"), /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { display: "block", color: "text.secondary", px: 0.5, mb: 1 } }, "Click a row to select. Drag a row to reorder or move it into a container."), tree ? /* @__PURE__ */ React57__default.default.createElement(
|
|
5004
5200
|
OutlineRow,
|
|
5005
5201
|
{
|
|
5006
5202
|
node: tree,
|
|
@@ -5011,7 +5207,7 @@ function OutlinePanel() {
|
|
|
5011
5207
|
setDragging,
|
|
5012
5208
|
performMove
|
|
5013
5209
|
}
|
|
5014
|
-
) : /* @__PURE__ */
|
|
5210
|
+
) : /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", px: 0.5 } }, "Nothing to outline."));
|
|
5015
5211
|
}
|
|
5016
5212
|
function OutlineRow({
|
|
5017
5213
|
node,
|
|
@@ -5022,8 +5218,8 @@ function OutlineRow({
|
|
|
5022
5218
|
setDragging,
|
|
5023
5219
|
performMove
|
|
5024
5220
|
}) {
|
|
5025
|
-
const [expanded, setExpanded] =
|
|
5026
|
-
const [dropPos, setDropPos] =
|
|
5221
|
+
const [expanded, setExpanded] = React57.useState(true);
|
|
5222
|
+
const [dropPos, setDropPos] = React57.useState(null);
|
|
5027
5223
|
const hasChildren = Boolean(node.children && node.children.length > 0);
|
|
5028
5224
|
const isSelectable = !node.id.includes("::");
|
|
5029
5225
|
const isSelected = isSelectable && selectedBlockId === node.id;
|
|
@@ -5097,7 +5293,7 @@ function OutlineRow({
|
|
|
5097
5293
|
const patch = buildMovePatch(document2, node.id, node.parent, node.parent, nextIndex + (delta > 0 ? 1 : 0));
|
|
5098
5294
|
if (patch) setDocument(patch);
|
|
5099
5295
|
};
|
|
5100
|
-
return /* @__PURE__ */
|
|
5296
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { position: "relative" } }, dropPos === "before" && /* @__PURE__ */ React57__default.default.createElement(DropLine, { depth }), /* @__PURE__ */ React57__default.default.createElement(
|
|
5101
5297
|
material.Stack,
|
|
5102
5298
|
{
|
|
5103
5299
|
direction: "row",
|
|
@@ -5130,7 +5326,7 @@ function OutlineRow({
|
|
|
5130
5326
|
userSelect: "none"
|
|
5131
5327
|
}
|
|
5132
5328
|
},
|
|
5133
|
-
hasChildren ? /* @__PURE__ */
|
|
5329
|
+
hasChildren ? /* @__PURE__ */ React57__default.default.createElement(
|
|
5134
5330
|
material.Box,
|
|
5135
5331
|
{
|
|
5136
5332
|
role: "button",
|
|
@@ -5141,9 +5337,9 @@ function OutlineRow({
|
|
|
5141
5337
|
},
|
|
5142
5338
|
sx: { display: "flex", alignItems: "center", cursor: "pointer" }
|
|
5143
5339
|
},
|
|
5144
|
-
expanded ? /* @__PURE__ */
|
|
5145
|
-
) : /* @__PURE__ */
|
|
5146
|
-
/* @__PURE__ */
|
|
5340
|
+
expanded ? /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ExpandMore, { fontSize: "small" }) : /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ChevronRight, { fontSize: "small" })
|
|
5341
|
+
) : /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { width: 20 } }),
|
|
5342
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
5147
5343
|
material.Box,
|
|
5148
5344
|
{
|
|
5149
5345
|
sx: {
|
|
@@ -5155,7 +5351,7 @@ function OutlineRow({
|
|
|
5155
5351
|
},
|
|
5156
5352
|
node.icon
|
|
5157
5353
|
),
|
|
5158
|
-
/* @__PURE__ */
|
|
5354
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
5159
5355
|
material.Typography,
|
|
5160
5356
|
{
|
|
5161
5357
|
variant: "body2",
|
|
@@ -5167,7 +5363,7 @@ function OutlineRow({
|
|
|
5167
5363
|
},
|
|
5168
5364
|
node.label
|
|
5169
5365
|
),
|
|
5170
|
-
node.preview && /* @__PURE__ */
|
|
5366
|
+
node.preview && /* @__PURE__ */ React57__default.default.createElement(
|
|
5171
5367
|
material.Typography,
|
|
5172
5368
|
{
|
|
5173
5369
|
variant: "body2",
|
|
@@ -5183,7 +5379,7 @@ function OutlineRow({
|
|
|
5183
5379
|
"\u2014 ",
|
|
5184
5380
|
node.preview
|
|
5185
5381
|
),
|
|
5186
|
-
canMove && /* @__PURE__ */
|
|
5382
|
+
canMove && /* @__PURE__ */ React57__default.default.createElement(
|
|
5187
5383
|
material.Box,
|
|
5188
5384
|
{
|
|
5189
5385
|
className: "outline-move-btns",
|
|
@@ -5194,7 +5390,7 @@ function OutlineRow({
|
|
|
5194
5390
|
transition: "opacity 120ms"
|
|
5195
5391
|
}
|
|
5196
5392
|
},
|
|
5197
|
-
/* @__PURE__ */
|
|
5393
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Move up" }, /* @__PURE__ */ React57__default.default.createElement("span", null, /* @__PURE__ */ React57__default.default.createElement(
|
|
5198
5394
|
material.IconButton,
|
|
5199
5395
|
{
|
|
5200
5396
|
size: "small",
|
|
@@ -5206,9 +5402,9 @@ function OutlineRow({
|
|
|
5206
5402
|
"aria-label": `Move ${node.label} up`,
|
|
5207
5403
|
sx: { p: 0.25 }
|
|
5208
5404
|
},
|
|
5209
|
-
/* @__PURE__ */
|
|
5405
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.KeyboardArrowUp, { fontSize: "small" })
|
|
5210
5406
|
))),
|
|
5211
|
-
/* @__PURE__ */
|
|
5407
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Move down" }, /* @__PURE__ */ React57__default.default.createElement("span", null, /* @__PURE__ */ React57__default.default.createElement(
|
|
5212
5408
|
material.IconButton,
|
|
5213
5409
|
{
|
|
5214
5410
|
size: "small",
|
|
@@ -5220,10 +5416,10 @@ function OutlineRow({
|
|
|
5220
5416
|
"aria-label": `Move ${node.label} down`,
|
|
5221
5417
|
sx: { p: 0.25 }
|
|
5222
5418
|
},
|
|
5223
|
-
/* @__PURE__ */
|
|
5419
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.KeyboardArrowDown, { fontSize: "small" })
|
|
5224
5420
|
)))
|
|
5225
5421
|
)
|
|
5226
|
-
), dropPos === "after" && /* @__PURE__ */
|
|
5422
|
+
), dropPos === "after" && /* @__PURE__ */ React57__default.default.createElement(DropLine, { depth })), hasChildren && expanded && /* @__PURE__ */ React57__default.default.createElement(material.Box, null, node.children.map((child) => /* @__PURE__ */ React57__default.default.createElement(
|
|
5227
5423
|
OutlineRow,
|
|
5228
5424
|
{
|
|
5229
5425
|
key: child.id,
|
|
@@ -5238,7 +5434,7 @@ function OutlineRow({
|
|
|
5238
5434
|
))));
|
|
5239
5435
|
}
|
|
5240
5436
|
function DropLine({ depth }) {
|
|
5241
|
-
return /* @__PURE__ */
|
|
5437
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
5242
5438
|
material.Box,
|
|
5243
5439
|
{
|
|
5244
5440
|
sx: {
|
|
@@ -5246,7 +5442,7 @@ function DropLine({ depth }) {
|
|
|
5246
5442
|
height: 0
|
|
5247
5443
|
}
|
|
5248
5444
|
},
|
|
5249
|
-
/* @__PURE__ */
|
|
5445
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
5250
5446
|
material.Box,
|
|
5251
5447
|
{
|
|
5252
5448
|
sx: {
|
|
@@ -5272,11 +5468,11 @@ function NewTemplatePickerDialog({
|
|
|
5272
5468
|
onClose,
|
|
5273
5469
|
onCreate
|
|
5274
5470
|
}) {
|
|
5275
|
-
const [name, setName] =
|
|
5276
|
-
const [selectedStarter, setSelectedStarter] =
|
|
5277
|
-
const [error, setError] =
|
|
5278
|
-
const [busy, setBusy] =
|
|
5279
|
-
|
|
5471
|
+
const [name, setName] = React57.useState("");
|
|
5472
|
+
const [selectedStarter, setSelectedStarter] = React57.useState(null);
|
|
5473
|
+
const [error, setError] = React57.useState(null);
|
|
5474
|
+
const [busy, setBusy] = React57.useState(false);
|
|
5475
|
+
React57.useEffect(() => {
|
|
5280
5476
|
if (open) {
|
|
5281
5477
|
setName(defaultName != null ? defaultName : kind === "sample" ? "New sample" : "New template");
|
|
5282
5478
|
setSelectedStarter(null);
|
|
@@ -5307,7 +5503,7 @@ function NewTemplatePickerDialog({
|
|
|
5307
5503
|
}
|
|
5308
5504
|
});
|
|
5309
5505
|
const pickable = samples.filter((s) => s.id !== "empty-email");
|
|
5310
|
-
return /* @__PURE__ */
|
|
5506
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Dialog, { open, onClose: busy ? void 0 : onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React57__default.default.createElement(material.DialogTitle, null, kind === "sample" ? "New sample" : "New template"), /* @__PURE__ */ React57__default.default.createElement(material.DialogContent, { dividers: true }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "subtitle2", sx: { mb: 1 } }, "Start from"), /* @__PURE__ */ React57__default.default.createElement(
|
|
5311
5507
|
material.List,
|
|
5312
5508
|
{
|
|
5313
5509
|
dense: true,
|
|
@@ -5321,24 +5517,24 @@ function NewTemplatePickerDialog({
|
|
|
5321
5517
|
overflowY: "auto"
|
|
5322
5518
|
}
|
|
5323
5519
|
},
|
|
5324
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
5325
5521
|
material.ListItemButton,
|
|
5326
5522
|
{
|
|
5327
5523
|
selected: selectedStarter === null,
|
|
5328
5524
|
onClick: () => setSelectedStarter(null)
|
|
5329
5525
|
},
|
|
5330
|
-
/* @__PURE__ */
|
|
5526
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1.5, flex: 1 } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.InsertDriveFileOutlined, { fontSize: "small", sx: { color: "text.secondary" } }), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, { primary: "Blank", secondary: "Start from an empty email" }))
|
|
5331
5527
|
),
|
|
5332
|
-
pickable.map((s) => /* @__PURE__ */
|
|
5528
|
+
pickable.map((s) => /* @__PURE__ */ React57__default.default.createElement(
|
|
5333
5529
|
material.ListItemButton,
|
|
5334
5530
|
{
|
|
5335
5531
|
key: s.id,
|
|
5336
5532
|
selected: selectedStarter === s.id,
|
|
5337
5533
|
onClick: () => setSelectedStarter(s.id)
|
|
5338
5534
|
},
|
|
5339
|
-
/* @__PURE__ */
|
|
5535
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1.5, flex: 1 } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DescriptionOutlined, { fontSize: "small", sx: { color: "text.secondary" } }), /* @__PURE__ */ React57__default.default.createElement(material.ListItemText, { primary: s.slug, secondary: s.description }))
|
|
5340
5536
|
))
|
|
5341
|
-
), /* @__PURE__ */
|
|
5537
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
5342
5538
|
material.TextField,
|
|
5343
5539
|
{
|
|
5344
5540
|
autoFocus: true,
|
|
@@ -5357,7 +5553,7 @@ function NewTemplatePickerDialog({
|
|
|
5357
5553
|
helperText: error != null ? error : " ",
|
|
5358
5554
|
disabled: busy
|
|
5359
5555
|
}
|
|
5360
|
-
)), /* @__PURE__ */
|
|
5556
|
+
)), /* @__PURE__ */ React57__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React57__default.default.createElement(material.Button, { onClick: onClose, disabled: busy }, "Cancel"), /* @__PURE__ */ React57__default.default.createElement(material.Button, { variant: "contained", onClick: handleCreate, disabled: busy }, busy ? "Creating\u2026" : `Create ${kind}`)));
|
|
5361
5557
|
}
|
|
5362
5558
|
function RenameDialog({
|
|
5363
5559
|
open,
|
|
@@ -5367,12 +5563,12 @@ function RenameDialog({
|
|
|
5367
5563
|
onClose,
|
|
5368
5564
|
onSubmit
|
|
5369
5565
|
}) {
|
|
5370
|
-
const [slug, setSlug] =
|
|
5371
|
-
const [tags, setTags] =
|
|
5372
|
-
const [tagInput, setTagInput] =
|
|
5373
|
-
const [error, setError] =
|
|
5374
|
-
const [submitting, setSubmitting] =
|
|
5375
|
-
|
|
5566
|
+
const [slug, setSlug] = React57.useState(currentSlug);
|
|
5567
|
+
const [tags, setTags] = React57.useState(currentTags);
|
|
5568
|
+
const [tagInput, setTagInput] = React57.useState("");
|
|
5569
|
+
const [error, setError] = React57.useState(null);
|
|
5570
|
+
const [submitting, setSubmitting] = React57.useState(false);
|
|
5571
|
+
React57.useEffect(() => {
|
|
5376
5572
|
if (open) {
|
|
5377
5573
|
setSlug(currentSlug);
|
|
5378
5574
|
setTags(currentTags);
|
|
@@ -5384,15 +5580,15 @@ function RenameDialog({
|
|
|
5384
5580
|
const addTag = () => {
|
|
5385
5581
|
const trimmed = tagInput.trim();
|
|
5386
5582
|
if (!trimmed) return;
|
|
5387
|
-
if (tags.some((
|
|
5583
|
+
if (tags.some((t2) => t2.toLowerCase() === trimmed.toLowerCase())) {
|
|
5388
5584
|
setTagInput("");
|
|
5389
5585
|
return;
|
|
5390
5586
|
}
|
|
5391
5587
|
setTags([...tags, trimmed]);
|
|
5392
5588
|
setTagInput("");
|
|
5393
5589
|
};
|
|
5394
|
-
const removeTag = (tag) => setTags(tags.filter((
|
|
5395
|
-
const tagsUnchanged = tags.length === currentTags.length && tags.every((
|
|
5590
|
+
const removeTag = (tag) => setTags(tags.filter((t2) => t2 !== tag));
|
|
5591
|
+
const tagsUnchanged = tags.length === currentTags.length && tags.every((t2, i) => t2 === currentTags[i]);
|
|
5396
5592
|
const handleSubmit = () => __async(null, null, function* () {
|
|
5397
5593
|
const trimmedSlug = slug.trim();
|
|
5398
5594
|
if (!trimmedSlug) {
|
|
@@ -5419,7 +5615,7 @@ function RenameDialog({
|
|
|
5419
5615
|
setSubmitting(false);
|
|
5420
5616
|
}
|
|
5421
5617
|
});
|
|
5422
|
-
return /* @__PURE__ */
|
|
5618
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Dialog, { open, onClose: submitting ? void 0 : onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React57__default.default.createElement(material.DialogTitle, null, "Edit details"), /* @__PURE__ */ React57__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
5423
5619
|
material.TextField,
|
|
5424
5620
|
{
|
|
5425
5621
|
autoFocus: true,
|
|
@@ -5439,7 +5635,7 @@ function RenameDialog({
|
|
|
5439
5635
|
if (e.key === "Enter" && !submitting) handleSubmit();
|
|
5440
5636
|
}
|
|
5441
5637
|
}
|
|
5442
|
-
), /* @__PURE__ */
|
|
5638
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mt: 1, mb: 0.5 } }, "Tags"), tags.length > 0 ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.5, sx: { flexWrap: "wrap", gap: 0.5, mb: 1 } }, tags.map((tag) => /* @__PURE__ */ React57__default.default.createElement(
|
|
5443
5639
|
material.Chip,
|
|
5444
5640
|
{
|
|
5445
5641
|
key: tag,
|
|
@@ -5447,7 +5643,7 @@ function RenameDialog({
|
|
|
5447
5643
|
size: "small",
|
|
5448
5644
|
onDelete: submitting ? void 0 : () => removeTag(tag)
|
|
5449
5645
|
}
|
|
5450
|
-
))) : /* @__PURE__ */
|
|
5646
|
+
))) : /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "caption", sx: { color: "text.disabled", display: "block", mb: 1 } }, "No tags yet. Suggested: ", /* @__PURE__ */ React57__default.default.createElement("i", null, "transactional"), ", ", /* @__PURE__ */ React57__default.default.createElement("i", null, "marketing"), "."), /* @__PURE__ */ React57__default.default.createElement(
|
|
5451
5647
|
material.TextField,
|
|
5452
5648
|
{
|
|
5453
5649
|
size: "small",
|
|
@@ -5466,20 +5662,20 @@ function RenameDialog({
|
|
|
5466
5662
|
}
|
|
5467
5663
|
},
|
|
5468
5664
|
InputProps: {
|
|
5469
|
-
endAdornment: /* @__PURE__ */
|
|
5665
|
+
endAdornment: /* @__PURE__ */ React57__default.default.createElement(material.InputAdornment, { position: "end" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
5470
5666
|
material.Button,
|
|
5471
5667
|
{
|
|
5472
5668
|
size: "small",
|
|
5473
5669
|
onClick: addTag,
|
|
5474
5670
|
disabled: !tagInput.trim() || submitting,
|
|
5475
|
-
startIcon: /* @__PURE__ */
|
|
5671
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" }),
|
|
5476
5672
|
sx: { textTransform: "none" }
|
|
5477
5673
|
},
|
|
5478
5674
|
"Add"
|
|
5479
5675
|
))
|
|
5480
5676
|
}
|
|
5481
5677
|
}
|
|
5482
|
-
), /* @__PURE__ */
|
|
5678
|
+
), /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { minHeight: 8 } })), /* @__PURE__ */ React57__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React57__default.default.createElement(material.Button, { onClick: onClose, disabled: submitting }, "Cancel"), /* @__PURE__ */ React57__default.default.createElement(
|
|
5483
5679
|
material.Button,
|
|
5484
5680
|
{
|
|
5485
5681
|
onClick: handleSubmit,
|
|
@@ -5497,10 +5693,10 @@ function SaveTemplateDialog({
|
|
|
5497
5693
|
defaultName = "",
|
|
5498
5694
|
error: externalError = null
|
|
5499
5695
|
}) {
|
|
5500
|
-
const [templateName, setTemplateName] =
|
|
5501
|
-
const [internalError, setInternalError] =
|
|
5502
|
-
const [isSubmitting, setIsSubmitting] =
|
|
5503
|
-
|
|
5696
|
+
const [templateName, setTemplateName] = React57.useState(defaultName);
|
|
5697
|
+
const [internalError, setInternalError] = React57.useState("");
|
|
5698
|
+
const [isSubmitting, setIsSubmitting] = React57.useState(false);
|
|
5699
|
+
React57.useEffect(() => {
|
|
5504
5700
|
if (open) {
|
|
5505
5701
|
setTemplateName(defaultName);
|
|
5506
5702
|
setInternalError("");
|
|
@@ -5548,7 +5744,7 @@ function SaveTemplateDialog({
|
|
|
5548
5744
|
setInternalError("");
|
|
5549
5745
|
onClose();
|
|
5550
5746
|
};
|
|
5551
|
-
return /* @__PURE__ */
|
|
5747
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
5552
5748
|
material.Dialog,
|
|
5553
5749
|
{
|
|
5554
5750
|
open,
|
|
@@ -5556,8 +5752,8 @@ function SaveTemplateDialog({
|
|
|
5556
5752
|
maxWidth: "sm",
|
|
5557
5753
|
fullWidth: true
|
|
5558
5754
|
},
|
|
5559
|
-
/* @__PURE__ */
|
|
5560
|
-
/* @__PURE__ */
|
|
5755
|
+
/* @__PURE__ */ React57__default.default.createElement(material.DialogTitle, null, "Save Email Template"),
|
|
5756
|
+
/* @__PURE__ */ React57__default.default.createElement(material.DialogContent, null, /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { pt: 1 } }, /* @__PURE__ */ React57__default.default.createElement(
|
|
5561
5757
|
material.TextField,
|
|
5562
5758
|
{
|
|
5563
5759
|
autoFocus: true,
|
|
@@ -5579,7 +5775,7 @@ function SaveTemplateDialog({
|
|
|
5579
5775
|
disabled: isSubmitting
|
|
5580
5776
|
}
|
|
5581
5777
|
))),
|
|
5582
|
-
/* @__PURE__ */
|
|
5778
|
+
/* @__PURE__ */ React57__default.default.createElement(material.DialogActions, null, /* @__PURE__ */ React57__default.default.createElement(material.Button, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React57__default.default.createElement(
|
|
5583
5779
|
material.Button,
|
|
5584
5780
|
{
|
|
5585
5781
|
onClick: handleSave,
|
|
@@ -5616,9 +5812,9 @@ var EMPTY_TEMPLATE = {
|
|
|
5616
5812
|
description: "A blank email template to start from scratch"
|
|
5617
5813
|
};
|
|
5618
5814
|
var SORT_OPTIONS = [
|
|
5619
|
-
{ value: "updatedAt",
|
|
5620
|
-
{ value: "createdAt",
|
|
5621
|
-
{ value: "slug",
|
|
5815
|
+
{ value: "updatedAt", labelKey: "sort.last-updated", fallback: "Last updated" },
|
|
5816
|
+
{ value: "createdAt", labelKey: "sort.recently-created", fallback: "Recently created" },
|
|
5817
|
+
{ value: "slug", labelKey: "sort.name", fallback: "Name (A\u2013Z)" }
|
|
5622
5818
|
];
|
|
5623
5819
|
function compareTemplates(a, b, key) {
|
|
5624
5820
|
if (key === "slug") {
|
|
@@ -5649,19 +5845,19 @@ function SamplesDrawer({
|
|
|
5649
5845
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
5650
5846
|
const { setCurrentTemplate, loadTemplate: ctxLoadTemplate } = useEmailEditor();
|
|
5651
5847
|
const { showMessage } = useSnackbar();
|
|
5652
|
-
const [samples, setSamples] =
|
|
5653
|
-
const [templates, setTemplates] =
|
|
5654
|
-
const [loadingSamples, setLoadingSamples] =
|
|
5655
|
-
const [loadingTemplates, setLoadingTemplates] =
|
|
5656
|
-
const [templatesError, setTemplatesError] =
|
|
5657
|
-
const [activeLeftTab, setActiveLeftTab] =
|
|
5658
|
-
const [search, setSearch] =
|
|
5659
|
-
const [sortKey, setSortKey] =
|
|
5660
|
-
const [activeTags, setActiveTags] =
|
|
5661
|
-
const [renameTarget, setRenameTarget] =
|
|
5662
|
-
const [pendingSaveAs, setPendingSaveAs] =
|
|
5663
|
-
const [newError, setNewError] =
|
|
5664
|
-
const [pickerKind, setPickerKind] =
|
|
5848
|
+
const [samples, setSamples] = React57.useState([EMPTY_TEMPLATE]);
|
|
5849
|
+
const [templates, setTemplates] = React57.useState([]);
|
|
5850
|
+
const [loadingSamples, setLoadingSamples] = React57.useState(false);
|
|
5851
|
+
const [loadingTemplates, setLoadingTemplates] = React57.useState(false);
|
|
5852
|
+
const [templatesError, setTemplatesError] = React57.useState(null);
|
|
5853
|
+
const [activeLeftTab, setActiveLeftTab] = React57.useState("templates");
|
|
5854
|
+
const [search, setSearch] = React57.useState("");
|
|
5855
|
+
const [sortKey, setSortKey] = React57.useState("updatedAt");
|
|
5856
|
+
const [activeTags, setActiveTags] = React57.useState([]);
|
|
5857
|
+
const [renameTarget, setRenameTarget] = React57.useState(null);
|
|
5858
|
+
const [pendingSaveAs, setPendingSaveAs] = React57.useState(null);
|
|
5859
|
+
const [newError, setNewError] = React57.useState(null);
|
|
5860
|
+
const [pickerKind, setPickerKind] = React57.useState(null);
|
|
5665
5861
|
const handleLoadTemplate = (templateId) => __async(null, null, function* () {
|
|
5666
5862
|
if (templateId === "empty-email") {
|
|
5667
5863
|
return empty_email_message_default;
|
|
@@ -5672,7 +5868,7 @@ function SamplesDrawer({
|
|
|
5672
5868
|
return null;
|
|
5673
5869
|
});
|
|
5674
5870
|
const withKind = (items, fallback) => items.map((item) => item.kind ? item : __spreadProps(__spreadValues({}, item), { kind: fallback }));
|
|
5675
|
-
|
|
5871
|
+
React57.useEffect(() => {
|
|
5676
5872
|
if (!enabled || !samplesDrawerOpen || !loadSamples) return;
|
|
5677
5873
|
setLoadingSamples(true);
|
|
5678
5874
|
loadSamples().then((results) => {
|
|
@@ -5702,16 +5898,16 @@ function SamplesDrawer({
|
|
|
5702
5898
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5703
5899
|
const row = { id, slug, kind, tags, createdAt: now, updatedAt: now };
|
|
5704
5900
|
if (kind === "sample") {
|
|
5705
|
-
setSamples((prev) => prev.some((
|
|
5901
|
+
setSamples((prev) => prev.some((t2) => t2.id === id) ? prev : [...prev, row]);
|
|
5706
5902
|
} else {
|
|
5707
|
-
setTemplates((prev) => prev.some((
|
|
5903
|
+
setTemplates((prev) => prev.some((t2) => t2.id === id) ? prev : [...prev, row]);
|
|
5708
5904
|
}
|
|
5709
5905
|
};
|
|
5710
|
-
|
|
5906
|
+
React57.useEffect(() => {
|
|
5711
5907
|
if (!enabled || !loadTemplates) return;
|
|
5712
5908
|
refreshTemplates();
|
|
5713
5909
|
}, [enabled, loadTemplates]);
|
|
5714
|
-
|
|
5910
|
+
React57.useEffect(() => {
|
|
5715
5911
|
const handler = (e) => {
|
|
5716
5912
|
const detail = e.detail;
|
|
5717
5913
|
if (Array.isArray(detail)) setTemplates(withKind(detail, "template"));
|
|
@@ -5719,47 +5915,47 @@ function SamplesDrawer({
|
|
|
5719
5915
|
window.addEventListener("templateListUpdated", handler);
|
|
5720
5916
|
return () => window.removeEventListener("templateListUpdated", handler);
|
|
5721
5917
|
}, []);
|
|
5722
|
-
const { templateRows, sampleRows } =
|
|
5918
|
+
const { templateRows, sampleRows } = React57.useMemo(() => {
|
|
5723
5919
|
const byId = /* @__PURE__ */ new Map();
|
|
5724
5920
|
for (const s of samples) byId.set(s.id, s);
|
|
5725
|
-
for (const
|
|
5921
|
+
for (const t2 of templates) byId.set(t2.id, t2);
|
|
5726
5922
|
const all = Array.from(byId.values());
|
|
5727
5923
|
return {
|
|
5728
|
-
templateRows: all.filter((
|
|
5729
|
-
sampleRows: all.filter((
|
|
5924
|
+
templateRows: all.filter((t2) => t2.kind === "template"),
|
|
5925
|
+
sampleRows: all.filter((t2) => t2.kind === "sample")
|
|
5730
5926
|
};
|
|
5731
5927
|
}, [samples, templates]);
|
|
5732
|
-
const allTags =
|
|
5928
|
+
const allTags = React57.useMemo(() => {
|
|
5733
5929
|
var _a2, _b2;
|
|
5734
5930
|
const set = /* @__PURE__ */ new Set();
|
|
5735
|
-
for (const
|
|
5931
|
+
for (const t2 of templateRows) (_a2 = t2.tags) == null ? void 0 : _a2.forEach((tag) => set.add(tag));
|
|
5736
5932
|
for (const s of sampleRows) (_b2 = s.tags) == null ? void 0 : _b2.forEach((tag) => set.add(tag));
|
|
5737
5933
|
return Array.from(set).sort();
|
|
5738
5934
|
}, [templateRows, sampleRows]);
|
|
5739
|
-
const matchesSearchAndTags =
|
|
5935
|
+
const matchesSearchAndTags = React57.useMemo(() => {
|
|
5740
5936
|
const term = search.trim().toLowerCase();
|
|
5741
|
-
return (
|
|
5937
|
+
return (t2) => {
|
|
5742
5938
|
if (term) {
|
|
5743
|
-
const haystack = [
|
|
5939
|
+
const haystack = [t2.slug, t2.description, t2.subject].filter(Boolean).join(" ").toLowerCase();
|
|
5744
5940
|
if (!haystack.includes(term)) return false;
|
|
5745
5941
|
}
|
|
5746
5942
|
if (activeTags.length > 0) {
|
|
5747
|
-
if (!
|
|
5748
|
-
if (!activeTags.every((tag) =>
|
|
5943
|
+
if (!t2.tags || t2.tags.length === 0) return false;
|
|
5944
|
+
if (!activeTags.every((tag) => t2.tags.includes(tag))) return false;
|
|
5749
5945
|
}
|
|
5750
5946
|
return true;
|
|
5751
5947
|
};
|
|
5752
5948
|
}, [search, activeTags]);
|
|
5753
|
-
const filteredTemplates =
|
|
5949
|
+
const filteredTemplates = React57.useMemo(
|
|
5754
5950
|
() => templateRows.filter(matchesSearchAndTags).slice().sort((a, b) => compareTemplates(a, b, sortKey)),
|
|
5755
5951
|
[templateRows, matchesSearchAndTags, sortKey]
|
|
5756
5952
|
);
|
|
5757
|
-
const filteredSamples =
|
|
5953
|
+
const filteredSamples = React57.useMemo(
|
|
5758
5954
|
() => sampleRows.filter(matchesSearchAndTags).slice().sort((a, b) => compareTemplates(a, b, sortKey)),
|
|
5759
5955
|
[sampleRows, matchesSearchAndTags, sortKey]
|
|
5760
5956
|
);
|
|
5761
5957
|
const toggleTag = (tag) => {
|
|
5762
|
-
setActiveTags((prev) => prev.includes(tag) ? prev.filter((
|
|
5958
|
+
setActiveTags((prev) => prev.includes(tag) ? prev.filter((t2) => t2 !== tag) : [...prev, tag]);
|
|
5763
5959
|
};
|
|
5764
5960
|
const handleDuplicate = (template) => {
|
|
5765
5961
|
if (!copyTemplate) return;
|
|
@@ -5785,22 +5981,21 @@ function SamplesDrawer({
|
|
|
5785
5981
|
showMessage("Template deleted");
|
|
5786
5982
|
};
|
|
5787
5983
|
const handleRenameSubmit = (newSlug, opts) => __async(null, null, function* () {
|
|
5984
|
+
var _a2, _b2;
|
|
5788
5985
|
if (!renameTarget || !renameTemplate) return;
|
|
5789
5986
|
yield renameTemplate(renameTarget.id, newSlug, opts);
|
|
5790
|
-
const
|
|
5791
|
-
|
|
5792
|
-
return t.id === renameTarget.id ? __spreadProps(__spreadValues({}, t), { slug: newSlug, tags: (_a2 = opts == null ? void 0 : opts.tags) != null ? _a2 : t.tags }) : t;
|
|
5793
|
-
};
|
|
5987
|
+
const newTags = (_b2 = (_a2 = opts == null ? void 0 : opts.tags) != null ? _a2 : renameTarget.tags) != null ? _b2 : [];
|
|
5988
|
+
const patch = (t2) => t2.id === renameTarget.id ? __spreadProps(__spreadValues({}, t2), { slug: newSlug, tags: newTags }) : t2;
|
|
5794
5989
|
setTemplates((prev) => prev.map(patch));
|
|
5795
5990
|
setSamples((prev) => prev.map(patch));
|
|
5796
5991
|
if (currentTemplateId === renameTarget.id) {
|
|
5797
|
-
setCurrentTemplate(renameTarget.id, newSlug);
|
|
5992
|
+
setCurrentTemplate(renameTarget.id, newSlug, void 0, newTags);
|
|
5798
5993
|
}
|
|
5799
5994
|
showMessage("Details saved");
|
|
5800
5995
|
});
|
|
5801
5996
|
const flipKindLocally = (id, kind) => {
|
|
5802
|
-
setTemplates((prev) => prev.map((
|
|
5803
|
-
setSamples((prev) => prev.map((
|
|
5997
|
+
setTemplates((prev) => prev.map((t2) => t2.id === id ? __spreadProps(__spreadValues({}, t2), { kind }) : t2));
|
|
5998
|
+
setSamples((prev) => prev.map((t2) => t2.id === id ? __spreadProps(__spreadValues({}, t2), { kind }) : t2));
|
|
5804
5999
|
};
|
|
5805
6000
|
const handleSetKind = (template, kind) => {
|
|
5806
6001
|
if (!setTemplateKind) return;
|
|
@@ -5837,7 +6032,7 @@ function SamplesDrawer({
|
|
|
5837
6032
|
};
|
|
5838
6033
|
const handleSaveAsSubmit = (templateName) => __async(null, null, function* () {
|
|
5839
6034
|
if (!saveAs || !pendingSaveAs) return false;
|
|
5840
|
-
const taken = templateRows.some((
|
|
6035
|
+
const taken = templateRows.some((t2) => t2.slug.toLowerCase() === templateName.toLowerCase());
|
|
5841
6036
|
if (taken) {
|
|
5842
6037
|
setNewError("A template with this name already exists");
|
|
5843
6038
|
return false;
|
|
@@ -5900,8 +6095,8 @@ function SamplesDrawer({
|
|
|
5900
6095
|
if (!enabled) {
|
|
5901
6096
|
return null;
|
|
5902
6097
|
}
|
|
5903
|
-
const existingSlugs = templates.map((
|
|
5904
|
-
return /* @__PURE__ */
|
|
6098
|
+
const existingSlugs = templates.map((t2) => t2.slug);
|
|
6099
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
5905
6100
|
material.Drawer,
|
|
5906
6101
|
{
|
|
5907
6102
|
variant: "persistent",
|
|
@@ -5916,7 +6111,7 @@ function SamplesDrawer({
|
|
|
5916
6111
|
transitionDuration: { enter: enterDuration, exit: exitDuration },
|
|
5917
6112
|
sx: { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0 }
|
|
5918
6113
|
},
|
|
5919
|
-
/* @__PURE__ */
|
|
6114
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
5920
6115
|
material.Stack,
|
|
5921
6116
|
{
|
|
5922
6117
|
py: 1,
|
|
@@ -5926,16 +6121,16 @@ function SamplesDrawer({
|
|
|
5926
6121
|
spacing: 1.5,
|
|
5927
6122
|
sx: { overflowY: "auto" }
|
|
5928
6123
|
},
|
|
5929
|
-
/* @__PURE__ */
|
|
6124
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { pt: 1 } }, /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "h6", component: "h1" }, /* @__PURE__ */ React57__default.default.createElement(react.Trans, { id: "drawer.library" }, "Library")), saveAs && (activeLeftTab === "templates" || activeLeftTab === "samples") && /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: activeLeftTab === "samples" ? t("drawer.new-sample", "New sample") : t("drawer.new-template", "New template") }, /* @__PURE__ */ React57__default.default.createElement(
|
|
5930
6125
|
material.IconButton,
|
|
5931
6126
|
{
|
|
5932
6127
|
size: "small",
|
|
5933
6128
|
onClick: () => openNewPicker(activeLeftTab === "samples" ? "sample" : "template"),
|
|
5934
|
-
"aria-label": activeLeftTab === "samples" ? "New sample" : "New template"
|
|
6129
|
+
"aria-label": activeLeftTab === "samples" ? t("drawer.new-sample", "New sample") : t("drawer.new-template", "New template")
|
|
5935
6130
|
},
|
|
5936
|
-
/* @__PURE__ */
|
|
6131
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })
|
|
5937
6132
|
))),
|
|
5938
|
-
/* @__PURE__ */
|
|
6133
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
5939
6134
|
material.Tabs,
|
|
5940
6135
|
{
|
|
5941
6136
|
value: activeLeftTab,
|
|
@@ -5943,42 +6138,42 @@ function SamplesDrawer({
|
|
|
5943
6138
|
variant: "fullWidth",
|
|
5944
6139
|
sx: { minHeight: 36, "& .MuiTab-root": { minHeight: 36, minWidth: 0, px: 1, fontSize: 13 } }
|
|
5945
6140
|
},
|
|
5946
|
-
/* @__PURE__ */
|
|
5947
|
-
/* @__PURE__ */
|
|
5948
|
-
/* @__PURE__ */
|
|
6141
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "templates", label: t("drawer.tab.templates", "Templates"), disabled: !loadTemplates }),
|
|
6142
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "samples", label: t("drawer.tab.samples", "Samples") }),
|
|
6143
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tab, { value: "outline", label: t("drawer.tab.outline", "Outline") })
|
|
5949
6144
|
),
|
|
5950
|
-
activeLeftTab === "outline" ? /* @__PURE__ */
|
|
6145
|
+
activeLeftTab === "outline" ? /* @__PURE__ */ React57__default.default.createElement(OutlinePanel, null) : /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
5951
6146
|
material.TextField,
|
|
5952
6147
|
{
|
|
5953
6148
|
size: "small",
|
|
5954
|
-
placeholder: activeLeftTab === "templates" ? "Search templates" : "Search samples",
|
|
6149
|
+
placeholder: activeLeftTab === "templates" ? t("drawer.search-templates", "Search templates") : t("drawer.search-samples", "Search samples"),
|
|
5955
6150
|
value: search,
|
|
5956
6151
|
onChange: (e) => setSearch(e.target.value),
|
|
5957
6152
|
InputProps: {
|
|
5958
|
-
startAdornment: /* @__PURE__ */
|
|
6153
|
+
startAdornment: /* @__PURE__ */ React57__default.default.createElement(material.InputAdornment, { position: "start" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SearchOutlined, { fontSize: "small" }))
|
|
5959
6154
|
}
|
|
5960
6155
|
}
|
|
5961
|
-
), /* @__PURE__ */
|
|
6156
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
5962
6157
|
material.TextField,
|
|
5963
6158
|
{
|
|
5964
6159
|
select: true,
|
|
5965
6160
|
size: "small",
|
|
5966
|
-
label: "Sort by",
|
|
6161
|
+
label: t("drawer.sort-by", "Sort by"),
|
|
5967
6162
|
value: sortKey,
|
|
5968
6163
|
onChange: (e) => setSortKey(e.target.value)
|
|
5969
6164
|
},
|
|
5970
|
-
SORT_OPTIONS.map((opt) => /* @__PURE__ */
|
|
5971
|
-
), allTags.length > 0 && /* @__PURE__ */
|
|
6165
|
+
SORT_OPTIONS.map((opt) => /* @__PURE__ */ React57__default.default.createElement(material.MenuItem, { key: opt.value, value: opt.value }, t(opt.labelKey, opt.fallback)))
|
|
6166
|
+
), allTags.length > 0 && /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 } }, /* @__PURE__ */ React57__default.default.createElement(
|
|
5972
6167
|
material.Chip,
|
|
5973
6168
|
{
|
|
5974
|
-
label: "All",
|
|
6169
|
+
label: t("drawer.tag.all", "All"),
|
|
5975
6170
|
size: "small",
|
|
5976
6171
|
clickable: true,
|
|
5977
6172
|
color: activeTags.length === 0 ? "primary" : "default",
|
|
5978
6173
|
variant: activeTags.length === 0 ? "filled" : "outlined",
|
|
5979
6174
|
onClick: () => setActiveTags([])
|
|
5980
6175
|
}
|
|
5981
|
-
), allTags.map((tag) => /* @__PURE__ */
|
|
6176
|
+
), allTags.map((tag) => /* @__PURE__ */ React57__default.default.createElement(
|
|
5982
6177
|
material.Chip,
|
|
5983
6178
|
{
|
|
5984
6179
|
key: tag,
|
|
@@ -5989,7 +6184,7 @@ function SamplesDrawer({
|
|
|
5989
6184
|
variant: activeTags.includes(tag) ? "filled" : "outlined",
|
|
5990
6185
|
onClick: () => toggleTag(tag)
|
|
5991
6186
|
}
|
|
5992
|
-
))), activeLeftTab === "templates" ? /* @__PURE__ */
|
|
6187
|
+
))), activeLeftTab === "templates" ? /* @__PURE__ */ React57__default.default.createElement(material.Box, null, loadingTemplates ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React57__default.default.createElement(material.CircularProgress, { size: 24 })) : templatesError ? /* @__PURE__ */ React57__default.default.createElement(material.Alert, { severity: "error", sx: { my: 1 } }, templatesError) : filteredTemplates.length > 0 ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredTemplates.map((template) => /* @__PURE__ */ React57__default.default.createElement(
|
|
5993
6188
|
TemplateRow,
|
|
5994
6189
|
{
|
|
5995
6190
|
key: template.id,
|
|
@@ -6001,7 +6196,7 @@ function SamplesDrawer({
|
|
|
6001
6196
|
onDelete: deleteTemplate ? () => handleDelete(template) : void 0,
|
|
6002
6197
|
onPromote: setTemplateKind ? () => handleSetKind(template, "sample") : void 0
|
|
6003
6198
|
}
|
|
6004
|
-
))) : /* @__PURE__ */
|
|
6199
|
+
))) : /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, templateRows.length === 0 ? t("drawer.no-templates", "No saved templates yet") : t("drawer.no-templates-match", "No templates match your filters"))) : /* @__PURE__ */ React57__default.default.createElement(material.Box, null, loadingSamples ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React57__default.default.createElement(material.CircularProgress, { size: 24 })) : filteredSamples.length > 0 ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredSamples.map((sample) => /* @__PURE__ */ React57__default.default.createElement(
|
|
6005
6200
|
TemplateRow,
|
|
6006
6201
|
{
|
|
6007
6202
|
key: sample.id,
|
|
@@ -6013,9 +6208,9 @@ function SamplesDrawer({
|
|
|
6013
6208
|
onDelete: deleteTemplate ? () => handleDelete(sample) : void 0,
|
|
6014
6209
|
onDemote: setTemplateKind ? () => handleSetKind(sample, "template") : void 0
|
|
6015
6210
|
}
|
|
6016
|
-
))) : /* @__PURE__ */
|
|
6211
|
+
))) : /* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, sampleRows.length === 0 ? t("drawer.no-samples", "No samples available") : t("drawer.no-samples-match", "No samples match your filters"))))
|
|
6017
6212
|
)
|
|
6018
|
-
), renameTarget && /* @__PURE__ */
|
|
6213
|
+
), renameTarget && /* @__PURE__ */ React57__default.default.createElement(
|
|
6019
6214
|
RenameDialog,
|
|
6020
6215
|
{
|
|
6021
6216
|
open: !!renameTarget,
|
|
@@ -6025,7 +6220,7 @@ function SamplesDrawer({
|
|
|
6025
6220
|
onClose: () => setRenameTarget(null),
|
|
6026
6221
|
onSubmit: handleRenameSubmit
|
|
6027
6222
|
}
|
|
6028
|
-
), /* @__PURE__ */
|
|
6223
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
6029
6224
|
SaveTemplateDialog,
|
|
6030
6225
|
{
|
|
6031
6226
|
open: !!pendingSaveAs,
|
|
@@ -6038,13 +6233,13 @@ function SamplesDrawer({
|
|
|
6038
6233
|
defaultName: (_b = pendingSaveAs == null ? void 0 : pendingSaveAs.defaultName) != null ? _b : "New Template",
|
|
6039
6234
|
error: newError
|
|
6040
6235
|
}
|
|
6041
|
-
), /* @__PURE__ */
|
|
6236
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
6042
6237
|
NewTemplatePickerDialog,
|
|
6043
6238
|
{
|
|
6044
6239
|
open: pickerKind !== null,
|
|
6045
6240
|
kind: pickerKind != null ? pickerKind : "template",
|
|
6046
6241
|
samples: sampleRows,
|
|
6047
|
-
existingSlugs: pickerKind === "sample" ? sampleRows.map((s) => s.slug) : templateRows.map((
|
|
6242
|
+
existingSlugs: pickerKind === "sample" ? sampleRows.map((s) => s.slug) : templateRows.map((t2) => t2.slug),
|
|
6048
6243
|
onClose: () => setPickerKind(null),
|
|
6049
6244
|
onCreate: handleCreateFromPicker
|
|
6050
6245
|
}
|
|
@@ -6062,7 +6257,7 @@ var ICON_SX = {
|
|
|
6062
6257
|
borderColor: "cadet.300"
|
|
6063
6258
|
};
|
|
6064
6259
|
function BlockTypeButton({ label, icon, onClick }) {
|
|
6065
|
-
return /* @__PURE__ */
|
|
6260
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6066
6261
|
material.Button,
|
|
6067
6262
|
{
|
|
6068
6263
|
sx: BUTTON_SX2,
|
|
@@ -6071,14 +6266,14 @@ function BlockTypeButton({ label, icon, onClick }) {
|
|
|
6071
6266
|
onClick();
|
|
6072
6267
|
}
|
|
6073
6268
|
},
|
|
6074
|
-
/* @__PURE__ */
|
|
6075
|
-
/* @__PURE__ */
|
|
6269
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: ICON_SX }, icon),
|
|
6270
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Typography, { variant: "body2" }, label)
|
|
6076
6271
|
);
|
|
6077
6272
|
}
|
|
6078
6273
|
var BUTTONS = [
|
|
6079
6274
|
{
|
|
6080
6275
|
label: "Heading",
|
|
6081
|
-
icon: /* @__PURE__ */
|
|
6276
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HMobiledataOutlined, null),
|
|
6082
6277
|
block: () => ({
|
|
6083
6278
|
type: "Heading",
|
|
6084
6279
|
data: {
|
|
@@ -6091,7 +6286,7 @@ var BUTTONS = [
|
|
|
6091
6286
|
},
|
|
6092
6287
|
{
|
|
6093
6288
|
label: "Text",
|
|
6094
|
-
icon: /* @__PURE__ */
|
|
6289
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.NotesOutlined, null),
|
|
6095
6290
|
block: () => ({
|
|
6096
6291
|
type: "Text",
|
|
6097
6292
|
data: {
|
|
@@ -6105,7 +6300,7 @@ var BUTTONS = [
|
|
|
6105
6300
|
},
|
|
6106
6301
|
{
|
|
6107
6302
|
label: "Button",
|
|
6108
|
-
icon: /* @__PURE__ */
|
|
6303
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SmartButtonOutlined, null),
|
|
6109
6304
|
block: () => ({
|
|
6110
6305
|
type: "Button",
|
|
6111
6306
|
data: {
|
|
@@ -6119,7 +6314,7 @@ var BUTTONS = [
|
|
|
6119
6314
|
},
|
|
6120
6315
|
{
|
|
6121
6316
|
label: "Image",
|
|
6122
|
-
icon: /* @__PURE__ */
|
|
6317
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ImageOutlined, null),
|
|
6123
6318
|
block: () => ({
|
|
6124
6319
|
type: "Image",
|
|
6125
6320
|
data: {
|
|
@@ -6135,7 +6330,7 @@ var BUTTONS = [
|
|
|
6135
6330
|
},
|
|
6136
6331
|
{
|
|
6137
6332
|
label: "Avatar",
|
|
6138
|
-
icon: /* @__PURE__ */
|
|
6333
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AccountCircleOutlined, null),
|
|
6139
6334
|
block: () => ({
|
|
6140
6335
|
type: "Avatar",
|
|
6141
6336
|
data: {
|
|
@@ -6149,7 +6344,7 @@ var BUTTONS = [
|
|
|
6149
6344
|
},
|
|
6150
6345
|
{
|
|
6151
6346
|
label: "Personal Signature",
|
|
6152
|
-
icon: /* @__PURE__ */
|
|
6347
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ContactMailOutlined, null),
|
|
6153
6348
|
block: () => ({
|
|
6154
6349
|
type: "Signature",
|
|
6155
6350
|
data: {
|
|
@@ -6171,7 +6366,7 @@ var BUTTONS = [
|
|
|
6171
6366
|
},
|
|
6172
6367
|
{
|
|
6173
6368
|
label: "Company Signature",
|
|
6174
|
-
icon: /* @__PURE__ */
|
|
6369
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.BusinessOutlined, null),
|
|
6175
6370
|
block: () => ({
|
|
6176
6371
|
type: "Signature",
|
|
6177
6372
|
data: {
|
|
@@ -6191,7 +6386,7 @@ var BUTTONS = [
|
|
|
6191
6386
|
},
|
|
6192
6387
|
{
|
|
6193
6388
|
label: "Divider",
|
|
6194
|
-
icon: /* @__PURE__ */
|
|
6389
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HorizontalRuleOutlined, null),
|
|
6195
6390
|
block: () => ({
|
|
6196
6391
|
type: "Divider",
|
|
6197
6392
|
data: {
|
|
@@ -6204,7 +6399,7 @@ var BUTTONS = [
|
|
|
6204
6399
|
},
|
|
6205
6400
|
{
|
|
6206
6401
|
label: "Spacer",
|
|
6207
|
-
icon: /* @__PURE__ */
|
|
6402
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.Crop32Outlined, null),
|
|
6208
6403
|
block: () => ({
|
|
6209
6404
|
type: "Spacer",
|
|
6210
6405
|
data: {}
|
|
@@ -6212,7 +6407,7 @@ var BUTTONS = [
|
|
|
6212
6407
|
},
|
|
6213
6408
|
{
|
|
6214
6409
|
label: "Html",
|
|
6215
|
-
icon: /* @__PURE__ */
|
|
6410
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.HtmlOutlined, null),
|
|
6216
6411
|
block: () => ({
|
|
6217
6412
|
type: "Html",
|
|
6218
6413
|
data: {
|
|
@@ -6227,7 +6422,7 @@ var BUTTONS = [
|
|
|
6227
6422
|
},
|
|
6228
6423
|
{
|
|
6229
6424
|
label: "Columns",
|
|
6230
|
-
icon: /* @__PURE__ */
|
|
6425
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ViewColumnOutlined, null),
|
|
6231
6426
|
block: () => ({
|
|
6232
6427
|
type: "ColumnsContainer",
|
|
6233
6428
|
data: {
|
|
@@ -6242,7 +6437,7 @@ var BUTTONS = [
|
|
|
6242
6437
|
},
|
|
6243
6438
|
{
|
|
6244
6439
|
label: "Container",
|
|
6245
|
-
icon: /* @__PURE__ */
|
|
6440
|
+
icon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.LibraryAddOutlined, null),
|
|
6246
6441
|
block: () => ({
|
|
6247
6442
|
type: "Container",
|
|
6248
6443
|
data: {
|
|
@@ -6266,7 +6461,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
6266
6461
|
if (anchorEl === null) {
|
|
6267
6462
|
return null;
|
|
6268
6463
|
}
|
|
6269
|
-
return /* @__PURE__ */
|
|
6464
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6270
6465
|
material.Menu,
|
|
6271
6466
|
{
|
|
6272
6467
|
open: true,
|
|
@@ -6275,12 +6470,12 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
6275
6470
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
6276
6471
|
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
6277
6472
|
},
|
|
6278
|
-
/* @__PURE__ */
|
|
6473
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React57__default.default.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
|
|
6279
6474
|
);
|
|
6280
6475
|
}
|
|
6281
6476
|
function DividerButton({ buttonElement, onClick }) {
|
|
6282
|
-
const [visible, setVisible] =
|
|
6283
|
-
|
|
6477
|
+
const [visible, setVisible] = React57.useState(false);
|
|
6478
|
+
React57.useEffect(() => {
|
|
6284
6479
|
function listener({ clientX, clientY }) {
|
|
6285
6480
|
if (!buttonElement) {
|
|
6286
6481
|
return;
|
|
@@ -6302,7 +6497,7 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
6302
6497
|
window.removeEventListener("mousemove", listener);
|
|
6303
6498
|
};
|
|
6304
6499
|
}, [buttonElement, setVisible]);
|
|
6305
|
-
return /* @__PURE__ */
|
|
6500
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Fade, { in: visible }, /* @__PURE__ */ React57__default.default.createElement(
|
|
6306
6501
|
material.IconButton,
|
|
6307
6502
|
{
|
|
6308
6503
|
size: "small",
|
|
@@ -6325,11 +6520,11 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
6325
6520
|
onClick();
|
|
6326
6521
|
}
|
|
6327
6522
|
},
|
|
6328
|
-
/* @__PURE__ */
|
|
6523
|
+
/* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, { fontSize: "small" })
|
|
6329
6524
|
));
|
|
6330
6525
|
}
|
|
6331
6526
|
function PlaceholderButton({ onClick }) {
|
|
6332
|
-
return /* @__PURE__ */
|
|
6527
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6333
6528
|
material.ButtonBase,
|
|
6334
6529
|
{
|
|
6335
6530
|
onClick: (ev) => {
|
|
@@ -6345,7 +6540,7 @@ function PlaceholderButton({ onClick }) {
|
|
|
6345
6540
|
bgcolor: "rgba(0,0,0, 0.05)"
|
|
6346
6541
|
}
|
|
6347
6542
|
},
|
|
6348
|
-
/* @__PURE__ */
|
|
6543
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6349
6544
|
iconsMaterial.AddOutlined,
|
|
6350
6545
|
{
|
|
6351
6546
|
sx: {
|
|
@@ -6362,29 +6557,29 @@ function PlaceholderButton({ onClick }) {
|
|
|
6362
6557
|
|
|
6363
6558
|
// src/editor/blocks/helpers/editor-children-ids/add-block-menu/index.tsx
|
|
6364
6559
|
function AddBlockButton({ onSelect, placeholder }) {
|
|
6365
|
-
const [menuAnchorEl, setMenuAnchorEl] =
|
|
6366
|
-
const [buttonElement, setButtonElement] =
|
|
6560
|
+
const [menuAnchorEl, setMenuAnchorEl] = React57.useState(null);
|
|
6561
|
+
const [buttonElement, setButtonElement] = React57.useState(null);
|
|
6367
6562
|
const handleButtonClick = () => {
|
|
6368
6563
|
setMenuAnchorEl(buttonElement);
|
|
6369
6564
|
};
|
|
6370
6565
|
const renderButton2 = () => {
|
|
6371
6566
|
if (placeholder) {
|
|
6372
|
-
return /* @__PURE__ */
|
|
6567
|
+
return /* @__PURE__ */ React57__default.default.createElement(PlaceholderButton, { onClick: handleButtonClick });
|
|
6373
6568
|
} else {
|
|
6374
|
-
return /* @__PURE__ */
|
|
6569
|
+
return /* @__PURE__ */ React57__default.default.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
|
|
6375
6570
|
}
|
|
6376
6571
|
};
|
|
6377
|
-
return /* @__PURE__ */
|
|
6572
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React57__default.default.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
|
|
6378
6573
|
}
|
|
6379
|
-
var BlockParentContext =
|
|
6574
|
+
var BlockParentContext = React57.createContext(null);
|
|
6380
6575
|
function BlockParentProvider({
|
|
6381
6576
|
info,
|
|
6382
6577
|
children
|
|
6383
6578
|
}) {
|
|
6384
|
-
return /* @__PURE__ */
|
|
6579
|
+
return /* @__PURE__ */ React57__default.default.createElement(BlockParentContext.Provider, { value: info }, children);
|
|
6385
6580
|
}
|
|
6386
6581
|
function useBlockParent() {
|
|
6387
|
-
return
|
|
6582
|
+
return React57.useContext(BlockParentContext);
|
|
6388
6583
|
}
|
|
6389
6584
|
|
|
6390
6585
|
// src/editor/blocks/helpers/editor-children-ids/index.tsx
|
|
@@ -6411,9 +6606,9 @@ function EditorChildrenIds({ childrenIds, onChange, parentRef }) {
|
|
|
6411
6606
|
});
|
|
6412
6607
|
};
|
|
6413
6608
|
if (!childrenIds || childrenIds.length === 0) {
|
|
6414
|
-
return /* @__PURE__ */
|
|
6609
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock }), parentRef && /* @__PURE__ */ React57__default.default.createElement(CanvasDropZone, { parentRef, targetIndex: 0, placeholder: true }));
|
|
6415
6610
|
}
|
|
6416
|
-
return /* @__PURE__ */
|
|
6611
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React57__default.default.createElement(React57.Fragment, { key: childId }, /* @__PURE__ */ React57__default.default.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), parentRef && /* @__PURE__ */ React57__default.default.createElement(CanvasDropZone, { parentRef, targetIndex: i }), parentRef ? /* @__PURE__ */ React57__default.default.createElement(BlockParentProvider, { info: { parent: parentRef, indexInParent: i } }, /* @__PURE__ */ React57__default.default.createElement(EditorBlock, { id: childId })) : /* @__PURE__ */ React57__default.default.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React57__default.default.createElement(AddBlockButton, { onSelect: appendBlock }), parentRef && /* @__PURE__ */ React57__default.default.createElement(CanvasDropZone, { parentRef, targetIndex: childrenIds.length }));
|
|
6417
6612
|
}
|
|
6418
6613
|
function CanvasDropZone({
|
|
6419
6614
|
parentRef,
|
|
@@ -6422,7 +6617,7 @@ function CanvasDropZone({
|
|
|
6422
6617
|
}) {
|
|
6423
6618
|
const document2 = useDocument();
|
|
6424
6619
|
const dragging = useDraggingBlock();
|
|
6425
|
-
const [over, setOver] =
|
|
6620
|
+
const [over, setOver] = React57.useState(false);
|
|
6426
6621
|
if (!dragging) return null;
|
|
6427
6622
|
if (isDescendant(document2, dragging.sourceId, parentRef.parentId)) return null;
|
|
6428
6623
|
const handleDragOver = (e) => {
|
|
@@ -6450,7 +6645,7 @@ function CanvasDropZone({
|
|
|
6450
6645
|
}
|
|
6451
6646
|
setDraggingBlock(null);
|
|
6452
6647
|
};
|
|
6453
|
-
return /* @__PURE__ */
|
|
6648
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6454
6649
|
material.Box,
|
|
6455
6650
|
{
|
|
6456
6651
|
onDragOver: handleDragOver,
|
|
@@ -6493,13 +6688,13 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
6493
6688
|
});
|
|
6494
6689
|
setSelectedBlockId(blockId);
|
|
6495
6690
|
};
|
|
6496
|
-
return /* @__PURE__ */
|
|
6691
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6497
6692
|
columns_container_default,
|
|
6498
6693
|
{
|
|
6499
6694
|
props: restProps,
|
|
6500
6695
|
style,
|
|
6501
6696
|
columns: [
|
|
6502
|
-
/* @__PURE__ */
|
|
6697
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6503
6698
|
EditorChildrenIds,
|
|
6504
6699
|
{
|
|
6505
6700
|
childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds,
|
|
@@ -6507,7 +6702,7 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
6507
6702
|
onChange: (change) => updateColumn(0, change)
|
|
6508
6703
|
}
|
|
6509
6704
|
),
|
|
6510
|
-
/* @__PURE__ */
|
|
6705
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6511
6706
|
EditorChildrenIds,
|
|
6512
6707
|
{
|
|
6513
6708
|
childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds,
|
|
@@ -6515,7 +6710,7 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
6515
6710
|
onChange: (change) => updateColumn(1, change)
|
|
6516
6711
|
}
|
|
6517
6712
|
),
|
|
6518
|
-
/* @__PURE__ */
|
|
6713
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6519
6714
|
EditorChildrenIds,
|
|
6520
6715
|
{
|
|
6521
6716
|
childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds,
|
|
@@ -6532,7 +6727,7 @@ function ContainerEditor({ style, props }) {
|
|
|
6532
6727
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
6533
6728
|
const document2 = useDocument();
|
|
6534
6729
|
const currentBlockId = useCurrentBlockId();
|
|
6535
|
-
return /* @__PURE__ */
|
|
6730
|
+
return /* @__PURE__ */ React57__default.default.createElement(container_default, { style }, /* @__PURE__ */ React57__default.default.createElement(
|
|
6536
6731
|
EditorChildrenIds,
|
|
6537
6732
|
{
|
|
6538
6733
|
childrenIds,
|
|
@@ -6639,7 +6834,7 @@ function EmailLayoutEditor(props) {
|
|
|
6639
6834
|
const document2 = useDocument();
|
|
6640
6835
|
const currentBlockId = useCurrentBlockId();
|
|
6641
6836
|
const selectedBlockId = useSelectedBlockId();
|
|
6642
|
-
const handleDelete =
|
|
6837
|
+
const handleDelete = React57.useCallback((e) => {
|
|
6643
6838
|
var _a2, _b2, _c2;
|
|
6644
6839
|
if (e.key !== "Delete" && e.key !== "Backspace") return;
|
|
6645
6840
|
if (!selectedBlockId) return;
|
|
@@ -6670,7 +6865,7 @@ function EmailLayoutEditor(props) {
|
|
|
6670
6865
|
delete nDocument[selectedBlockId];
|
|
6671
6866
|
resetDocument(nDocument);
|
|
6672
6867
|
}, [selectedBlockId, document2]);
|
|
6673
|
-
const handleCopy =
|
|
6868
|
+
const handleCopy = React57.useCallback((e) => {
|
|
6674
6869
|
if (!(e.metaKey || e.ctrlKey) || e.key !== "c") return;
|
|
6675
6870
|
if (!selectedBlockId) return;
|
|
6676
6871
|
const target = e.target;
|
|
@@ -6683,7 +6878,7 @@ function EmailLayoutEditor(props) {
|
|
|
6683
6878
|
const payload = JSON.stringify({ __emailEditorBlocks: true, rootBlockId: selectedBlockId, blocks });
|
|
6684
6879
|
navigator.clipboard.writeText(payload);
|
|
6685
6880
|
}, [selectedBlockId, document2]);
|
|
6686
|
-
const handlePaste =
|
|
6881
|
+
const handlePaste = React57.useCallback((e) => __async(null, null, function* () {
|
|
6687
6882
|
var _a2;
|
|
6688
6883
|
const target = e.target;
|
|
6689
6884
|
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
@@ -6714,7 +6909,7 @@ function EmailLayoutEditor(props) {
|
|
|
6714
6909
|
resetDocument(doc);
|
|
6715
6910
|
setSelectedBlockId(newRootId);
|
|
6716
6911
|
}), [document2, childrenIds, selectedBlockId, currentBlockId]);
|
|
6717
|
-
|
|
6912
|
+
React57.useEffect(() => {
|
|
6718
6913
|
window.addEventListener("keydown", handleDelete);
|
|
6719
6914
|
window.addEventListener("keydown", handleCopy);
|
|
6720
6915
|
window.addEventListener("paste", handlePaste);
|
|
@@ -6733,7 +6928,7 @@ function EmailLayoutEditor(props) {
|
|
|
6733
6928
|
lineHeight: "1.5",
|
|
6734
6929
|
margin: "0"
|
|
6735
6930
|
};
|
|
6736
|
-
const editorChildren = /* @__PURE__ */
|
|
6931
|
+
const editorChildren = /* @__PURE__ */ React57__default.default.createElement(
|
|
6737
6932
|
EditorChildrenIds,
|
|
6738
6933
|
{
|
|
6739
6934
|
childrenIds,
|
|
@@ -6761,7 +6956,7 @@ function EmailLayoutEditor(props) {
|
|
|
6761
6956
|
boxShadow: "0 1px 2px rgba(33, 36, 67, 0.05), 0 8px 24px rgba(33, 36, 67, 0.08)"
|
|
6762
6957
|
};
|
|
6763
6958
|
if (props.backdropDisabled) {
|
|
6764
|
-
return /* @__PURE__ */
|
|
6959
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6765
6960
|
"div",
|
|
6766
6961
|
{
|
|
6767
6962
|
onClick: () => {
|
|
@@ -6774,7 +6969,7 @@ function EmailLayoutEditor(props) {
|
|
|
6774
6969
|
minHeight: "100%"
|
|
6775
6970
|
})
|
|
6776
6971
|
},
|
|
6777
|
-
/* @__PURE__ */
|
|
6972
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6778
6973
|
"div",
|
|
6779
6974
|
{
|
|
6780
6975
|
style: __spreadProps(__spreadValues({}, cardStyle), {
|
|
@@ -6782,11 +6977,11 @@ function EmailLayoutEditor(props) {
|
|
|
6782
6977
|
padding: "32px"
|
|
6783
6978
|
})
|
|
6784
6979
|
},
|
|
6785
|
-
/* @__PURE__ */
|
|
6980
|
+
/* @__PURE__ */ React57__default.default.createElement("div", { style: { maxWidth: "600px", margin: "0 auto" } }, editorChildren)
|
|
6786
6981
|
)
|
|
6787
6982
|
);
|
|
6788
6983
|
}
|
|
6789
|
-
return /* @__PURE__ */
|
|
6984
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
6790
6985
|
"div",
|
|
6791
6986
|
{
|
|
6792
6987
|
onClick: () => {
|
|
@@ -6799,7 +6994,7 @@ function EmailLayoutEditor(props) {
|
|
|
6799
6994
|
minHeight: "100%"
|
|
6800
6995
|
})
|
|
6801
6996
|
},
|
|
6802
|
-
/* @__PURE__ */
|
|
6997
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6803
6998
|
"div",
|
|
6804
6999
|
{
|
|
6805
7000
|
style: __spreadProps(__spreadValues({}, cardStyle), {
|
|
@@ -6807,7 +7002,7 @@ function EmailLayoutEditor(props) {
|
|
|
6807
7002
|
padding: "32px 0"
|
|
6808
7003
|
})
|
|
6809
7004
|
},
|
|
6810
|
-
/* @__PURE__ */
|
|
7005
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
6811
7006
|
"table",
|
|
6812
7007
|
{
|
|
6813
7008
|
align: "center",
|
|
@@ -6831,7 +7026,7 @@ function EmailLayoutEditor(props) {
|
|
|
6831
7026
|
cellPadding: "0",
|
|
6832
7027
|
border: 0
|
|
6833
7028
|
},
|
|
6834
|
-
/* @__PURE__ */
|
|
7029
|
+
/* @__PURE__ */ React57__default.default.createElement("tbody", null, /* @__PURE__ */ React57__default.default.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React57__default.default.createElement("td", null, editorChildren)))
|
|
6835
7030
|
)
|
|
6836
7031
|
)
|
|
6837
7032
|
);
|
|
@@ -6991,7 +7186,7 @@ function TuneMenu({ blockId }) {
|
|
|
6991
7186
|
resetDocument(nDocument);
|
|
6992
7187
|
setSelectedBlockId(blockId);
|
|
6993
7188
|
};
|
|
6994
|
-
return /* @__PURE__ */
|
|
7189
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, null, /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: t("tune.move-up", "Move up"), placement: "left-start" }, /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { "aria-label": t("tune.move-up", "Move up"), onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: t("tune.move-down", "Move down"), placement: "left-start" }, /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { "aria-label": t("tune.move-down", "Move down"), onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: t("tune.copy", "Copy block"), placement: "left-start" }, /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { "aria-label": t("tune.copy", "Copy block"), onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: t("tune.delete", "Delete"), placement: "left-start" }, /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { "aria-label": t("tune.delete", "Delete"), onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DeleteOutlined, { fontSize: "small" })))));
|
|
6995
7190
|
}
|
|
6996
7191
|
|
|
6997
7192
|
// src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
|
|
@@ -7000,7 +7195,7 @@ function EditorBlockWrapper({ children }) {
|
|
|
7000
7195
|
const hoveredBlockId = useHoveredBlockId();
|
|
7001
7196
|
const draggingBlock = useDraggingBlock();
|
|
7002
7197
|
const blockParent = useBlockParent();
|
|
7003
|
-
const [mouseInside, setMouseInside] =
|
|
7198
|
+
const [mouseInside, setMouseInside] = React57.useState(false);
|
|
7004
7199
|
const blockId = useCurrentBlockId();
|
|
7005
7200
|
const isBeingDragged = (draggingBlock == null ? void 0 : draggingBlock.sourceId) === blockId;
|
|
7006
7201
|
let outline;
|
|
@@ -7013,7 +7208,7 @@ function EditorBlockWrapper({ children }) {
|
|
|
7013
7208
|
if (selectedBlockId !== blockId) {
|
|
7014
7209
|
return null;
|
|
7015
7210
|
}
|
|
7016
|
-
return /* @__PURE__ */
|
|
7211
|
+
return /* @__PURE__ */ React57__default.default.createElement(TuneMenu, { blockId });
|
|
7017
7212
|
};
|
|
7018
7213
|
const draggable = Boolean(blockParent) && selectedBlockId !== blockId;
|
|
7019
7214
|
const handleDragStart = (e) => {
|
|
@@ -7026,7 +7221,7 @@ function EditorBlockWrapper({ children }) {
|
|
|
7026
7221
|
const handleDragEnd = () => {
|
|
7027
7222
|
setDraggingBlock(null);
|
|
7028
7223
|
};
|
|
7029
|
-
return /* @__PURE__ */
|
|
7224
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
7030
7225
|
material.Box,
|
|
7031
7226
|
{
|
|
7032
7227
|
draggable,
|
|
@@ -7117,8 +7312,8 @@ function ButtonEditor({ style, props }) {
|
|
|
7117
7312
|
const fullWidth = (_b = props == null ? void 0 : props.fullWidth) != null ? _b : ButtonPropsDefaults.fullWidth;
|
|
7118
7313
|
const buttonTextColor = (_c = props == null ? void 0 : props.buttonTextColor) != null ? _c : ButtonPropsDefaults.buttonTextColor;
|
|
7119
7314
|
const buttonBackgroundColor = (_d = props == null ? void 0 : props.buttonBackgroundColor) != null ? _d : ButtonPropsDefaults.buttonBackgroundColor;
|
|
7120
|
-
const [localText, setLocalText] =
|
|
7121
|
-
|
|
7315
|
+
const [localText, setLocalText] = React57.useState(text);
|
|
7316
|
+
React57.useEffect(() => {
|
|
7122
7317
|
setLocalText(text);
|
|
7123
7318
|
}, [text]);
|
|
7124
7319
|
const padding = getButtonSizePadding2(props);
|
|
@@ -7171,7 +7366,7 @@ function ButtonEditor({ style, props }) {
|
|
|
7171
7366
|
selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
|
|
7172
7367
|
});
|
|
7173
7368
|
};
|
|
7174
|
-
return /* @__PURE__ */
|
|
7369
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React57__default.default.createElement(
|
|
7175
7370
|
"input",
|
|
7176
7371
|
{
|
|
7177
7372
|
type: "text",
|
|
@@ -7188,18 +7383,18 @@ function ButtonEditor({ style, props }) {
|
|
|
7188
7383
|
}
|
|
7189
7384
|
));
|
|
7190
7385
|
}
|
|
7191
|
-
return /* @__PURE__ */
|
|
7386
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React57__default.default.createElement("span", { style: linkStyle }, /* @__PURE__ */ React57__default.default.createElement("span", null, text)));
|
|
7192
7387
|
}
|
|
7193
7388
|
function useMarkdownToolbar({ text, isSelected, commitText, trackSelection }) {
|
|
7194
|
-
const textareaRef =
|
|
7195
|
-
const [selection, setSelection] =
|
|
7196
|
-
const [linkPrompt, setLinkPrompt] =
|
|
7197
|
-
const pendingSelectionRef =
|
|
7198
|
-
const textRef =
|
|
7199
|
-
|
|
7389
|
+
const textareaRef = React57.useRef(null);
|
|
7390
|
+
const [selection, setSelection] = React57.useState({ start: 0, end: 0 });
|
|
7391
|
+
const [linkPrompt, setLinkPrompt] = React57.useState(false);
|
|
7392
|
+
const pendingSelectionRef = React57.useRef(null);
|
|
7393
|
+
const textRef = React57.useRef(text);
|
|
7394
|
+
React57.useEffect(() => {
|
|
7200
7395
|
textRef.current = text;
|
|
7201
7396
|
}, [text]);
|
|
7202
|
-
const syncSelection =
|
|
7397
|
+
const syncSelection = React57.useCallback(
|
|
7203
7398
|
(start, end) => {
|
|
7204
7399
|
const next = { start, end };
|
|
7205
7400
|
setSelection(next);
|
|
@@ -7207,7 +7402,7 @@ function useMarkdownToolbar({ text, isSelected, commitText, trackSelection }) {
|
|
|
7207
7402
|
},
|
|
7208
7403
|
[trackSelection]
|
|
7209
7404
|
);
|
|
7210
|
-
const trackFocus =
|
|
7405
|
+
const trackFocus = React57.useCallback(
|
|
7211
7406
|
(e) => {
|
|
7212
7407
|
var _a, _b;
|
|
7213
7408
|
const el = e.currentTarget;
|
|
@@ -7217,7 +7412,7 @@ function useMarkdownToolbar({ text, isSelected, commitText, trackSelection }) {
|
|
|
7217
7412
|
},
|
|
7218
7413
|
[syncSelection]
|
|
7219
7414
|
);
|
|
7220
|
-
|
|
7415
|
+
React57.useEffect(() => {
|
|
7221
7416
|
const target = pendingSelectionRef.current;
|
|
7222
7417
|
if (!target) return;
|
|
7223
7418
|
const ta = textareaRef.current;
|
|
@@ -7227,7 +7422,7 @@ function useMarkdownToolbar({ text, isSelected, commitText, trackSelection }) {
|
|
|
7227
7422
|
syncSelection(target.start, target.end);
|
|
7228
7423
|
pendingSelectionRef.current = null;
|
|
7229
7424
|
}, [text, syncSelection]);
|
|
7230
|
-
|
|
7425
|
+
React57.useEffect(() => {
|
|
7231
7426
|
if (!isSelected || selection.start === selection.end) {
|
|
7232
7427
|
setLinkPrompt(false);
|
|
7233
7428
|
}
|
|
@@ -7320,9 +7515,9 @@ function InlineFormattingToolbar({
|
|
|
7320
7515
|
onLinkSubmit,
|
|
7321
7516
|
onLinkCancel
|
|
7322
7517
|
}) {
|
|
7323
|
-
const [url, setUrl] =
|
|
7324
|
-
const inputRef =
|
|
7325
|
-
|
|
7518
|
+
const [url, setUrl] = React57.useState("");
|
|
7519
|
+
const inputRef = React57.useRef(null);
|
|
7520
|
+
React57.useEffect(() => {
|
|
7326
7521
|
if (linkPrompt) {
|
|
7327
7522
|
setUrl("");
|
|
7328
7523
|
setTimeout(() => {
|
|
@@ -7332,7 +7527,7 @@ function InlineFormattingToolbar({
|
|
|
7332
7527
|
}
|
|
7333
7528
|
}, [linkPrompt]);
|
|
7334
7529
|
const preventBlur = (e) => e.preventDefault();
|
|
7335
|
-
return /* @__PURE__ */
|
|
7530
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Popper, { open: visible, anchorEl, placement: "top-start", style: { zIndex: 1300 } }, /* @__PURE__ */ React57__default.default.createElement(material.Paper, { elevation: 4, sx: { px: 0.5, py: 0.25, mb: 0.5 }, onMouseDown: preventBlur }, linkPrompt ? /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", alignItems: "center", spacing: 0.5, sx: { px: 0.5 } }, /* @__PURE__ */ React57__default.default.createElement(
|
|
7336
7531
|
material.TextField,
|
|
7337
7532
|
{
|
|
7338
7533
|
inputRef,
|
|
@@ -7354,7 +7549,7 @@ function InlineFormattingToolbar({
|
|
|
7354
7549
|
},
|
|
7355
7550
|
sx: { width: 220 }
|
|
7356
7551
|
}
|
|
7357
|
-
)) : /* @__PURE__ */
|
|
7552
|
+
)) : /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 0.25 }, /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { size: "small", onClick: onBold, title: t("toolbar.bold-shortcut", "Bold (Cmd+B)"), "aria-label": t("toolbar.bold", "Bold") }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FormatBoldOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { size: "small", onClick: onItalic, title: t("toolbar.italic-shortcut", "Italic (Cmd+I)"), "aria-label": t("toolbar.italic", "Italic") }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FormatItalicOutlined, { fontSize: "small" })), /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { size: "small", onClick: onLinkRequest, title: t("toolbar.link-shortcut", "Link (Cmd+K)"), "aria-label": t("toolbar.link", "Link") }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.LinkOutlined, { fontSize: "small" })))));
|
|
7358
7553
|
}
|
|
7359
7554
|
|
|
7360
7555
|
// src/editor/blocks/heading/heading-editor.tsx
|
|
@@ -7427,11 +7622,11 @@ function HeadingEditor({ style, props }) {
|
|
|
7427
7622
|
const isSelected = selectedBlockId === blockId;
|
|
7428
7623
|
const level = (_a = props == null ? void 0 : props.level) != null ? _a : HeadingPropsDefaults.level;
|
|
7429
7624
|
const textContent = (_b = props == null ? void 0 : props.text) != null ? _b : HeadingPropsDefaults.text;
|
|
7430
|
-
const [localText, setLocalText] =
|
|
7625
|
+
const [localText, setLocalText] = React57.useState(textContent);
|
|
7431
7626
|
const isMarkdown = (_c = props == null ? void 0 : props.markdown) != null ? _c : false;
|
|
7432
7627
|
const rootBlock = document2.root;
|
|
7433
7628
|
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily9(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
7434
|
-
|
|
7629
|
+
React57.useEffect(() => {
|
|
7435
7630
|
setLocalText(textContent);
|
|
7436
7631
|
}, [textContent]);
|
|
7437
7632
|
const fontFamily = getFontFamily9(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
@@ -7477,9 +7672,9 @@ function HeadingEditor({ style, props }) {
|
|
|
7477
7672
|
const handleTextChange = (e) => {
|
|
7478
7673
|
commitText(e.target.value);
|
|
7479
7674
|
};
|
|
7480
|
-
const displayRef =
|
|
7481
|
-
const lastDisplayHeightRef =
|
|
7482
|
-
|
|
7675
|
+
const displayRef = React57.useRef(null);
|
|
7676
|
+
const lastDisplayHeightRef = React57.useRef(0);
|
|
7677
|
+
React57.useLayoutEffect(() => {
|
|
7483
7678
|
if (!isSelected && displayRef.current) {
|
|
7484
7679
|
const h = displayRef.current.offsetHeight;
|
|
7485
7680
|
if (h > 0) lastDisplayHeightRef.current = h;
|
|
@@ -7505,11 +7700,11 @@ function HeadingEditor({ style, props }) {
|
|
|
7505
7700
|
});
|
|
7506
7701
|
}
|
|
7507
7702
|
});
|
|
7508
|
-
|
|
7703
|
+
React57.useLayoutEffect(() => {
|
|
7509
7704
|
if (textareaRef.current) adjustTextareaHeight(textareaRef.current);
|
|
7510
7705
|
}, [localText, isSelected]);
|
|
7511
7706
|
if (isSelected) {
|
|
7512
|
-
return /* @__PURE__ */
|
|
7707
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
7513
7708
|
"textarea",
|
|
7514
7709
|
{
|
|
7515
7710
|
ref: textareaRef,
|
|
@@ -7527,7 +7722,7 @@ function HeadingEditor({ style, props }) {
|
|
|
7527
7722
|
rows: 1,
|
|
7528
7723
|
onInput: (e) => adjustTextareaHeight(e.target)
|
|
7529
7724
|
}
|
|
7530
|
-
), /* @__PURE__ */
|
|
7725
|
+
), /* @__PURE__ */ React57__default.default.createElement(InlineFormattingToolbar, __spreadValues({ anchorEl: textareaRef.current }, toolbarProps)));
|
|
7531
7726
|
}
|
|
7532
7727
|
const headingProps = isMarkdown ? {
|
|
7533
7728
|
ref: displayRef,
|
|
@@ -7536,11 +7731,11 @@ function HeadingEditor({ style, props }) {
|
|
|
7536
7731
|
} : { ref: displayRef, style: hStyle, children: textContent };
|
|
7537
7732
|
switch (level) {
|
|
7538
7733
|
case "h1":
|
|
7539
|
-
return /* @__PURE__ */
|
|
7734
|
+
return /* @__PURE__ */ React57__default.default.createElement("h1", __spreadValues({}, headingProps));
|
|
7540
7735
|
case "h2":
|
|
7541
|
-
return /* @__PURE__ */
|
|
7736
|
+
return /* @__PURE__ */ React57__default.default.createElement("h2", __spreadValues({}, headingProps));
|
|
7542
7737
|
case "h3":
|
|
7543
|
-
return /* @__PURE__ */
|
|
7738
|
+
return /* @__PURE__ */ React57__default.default.createElement("h3", __spreadValues({}, headingProps));
|
|
7544
7739
|
}
|
|
7545
7740
|
}
|
|
7546
7741
|
function HtmlEditor({ style, props }) {
|
|
@@ -7549,8 +7744,8 @@ function HtmlEditor({ style, props }) {
|
|
|
7549
7744
|
const selectedBlockId = useSelectedBlockId();
|
|
7550
7745
|
const isSelected = selectedBlockId === blockId;
|
|
7551
7746
|
const contents = (_a = props == null ? void 0 : props.contents) != null ? _a : "";
|
|
7552
|
-
const [localContents, setLocalContents] =
|
|
7553
|
-
|
|
7747
|
+
const [localContents, setLocalContents] = React57.useState(contents);
|
|
7748
|
+
React57.useEffect(() => {
|
|
7554
7749
|
setLocalContents(contents);
|
|
7555
7750
|
}, [contents]);
|
|
7556
7751
|
const cssStyle = {
|
|
@@ -7605,7 +7800,7 @@ function HtmlEditor({ style, props }) {
|
|
|
7605
7800
|
selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
|
|
7606
7801
|
});
|
|
7607
7802
|
};
|
|
7608
|
-
return /* @__PURE__ */
|
|
7803
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: cssStyle }, /* @__PURE__ */ React57__default.default.createElement(
|
|
7609
7804
|
"textarea",
|
|
7610
7805
|
{
|
|
7611
7806
|
value: localContents,
|
|
@@ -7625,9 +7820,9 @@ function HtmlEditor({ style, props }) {
|
|
|
7625
7820
|
));
|
|
7626
7821
|
}
|
|
7627
7822
|
if (!contents) {
|
|
7628
|
-
return /* @__PURE__ */
|
|
7823
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: cssStyle });
|
|
7629
7824
|
}
|
|
7630
|
-
return /* @__PURE__ */
|
|
7825
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
|
|
7631
7826
|
}
|
|
7632
7827
|
function getImageBorderRadius2(shape, size) {
|
|
7633
7828
|
switch (shape) {
|
|
@@ -7660,36 +7855,36 @@ function SignatureEditor({ style, props }) {
|
|
|
7660
7855
|
const nameColor = (_m = props == null ? void 0 : props.nameColor) != null ? _m : SignaturePropsDefaults.nameColor;
|
|
7661
7856
|
const textColor = (_n = props == null ? void 0 : props.textColor) != null ? _n : SignaturePropsDefaults.textColor;
|
|
7662
7857
|
const linkColor = (_o = props == null ? void 0 : props.linkColor) != null ? _o : SignaturePropsDefaults.linkColor;
|
|
7663
|
-
const [localGreeting, setLocalGreeting] =
|
|
7664
|
-
const [localName, setLocalName] =
|
|
7665
|
-
const [localTitle, setLocalTitle] =
|
|
7666
|
-
const [localCompany, setLocalCompany] =
|
|
7667
|
-
const [localAddress, setLocalAddress] =
|
|
7668
|
-
const [localEmail, setLocalEmail] =
|
|
7669
|
-
const [localPhone, setLocalPhone] =
|
|
7670
|
-
const [localWebsite, setLocalWebsite] =
|
|
7671
|
-
|
|
7858
|
+
const [localGreeting, setLocalGreeting] = React57.useState(greeting);
|
|
7859
|
+
const [localName, setLocalName] = React57.useState(name);
|
|
7860
|
+
const [localTitle, setLocalTitle] = React57.useState(title);
|
|
7861
|
+
const [localCompany, setLocalCompany] = React57.useState(company);
|
|
7862
|
+
const [localAddress, setLocalAddress] = React57.useState(address);
|
|
7863
|
+
const [localEmail, setLocalEmail] = React57.useState(email);
|
|
7864
|
+
const [localPhone, setLocalPhone] = React57.useState(phone);
|
|
7865
|
+
const [localWebsite, setLocalWebsite] = React57.useState(website);
|
|
7866
|
+
React57.useEffect(() => {
|
|
7672
7867
|
setLocalGreeting(greeting);
|
|
7673
7868
|
}, [greeting]);
|
|
7674
|
-
|
|
7869
|
+
React57.useEffect(() => {
|
|
7675
7870
|
setLocalName(name);
|
|
7676
7871
|
}, [name]);
|
|
7677
|
-
|
|
7872
|
+
React57.useEffect(() => {
|
|
7678
7873
|
setLocalTitle(title);
|
|
7679
7874
|
}, [title]);
|
|
7680
|
-
|
|
7875
|
+
React57.useEffect(() => {
|
|
7681
7876
|
setLocalCompany(company);
|
|
7682
7877
|
}, [company]);
|
|
7683
|
-
|
|
7878
|
+
React57.useEffect(() => {
|
|
7684
7879
|
setLocalAddress(address);
|
|
7685
7880
|
}, [address]);
|
|
7686
|
-
|
|
7881
|
+
React57.useEffect(() => {
|
|
7687
7882
|
setLocalEmail(email);
|
|
7688
7883
|
}, [email]);
|
|
7689
|
-
|
|
7884
|
+
React57.useEffect(() => {
|
|
7690
7885
|
setLocalPhone(phone);
|
|
7691
7886
|
}, [phone]);
|
|
7692
|
-
|
|
7887
|
+
React57.useEffect(() => {
|
|
7693
7888
|
setLocalWebsite(website);
|
|
7694
7889
|
}, [website]);
|
|
7695
7890
|
const updateProps = (updates) => {
|
|
@@ -7742,7 +7937,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7742
7937
|
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
7743
7938
|
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
|
|
7744
7939
|
};
|
|
7745
|
-
const imageElement = imageUrl ? /* @__PURE__ */
|
|
7940
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React57__default.default.createElement(
|
|
7746
7941
|
"img",
|
|
7747
7942
|
{
|
|
7748
7943
|
src: imageUrl,
|
|
@@ -7760,7 +7955,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7760
7955
|
}
|
|
7761
7956
|
}
|
|
7762
7957
|
) : null;
|
|
7763
|
-
const greetingElement = isSelected ? /* @__PURE__ */
|
|
7958
|
+
const greetingElement = isSelected ? /* @__PURE__ */ React57__default.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React57__default.default.createElement(
|
|
7764
7959
|
"input",
|
|
7765
7960
|
{
|
|
7766
7961
|
value: localGreeting,
|
|
@@ -7771,8 +7966,8 @@ function SignatureEditor({ style, props }) {
|
|
|
7771
7966
|
placeholder: "Greeting (e.g. Best regards,)",
|
|
7772
7967
|
style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
|
|
7773
7968
|
}
|
|
7774
|
-
)) : greeting ? /* @__PURE__ */
|
|
7775
|
-
const textContent = isSelected ? /* @__PURE__ */
|
|
7969
|
+
)) : greeting ? /* @__PURE__ */ React57__default.default.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
7970
|
+
const textContent = isSelected ? /* @__PURE__ */ React57__default.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React57__default.default.createElement(
|
|
7776
7971
|
"input",
|
|
7777
7972
|
{
|
|
7778
7973
|
value: localName,
|
|
@@ -7783,7 +7978,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7783
7978
|
placeholder: "Name",
|
|
7784
7979
|
style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
|
|
7785
7980
|
}
|
|
7786
|
-
), /* @__PURE__ */
|
|
7981
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
7787
7982
|
"input",
|
|
7788
7983
|
{
|
|
7789
7984
|
value: localTitle,
|
|
@@ -7794,7 +7989,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7794
7989
|
placeholder: "Title",
|
|
7795
7990
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
7796
7991
|
}
|
|
7797
|
-
), /* @__PURE__ */
|
|
7992
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
7798
7993
|
"input",
|
|
7799
7994
|
{
|
|
7800
7995
|
value: localCompany,
|
|
@@ -7805,7 +8000,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7805
8000
|
placeholder: "Company",
|
|
7806
8001
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
7807
8002
|
}
|
|
7808
|
-
), /* @__PURE__ */
|
|
8003
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
7809
8004
|
"input",
|
|
7810
8005
|
{
|
|
7811
8006
|
value: localAddress,
|
|
@@ -7816,7 +8011,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7816
8011
|
placeholder: "Address",
|
|
7817
8012
|
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
7818
8013
|
}
|
|
7819
|
-
), /* @__PURE__ */
|
|
8014
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
7820
8015
|
"input",
|
|
7821
8016
|
{
|
|
7822
8017
|
value: localEmail,
|
|
@@ -7827,7 +8022,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7827
8022
|
placeholder: "Email",
|
|
7828
8023
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
|
|
7829
8024
|
}
|
|
7830
|
-
), /* @__PURE__ */
|
|
8025
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
7831
8026
|
"input",
|
|
7832
8027
|
{
|
|
7833
8028
|
value: localPhone,
|
|
@@ -7838,7 +8033,7 @@ function SignatureEditor({ style, props }) {
|
|
|
7838
8033
|
placeholder: "Phone",
|
|
7839
8034
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
7840
8035
|
}
|
|
7841
|
-
), /* @__PURE__ */
|
|
8036
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
7842
8037
|
"input",
|
|
7843
8038
|
{
|
|
7844
8039
|
value: localWebsite,
|
|
@@ -7849,11 +8044,11 @@ function SignatureEditor({ style, props }) {
|
|
|
7849
8044
|
placeholder: "Website",
|
|
7850
8045
|
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
7851
8046
|
}
|
|
7852
|
-
)) : /* @__PURE__ */
|
|
8047
|
+
)) : /* @__PURE__ */ React57__default.default.createElement("div", null, name && /* @__PURE__ */ React57__default.default.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React57__default.default.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React57__default.default.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React57__default.default.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React57__default.default.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React57__default.default.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React57__default.default.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React57__default.default.createElement("p", { style: detailStyle }, "Click to edit signature"));
|
|
7853
8048
|
if (layout === "vertical") {
|
|
7854
|
-
return /* @__PURE__ */
|
|
8049
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React57__default.default.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
7855
8050
|
}
|
|
7856
|
-
return /* @__PURE__ */
|
|
8051
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React57__default.default.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React57__default.default.createElement("tbody", null, /* @__PURE__ */ React57__default.default.createElement("tr", null, imageElement && /* @__PURE__ */ React57__default.default.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React57__default.default.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
7857
8052
|
}
|
|
7858
8053
|
function getFontFamily10(fontFamily) {
|
|
7859
8054
|
switch (fontFamily) {
|
|
@@ -7913,11 +8108,11 @@ function TextEditor({ style, props }) {
|
|
|
7913
8108
|
const document2 = useDocument();
|
|
7914
8109
|
const isSelected = selectedBlockId === blockId;
|
|
7915
8110
|
const textContent = (_a = props == null ? void 0 : props.text) != null ? _a : TextPropsDefaults.text;
|
|
7916
|
-
const [localText, setLocalText] =
|
|
8111
|
+
const [localText, setLocalText] = React57.useState(textContent);
|
|
7917
8112
|
const isMarkdown = (_b = props == null ? void 0 : props.markdown) != null ? _b : false;
|
|
7918
8113
|
const rootBlock = document2.root;
|
|
7919
8114
|
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily10(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
7920
|
-
|
|
8115
|
+
React57.useEffect(() => {
|
|
7921
8116
|
setLocalText(textContent);
|
|
7922
8117
|
}, [textContent]);
|
|
7923
8118
|
const fontFamily = getFontFamily10(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
@@ -7965,9 +8160,9 @@ function TextEditor({ style, props }) {
|
|
|
7965
8160
|
const handleTextChange = (e) => {
|
|
7966
8161
|
commitText(e.target.value);
|
|
7967
8162
|
};
|
|
7968
|
-
const displayRef =
|
|
7969
|
-
const lastDisplayHeightRef =
|
|
7970
|
-
|
|
8163
|
+
const displayRef = React57.useRef(null);
|
|
8164
|
+
const lastDisplayHeightRef = React57.useRef(0);
|
|
8165
|
+
React57.useLayoutEffect(() => {
|
|
7971
8166
|
if (!isSelected && displayRef.current) {
|
|
7972
8167
|
const h = displayRef.current.offsetHeight;
|
|
7973
8168
|
if (h > 0) lastDisplayHeightRef.current = h;
|
|
@@ -7993,11 +8188,11 @@ function TextEditor({ style, props }) {
|
|
|
7993
8188
|
});
|
|
7994
8189
|
}
|
|
7995
8190
|
});
|
|
7996
|
-
|
|
8191
|
+
React57.useLayoutEffect(() => {
|
|
7997
8192
|
if (textareaRef.current) adjustTextareaHeight(textareaRef.current);
|
|
7998
8193
|
}, [localText, isSelected]);
|
|
7999
8194
|
if (isSelected) {
|
|
8000
|
-
return /* @__PURE__ */
|
|
8195
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
8001
8196
|
"textarea",
|
|
8002
8197
|
{
|
|
8003
8198
|
ref: textareaRef,
|
|
@@ -8015,10 +8210,10 @@ function TextEditor({ style, props }) {
|
|
|
8015
8210
|
rows: 1,
|
|
8016
8211
|
onInput: (e) => adjustTextareaHeight(e.target)
|
|
8017
8212
|
}
|
|
8018
|
-
), /* @__PURE__ */
|
|
8213
|
+
), /* @__PURE__ */ React57__default.default.createElement(InlineFormattingToolbar, __spreadValues({ anchorEl: textareaRef.current }, toolbarProps)));
|
|
8019
8214
|
}
|
|
8020
8215
|
if (isMarkdown) {
|
|
8021
|
-
return /* @__PURE__ */
|
|
8216
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
8022
8217
|
"div",
|
|
8023
8218
|
{
|
|
8024
8219
|
ref: displayRef,
|
|
@@ -8027,34 +8222,34 @@ function TextEditor({ style, props }) {
|
|
|
8027
8222
|
}
|
|
8028
8223
|
);
|
|
8029
8224
|
}
|
|
8030
|
-
return /* @__PURE__ */
|
|
8225
|
+
return /* @__PURE__ */ React57__default.default.createElement("div", { ref: displayRef, style: wStyle }, textContent);
|
|
8031
8226
|
}
|
|
8032
8227
|
|
|
8033
8228
|
// src/editor/core.tsx
|
|
8034
8229
|
var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
8035
8230
|
Avatar: {
|
|
8036
8231
|
schema: AvatarPropsSchema,
|
|
8037
|
-
Component: (props) => /* @__PURE__ */
|
|
8232
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(avatar_default, __spreadValues({}, props)))
|
|
8038
8233
|
},
|
|
8039
8234
|
Button: {
|
|
8040
8235
|
schema: ButtonPropsSchema,
|
|
8041
|
-
Component: (props) => /* @__PURE__ */
|
|
8236
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(ButtonEditor, __spreadValues({}, props)))
|
|
8042
8237
|
},
|
|
8043
8238
|
Container: {
|
|
8044
8239
|
schema: container_props_schema_default,
|
|
8045
|
-
Component: (props) => /* @__PURE__ */
|
|
8240
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(ContainerEditor, __spreadValues({}, props)))
|
|
8046
8241
|
},
|
|
8047
8242
|
ColumnsContainer: {
|
|
8048
8243
|
schema: columns_container_props_schema_default2,
|
|
8049
|
-
Component: (props) => /* @__PURE__ */
|
|
8244
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
|
|
8050
8245
|
},
|
|
8051
8246
|
Heading: {
|
|
8052
8247
|
schema: HeadingPropsSchema,
|
|
8053
|
-
Component: (props) => /* @__PURE__ */
|
|
8248
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(HeadingEditor, __spreadValues({}, props)))
|
|
8054
8249
|
},
|
|
8055
8250
|
Html: {
|
|
8056
8251
|
schema: HtmlPropsSchema,
|
|
8057
|
-
Component: (props) => /* @__PURE__ */
|
|
8252
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(HtmlEditor, __spreadValues({}, props)))
|
|
8058
8253
|
},
|
|
8059
8254
|
Image: {
|
|
8060
8255
|
schema: ImagePropsSchema,
|
|
@@ -8066,28 +8261,28 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
8066
8261
|
linkHref: null
|
|
8067
8262
|
})
|
|
8068
8263
|
});
|
|
8069
|
-
return /* @__PURE__ */
|
|
8264
|
+
return /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(image_default, __spreadValues({}, props)));
|
|
8070
8265
|
}
|
|
8071
8266
|
},
|
|
8072
8267
|
Text: {
|
|
8073
8268
|
schema: TextPropsSchema,
|
|
8074
|
-
Component: (props) => /* @__PURE__ */
|
|
8269
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(TextEditor, __spreadValues({}, props)))
|
|
8075
8270
|
},
|
|
8076
8271
|
EmailLayout: {
|
|
8077
8272
|
schema: email_layout_props_schema_default,
|
|
8078
|
-
Component: (p) => /* @__PURE__ */
|
|
8273
|
+
Component: (p) => /* @__PURE__ */ React57__default.default.createElement(EmailLayoutEditor, __spreadValues({}, p))
|
|
8079
8274
|
},
|
|
8080
8275
|
Spacer: {
|
|
8081
8276
|
schema: SpacerPropsSchema,
|
|
8082
|
-
Component: (props) => /* @__PURE__ */
|
|
8277
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(spacer_default, __spreadValues({}, props)))
|
|
8083
8278
|
},
|
|
8084
8279
|
Divider: {
|
|
8085
8280
|
schema: DividerPropsSchema,
|
|
8086
|
-
Component: (props) => /* @__PURE__ */
|
|
8281
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(divider_default, __spreadValues({}, props)))
|
|
8087
8282
|
},
|
|
8088
8283
|
Signature: {
|
|
8089
8284
|
schema: SignaturePropsSchema,
|
|
8090
|
-
Component: (props) => /* @__PURE__ */
|
|
8285
|
+
Component: (props) => /* @__PURE__ */ React57__default.default.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React57__default.default.createElement(SignatureEditor, __spreadValues({}, props)))
|
|
8091
8286
|
}
|
|
8092
8287
|
});
|
|
8093
8288
|
var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
|
|
@@ -8095,15 +8290,15 @@ var EditorBlockSchema = buildBlockConfigurationSchema(EDITOR_DICTIONARY);
|
|
|
8095
8290
|
zod.z.record(zod.z.string(), EditorBlockSchema);
|
|
8096
8291
|
|
|
8097
8292
|
// src/editor/editor-block.tsx
|
|
8098
|
-
var EditorBlockContext =
|
|
8099
|
-
var useCurrentBlockId = () =>
|
|
8293
|
+
var EditorBlockContext = React57.createContext(null);
|
|
8294
|
+
var useCurrentBlockId = () => React57.useContext(EditorBlockContext);
|
|
8100
8295
|
function EditorBlock({ id }) {
|
|
8101
8296
|
const document2 = useDocument();
|
|
8102
8297
|
const block = document2[id];
|
|
8103
8298
|
if (!block) {
|
|
8104
8299
|
throw new Error("Could not find block");
|
|
8105
8300
|
}
|
|
8106
|
-
return /* @__PURE__ */
|
|
8301
|
+
return /* @__PURE__ */ React57__default.default.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React57__default.default.createElement(EditorBlock2, __spreadValues({}, block)));
|
|
8107
8302
|
}
|
|
8108
8303
|
function ToggleInspectorPanelButton() {
|
|
8109
8304
|
const inspectorDrawerOpen = useInspectorDrawerOpen();
|
|
@@ -8111,20 +8306,20 @@ function ToggleInspectorPanelButton() {
|
|
|
8111
8306
|
toggleInspectorDrawerOpen();
|
|
8112
8307
|
};
|
|
8113
8308
|
if (inspectorDrawerOpen) {
|
|
8114
|
-
return /* @__PURE__ */
|
|
8309
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { onClick: handleClick }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.LastPageOutlined, { fontSize: "small" }));
|
|
8115
8310
|
}
|
|
8116
|
-
return /* @__PURE__ */
|
|
8311
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { onClick: handleClick }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AppRegistrationOutlined, { fontSize: "small" }));
|
|
8117
8312
|
}
|
|
8118
8313
|
function useIcon() {
|
|
8119
8314
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
8120
8315
|
if (samplesDrawerOpen) {
|
|
8121
|
-
return /* @__PURE__ */
|
|
8316
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.FirstPageOutlined, { fontSize: "small" });
|
|
8122
8317
|
}
|
|
8123
|
-
return /* @__PURE__ */
|
|
8318
|
+
return /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.MenuOutlined, { fontSize: "small" });
|
|
8124
8319
|
}
|
|
8125
8320
|
function ToggleSamplesPanelButton() {
|
|
8126
8321
|
const icon = useIcon();
|
|
8127
|
-
return /* @__PURE__ */
|
|
8322
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
|
|
8128
8323
|
}
|
|
8129
8324
|
function formatHtml(html2, spaces = 2) {
|
|
8130
8325
|
try {
|
|
@@ -8172,8 +8367,8 @@ function json(value) {
|
|
|
8172
8367
|
|
|
8173
8368
|
// src/app/email-canvas/helper/highlighted-code-panel.tsx
|
|
8174
8369
|
function HighlightedCodePanel({ type, value }) {
|
|
8175
|
-
const [code, setCode] =
|
|
8176
|
-
|
|
8370
|
+
const [code, setCode] = React57.useState(null);
|
|
8371
|
+
React57.useEffect(() => {
|
|
8177
8372
|
switch (type) {
|
|
8178
8373
|
case "html":
|
|
8179
8374
|
html(value).then(setCode);
|
|
@@ -8186,7 +8381,7 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
8186
8381
|
if (code === null) {
|
|
8187
8382
|
return null;
|
|
8188
8383
|
}
|
|
8189
|
-
return /* @__PURE__ */
|
|
8384
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
8190
8385
|
"pre",
|
|
8191
8386
|
{
|
|
8192
8387
|
style: {
|
|
@@ -8211,18 +8406,18 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
8211
8406
|
// src/app/email-canvas/html-panel.tsx
|
|
8212
8407
|
function HtmlPanel() {
|
|
8213
8408
|
const document2 = useDocument();
|
|
8214
|
-
const code =
|
|
8215
|
-
return /* @__PURE__ */
|
|
8409
|
+
const code = React57.useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
|
|
8410
|
+
return /* @__PURE__ */ React57__default.default.createElement(HighlightedCodePanel, { type: "html", value: code });
|
|
8216
8411
|
}
|
|
8217
8412
|
function JsonPanel() {
|
|
8218
8413
|
const document2 = useDocument();
|
|
8219
|
-
const code =
|
|
8220
|
-
return /* @__PURE__ */
|
|
8414
|
+
const code = React57.useMemo(() => JSON.stringify(document2, null, " "), [document2]);
|
|
8415
|
+
return /* @__PURE__ */ React57__default.default.createElement(HighlightedCodePanel, { type: "json", value: code });
|
|
8221
8416
|
}
|
|
8222
8417
|
function TextPanel() {
|
|
8223
8418
|
const document2 = useDocument();
|
|
8224
|
-
const text =
|
|
8225
|
-
return /* @__PURE__ */
|
|
8419
|
+
const text = React57.useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
|
|
8420
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
8226
8421
|
"pre",
|
|
8227
8422
|
{
|
|
8228
8423
|
style: {
|
|
@@ -8258,35 +8453,35 @@ function MainTabsGroup() {
|
|
|
8258
8453
|
setSelectedMainTab("editor");
|
|
8259
8454
|
}
|
|
8260
8455
|
};
|
|
8261
|
-
return /* @__PURE__ */
|
|
8456
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8262
8457
|
material.Tab,
|
|
8263
8458
|
{
|
|
8264
8459
|
value: "editor",
|
|
8265
|
-
label: /* @__PURE__ */
|
|
8460
|
+
label: /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Edit" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.EditOutlined, { fontSize: "small" }))
|
|
8266
8461
|
}
|
|
8267
|
-
), /* @__PURE__ */
|
|
8462
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8268
8463
|
material.Tab,
|
|
8269
8464
|
{
|
|
8270
8465
|
value: "preview",
|
|
8271
|
-
label: /* @__PURE__ */
|
|
8466
|
+
label: /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Preview" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.PreviewOutlined, { fontSize: "small" }))
|
|
8272
8467
|
}
|
|
8273
|
-
), /* @__PURE__ */
|
|
8468
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8274
8469
|
material.Tab,
|
|
8275
8470
|
{
|
|
8276
8471
|
value: "html",
|
|
8277
|
-
label: /* @__PURE__ */
|
|
8472
|
+
label: /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "HTML output" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.CodeOutlined, { fontSize: "small" }))
|
|
8278
8473
|
}
|
|
8279
|
-
), /* @__PURE__ */
|
|
8474
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8280
8475
|
material.Tab,
|
|
8281
8476
|
{
|
|
8282
8477
|
value: "text",
|
|
8283
|
-
label: /* @__PURE__ */
|
|
8478
|
+
label: /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SubjectOutlined, { fontSize: "small" }))
|
|
8284
8479
|
}
|
|
8285
|
-
), /* @__PURE__ */
|
|
8480
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8286
8481
|
material.Tab,
|
|
8287
8482
|
{
|
|
8288
8483
|
value: "json",
|
|
8289
|
-
label: /* @__PURE__ */
|
|
8484
|
+
label: /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "JSON output" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.DataObjectOutlined, { fontSize: "small" }))
|
|
8290
8485
|
}
|
|
8291
8486
|
));
|
|
8292
8487
|
}
|
|
@@ -8301,11 +8496,11 @@ function SaveBar({ loadTemplates, saveAs }) {
|
|
|
8301
8496
|
} = useEmailEditor();
|
|
8302
8497
|
const { showMessage } = useSnackbar();
|
|
8303
8498
|
const document2 = useDocument();
|
|
8304
|
-
const [dialogMode, setDialogMode] =
|
|
8305
|
-
const [nameError, setNameError] =
|
|
8499
|
+
const [dialogMode, setDialogMode] = React57.useState(null);
|
|
8500
|
+
const [nameError, setNameError] = React57.useState(null);
|
|
8306
8501
|
const hasOpenRow = Boolean(currentTemplateId);
|
|
8307
8502
|
const isSample = currentTemplateKind === "sample";
|
|
8308
|
-
const primaryLabel = hasOpenRow ? "Save" : "Save as new\u2026";
|
|
8503
|
+
const primaryLabel = hasOpenRow ? t("savebar.save", "Save") : t("savebar.save-as-new", "Save as new\u2026");
|
|
8309
8504
|
const handlePrimary = () => __async(null, null, function* () {
|
|
8310
8505
|
try {
|
|
8311
8506
|
if (!hasOpenRow) {
|
|
@@ -8314,11 +8509,11 @@ function SaveBar({ loadTemplates, saveAs }) {
|
|
|
8314
8509
|
return;
|
|
8315
8510
|
}
|
|
8316
8511
|
saveTemplate();
|
|
8317
|
-
showMessage(isSample ? "Sample saved" : "Template saved");
|
|
8512
|
+
showMessage(isSample ? t("savebar.sample-saved", "Sample saved") : t("savebar.template-saved", "Template saved"));
|
|
8318
8513
|
if (loadTemplates) yield loadTemplates();
|
|
8319
8514
|
} catch (e) {
|
|
8320
8515
|
console.error("Error saving:", e);
|
|
8321
|
-
showMessage("Error saving");
|
|
8516
|
+
showMessage(t("savebar.error-saving", "Error saving"));
|
|
8322
8517
|
}
|
|
8323
8518
|
});
|
|
8324
8519
|
const handleSaveAs = (name) => __async(null, null, function* () {
|
|
@@ -8330,16 +8525,18 @@ function SaveBar({ loadTemplates, saveAs }) {
|
|
|
8330
8525
|
setCurrentTemplate(id, slug, "template");
|
|
8331
8526
|
ctxLoadTemplate(starterContent, id, slug, "template");
|
|
8332
8527
|
if (loadTemplates) yield loadTemplates();
|
|
8333
|
-
showMessage(
|
|
8528
|
+
showMessage(
|
|
8529
|
+
dialogMode === "new-blank" ? t("savebar.new-template-created", "New template created") : t("savebar.template-saved", "Template saved")
|
|
8530
|
+
);
|
|
8334
8531
|
window.location.hash = `#template/${id}`;
|
|
8335
8532
|
return true;
|
|
8336
8533
|
} catch (e) {
|
|
8337
8534
|
console.error("Error in saveAs:", e);
|
|
8338
|
-
showMessage("Error saving");
|
|
8535
|
+
showMessage(t("savebar.error-saving", "Error saving"));
|
|
8339
8536
|
return false;
|
|
8340
8537
|
}
|
|
8341
8538
|
});
|
|
8342
|
-
return /* @__PURE__ */
|
|
8539
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
8343
8540
|
material.Box,
|
|
8344
8541
|
{
|
|
8345
8542
|
sx: {
|
|
@@ -8352,7 +8549,7 @@ function SaveBar({ loadTemplates, saveAs }) {
|
|
|
8352
8549
|
pb: 3
|
|
8353
8550
|
}
|
|
8354
8551
|
},
|
|
8355
|
-
/* @__PURE__ */
|
|
8552
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
8356
8553
|
material.Box,
|
|
8357
8554
|
{
|
|
8358
8555
|
sx: {
|
|
@@ -8367,7 +8564,7 @@ function SaveBar({ loadTemplates, saveAs }) {
|
|
|
8367
8564
|
boxShadow: "0 2px 6px rgba(33, 36, 67, 0.06), 0 16px 40px rgba(33, 36, 67, 0.14)"
|
|
8368
8565
|
}
|
|
8369
8566
|
},
|
|
8370
|
-
hasOpenRow && currentTemplateName && /* @__PURE__ */
|
|
8567
|
+
hasOpenRow && currentTemplateName && /* @__PURE__ */ React57__default.default.createElement(
|
|
8371
8568
|
material.Box,
|
|
8372
8569
|
{
|
|
8373
8570
|
sx: {
|
|
@@ -8382,50 +8579,50 @@ function SaveBar({ loadTemplates, saveAs }) {
|
|
|
8382
8579
|
},
|
|
8383
8580
|
title: currentTemplateName
|
|
8384
8581
|
},
|
|
8385
|
-
isSample ? "Sample \xB7
|
|
8386
|
-
/* @__PURE__ */
|
|
8582
|
+
isSample ? `${t("savebar.sample-prefix", "Sample")} \xB7 ` : "",
|
|
8583
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { component: "span", sx: { color: "text.primary", fontWeight: 600 } }, currentTemplateName)
|
|
8387
8584
|
),
|
|
8388
|
-
/* @__PURE__ */
|
|
8585
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: hasOpenRow ? isSample ? t("savebar.save-changes-to-sample", "Save changes to this sample") : t("savebar.save-changes", "Save changes") : t("savebar.save-as-new-template", "Save as a new template") }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8389
8586
|
material.Button,
|
|
8390
8587
|
{
|
|
8391
8588
|
variant: "contained",
|
|
8392
8589
|
size: "large",
|
|
8393
|
-
startIcon: /* @__PURE__ */
|
|
8590
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SaveOutlined, null),
|
|
8394
8591
|
onClick: handlePrimary,
|
|
8395
8592
|
sx: { borderRadius: 999, textTransform: "none", px: 2.5, fontSize: 15, fontWeight: 600 }
|
|
8396
8593
|
},
|
|
8397
8594
|
primaryLabel
|
|
8398
8595
|
)),
|
|
8399
|
-
hasOpenRow && saveAs && /* @__PURE__ */
|
|
8596
|
+
hasOpenRow && saveAs && /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: t("savebar.save-as-new-template", "Save as a new template") }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8400
8597
|
material.Button,
|
|
8401
8598
|
{
|
|
8402
8599
|
variant: "outlined",
|
|
8403
8600
|
size: "large",
|
|
8404
|
-
startIcon: /* @__PURE__ */
|
|
8601
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.SaveAsOutlined, null),
|
|
8405
8602
|
onClick: () => {
|
|
8406
8603
|
setNameError(null);
|
|
8407
8604
|
setDialogMode("save-as");
|
|
8408
8605
|
},
|
|
8409
8606
|
sx: { borderRadius: 999, textTransform: "none", px: 2, fontSize: 14 }
|
|
8410
8607
|
},
|
|
8411
|
-
"Save as\u2026"
|
|
8608
|
+
t("savebar.save-as", "Save as\u2026")
|
|
8412
8609
|
)),
|
|
8413
|
-
saveAs && /* @__PURE__ */
|
|
8610
|
+
saveAs && /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: t("savebar.start-fresh", "Start a fresh template") }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8414
8611
|
material.Button,
|
|
8415
8612
|
{
|
|
8416
8613
|
variant: "text",
|
|
8417
8614
|
size: "large",
|
|
8418
|
-
startIcon: /* @__PURE__ */
|
|
8615
|
+
startIcon: /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.AddOutlined, null),
|
|
8419
8616
|
onClick: () => {
|
|
8420
8617
|
setNameError(null);
|
|
8421
8618
|
setDialogMode("new-blank");
|
|
8422
8619
|
},
|
|
8423
8620
|
sx: { borderRadius: 999, textTransform: "none", px: 2, fontSize: 14, color: "text.secondary" }
|
|
8424
8621
|
},
|
|
8425
|
-
"New"
|
|
8622
|
+
t("savebar.new", "New")
|
|
8426
8623
|
))
|
|
8427
8624
|
)
|
|
8428
|
-
), /* @__PURE__ */
|
|
8625
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8429
8626
|
SaveTemplateDialog,
|
|
8430
8627
|
{
|
|
8431
8628
|
open: dialogMode !== null,
|
|
@@ -8463,7 +8660,7 @@ function SubjectInput() {
|
|
|
8463
8660
|
selectionEnd: (_b = target.selectionEnd) != null ? _b : target.value.length
|
|
8464
8661
|
});
|
|
8465
8662
|
};
|
|
8466
|
-
return /* @__PURE__ */
|
|
8663
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
8467
8664
|
material.Box,
|
|
8468
8665
|
{
|
|
8469
8666
|
sx: {
|
|
@@ -8480,8 +8677,8 @@ function SubjectInput() {
|
|
|
8480
8677
|
gap: 1.5
|
|
8481
8678
|
}
|
|
8482
8679
|
},
|
|
8483
|
-
/* @__PURE__ */
|
|
8484
|
-
/* @__PURE__ */
|
|
8680
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
|
|
8681
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
8485
8682
|
material.InputBase,
|
|
8486
8683
|
{
|
|
8487
8684
|
fullWidth: true,
|
|
@@ -8507,7 +8704,7 @@ function SubjectPreview() {
|
|
|
8507
8704
|
if (!subject) return null;
|
|
8508
8705
|
const samples = buildSampleValueMap((_b = data.variables) != null ? _b : []);
|
|
8509
8706
|
const rendered = substituteSampleValues(subject, samples);
|
|
8510
|
-
return /* @__PURE__ */
|
|
8707
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
8511
8708
|
material.Box,
|
|
8512
8709
|
{
|
|
8513
8710
|
sx: {
|
|
@@ -8524,8 +8721,8 @@ function SubjectPreview() {
|
|
|
8524
8721
|
gap: 1.5
|
|
8525
8722
|
}
|
|
8526
8723
|
},
|
|
8527
|
-
/* @__PURE__ */
|
|
8528
|
-
/* @__PURE__ */
|
|
8724
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
|
|
8725
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { fontSize: 14 } }, rendered)
|
|
8529
8726
|
);
|
|
8530
8727
|
}
|
|
8531
8728
|
function generateId3() {
|
|
@@ -8572,12 +8769,12 @@ function findImageFile(items) {
|
|
|
8572
8769
|
}
|
|
8573
8770
|
function ImageDropPasteHandler({ enabled, children }) {
|
|
8574
8771
|
const { uploadImage } = useImageCallbacks();
|
|
8575
|
-
const wrapperRef =
|
|
8576
|
-
const dragDepth =
|
|
8577
|
-
const [dragging, setDragging] =
|
|
8578
|
-
const [uploading, setUploading] =
|
|
8772
|
+
const wrapperRef = React57.useRef(null);
|
|
8773
|
+
const dragDepth = React57.useRef(0);
|
|
8774
|
+
const [dragging, setDragging] = React57.useState(false);
|
|
8775
|
+
const [uploading, setUploading] = React57.useState(false);
|
|
8579
8776
|
const active = enabled && Boolean(uploadImage);
|
|
8580
|
-
|
|
8777
|
+
React57.useEffect(() => {
|
|
8581
8778
|
if (!active || !uploadImage) return;
|
|
8582
8779
|
const handlePaste = (e) => __async(null, null, function* () {
|
|
8583
8780
|
var _a;
|
|
@@ -8598,7 +8795,7 @@ function ImageDropPasteHandler({ enabled, children }) {
|
|
|
8598
8795
|
window.addEventListener("paste", handlePaste);
|
|
8599
8796
|
return () => window.removeEventListener("paste", handlePaste);
|
|
8600
8797
|
}, [active, uploadImage]);
|
|
8601
|
-
if (!active) return /* @__PURE__ */
|
|
8798
|
+
if (!active) return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, children);
|
|
8602
8799
|
const onDragEnter = (e) => {
|
|
8603
8800
|
var _a, _b;
|
|
8604
8801
|
if (!Array.from((_b = (_a = e.dataTransfer) == null ? void 0 : _a.items) != null ? _b : []).some((i) => i.kind === "file")) return;
|
|
@@ -8631,7 +8828,7 @@ function ImageDropPasteHandler({ enabled, children }) {
|
|
|
8631
8828
|
setUploading(false);
|
|
8632
8829
|
}
|
|
8633
8830
|
});
|
|
8634
|
-
return /* @__PURE__ */
|
|
8831
|
+
return /* @__PURE__ */ React57__default.default.createElement(
|
|
8635
8832
|
material.Box,
|
|
8636
8833
|
{
|
|
8637
8834
|
ref: wrapperRef,
|
|
@@ -8642,7 +8839,7 @@ function ImageDropPasteHandler({ enabled, children }) {
|
|
|
8642
8839
|
sx: { position: "relative" }
|
|
8643
8840
|
},
|
|
8644
8841
|
children,
|
|
8645
|
-
(dragging || uploading) && /* @__PURE__ */
|
|
8842
|
+
(dragging || uploading) && /* @__PURE__ */ React57__default.default.createElement(
|
|
8646
8843
|
material.Box,
|
|
8647
8844
|
{
|
|
8648
8845
|
sx: {
|
|
@@ -8661,7 +8858,7 @@ function ImageDropPasteHandler({ enabled, children }) {
|
|
|
8661
8858
|
zIndex: 10
|
|
8662
8859
|
}
|
|
8663
8860
|
},
|
|
8664
|
-
/* @__PURE__ */
|
|
8861
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontWeight: 600, fontSize: 14 } }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.CloudUploadOutlined, null), uploading ? "Uploading\u2026" : "Drop image to insert")
|
|
8665
8862
|
)
|
|
8666
8863
|
);
|
|
8667
8864
|
}
|
|
@@ -8701,7 +8898,7 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
8701
8898
|
var _a;
|
|
8702
8899
|
switch (selectedMainTab) {
|
|
8703
8900
|
case "editor":
|
|
8704
|
-
return /* @__PURE__ */
|
|
8901
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: mainBoxSx }, /* @__PURE__ */ React57__default.default.createElement(EditorBlock, { id: "root" }));
|
|
8705
8902
|
case "preview": {
|
|
8706
8903
|
const rootBlock = document2.root;
|
|
8707
8904
|
const layoutData = rootBlock && rootBlock.type === "EmailLayout" ? rootBlock.data : void 0;
|
|
@@ -8709,18 +8906,18 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
8709
8906
|
(_a = layoutData == null ? void 0 : layoutData.variables) != null ? _a : []
|
|
8710
8907
|
);
|
|
8711
8908
|
const previewDoc = applySampleValuesToDocument(document2, samples);
|
|
8712
|
-
return /* @__PURE__ */
|
|
8909
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: mainBoxSx }, /* @__PURE__ */ React57__default.default.createElement(Reader, { document: previewDoc, rootBlockId: "root" }));
|
|
8713
8910
|
}
|
|
8714
8911
|
case "html":
|
|
8715
|
-
return /* @__PURE__ */
|
|
8912
|
+
return /* @__PURE__ */ React57__default.default.createElement(HtmlPanel, null);
|
|
8716
8913
|
case "text":
|
|
8717
|
-
return /* @__PURE__ */
|
|
8914
|
+
return /* @__PURE__ */ React57__default.default.createElement(TextPanel, null);
|
|
8718
8915
|
case "json":
|
|
8719
|
-
return /* @__PURE__ */
|
|
8916
|
+
return /* @__PURE__ */ React57__default.default.createElement(JsonPanel, null);
|
|
8720
8917
|
}
|
|
8721
8918
|
};
|
|
8722
8919
|
const showSaveButtons = persistenceEnabled;
|
|
8723
|
-
return /* @__PURE__ */
|
|
8920
|
+
return /* @__PURE__ */ React57__default.default.createElement(React57__default.default.Fragment, null, /* @__PURE__ */ React57__default.default.createElement(
|
|
8724
8921
|
material.Stack,
|
|
8725
8922
|
{
|
|
8726
8923
|
sx: {
|
|
@@ -8737,10 +8934,10 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
8737
8934
|
justifyContent: "space-between",
|
|
8738
8935
|
alignItems: "center"
|
|
8739
8936
|
},
|
|
8740
|
-
samplesDrawerEnabled && /* @__PURE__ */
|
|
8741
|
-
/* @__PURE__ */
|
|
8742
|
-
/* @__PURE__ */
|
|
8743
|
-
), selectedMainTab === "editor" && /* @__PURE__ */
|
|
8937
|
+
samplesDrawerEnabled && /* @__PURE__ */ React57__default.default.createElement(ToggleSamplesPanelButton, null),
|
|
8938
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React57__default.default.createElement(MainTabsGroup, null)), /* @__PURE__ */ React57__default.default.createElement(material.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React57__default.default.createElement(material.ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "desktop" }, /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React57__default.default.createElement(material.ToggleButton, { value: "mobile" }, /* @__PURE__ */ React57__default.default.createElement(material.Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React57__default.default.createElement(iconsMaterial.PhoneIphoneOutlined, { fontSize: "small" })))))),
|
|
8939
|
+
/* @__PURE__ */ React57__default.default.createElement(ToggleInspectorPanelButton, null)
|
|
8940
|
+
), selectedMainTab === "editor" && /* @__PURE__ */ React57__default.default.createElement(SubjectInput, null), selectedMainTab === "preview" && /* @__PURE__ */ React57__default.default.createElement(SubjectPreview, null), /* @__PURE__ */ React57__default.default.createElement(ImageDropPasteHandler, { enabled: selectedMainTab === "editor" }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8744
8941
|
material.Box,
|
|
8745
8942
|
{
|
|
8746
8943
|
sx: {
|
|
@@ -8756,8 +8953,8 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
|
|
|
8756
8953
|
background: selectedMainTab === "editor" ? workspaceBackground === "checkerboard" ? WORKSPACE_CHECKERBOARD : WORKSPACE_SOLID : void 0
|
|
8757
8954
|
}
|
|
8758
8955
|
},
|
|
8759
|
-
/* @__PURE__ */
|
|
8760
|
-
showSaveButtons && selectedMainTab === "editor" && /* @__PURE__ */
|
|
8956
|
+
/* @__PURE__ */ React57__default.default.createElement(material.Box, { sx: { flexGrow: 1 } }, renderMainPanel()),
|
|
8957
|
+
showSaveButtons && selectedMainTab === "editor" && /* @__PURE__ */ React57__default.default.createElement(SaveBar, { loadTemplates, saveAs })
|
|
8761
8958
|
)));
|
|
8762
8959
|
}
|
|
8763
8960
|
|
|
@@ -8794,7 +8991,7 @@ function useDrawerTransition(cssProperty, open) {
|
|
|
8794
8991
|
duration: !open ? transitions.duration.leavingScreen : transitions.duration.enteringScreen
|
|
8795
8992
|
});
|
|
8796
8993
|
}
|
|
8797
|
-
var EmailEditorInternal =
|
|
8994
|
+
var EmailEditorInternal = React57.forwardRef((props, ref) => {
|
|
8798
8995
|
const {
|
|
8799
8996
|
drawerEnterDuration = 225,
|
|
8800
8997
|
drawerExitDuration = 225,
|
|
@@ -8816,10 +9013,10 @@ var EmailEditorInternal = React62.forwardRef((props, ref) => {
|
|
|
8816
9013
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
8817
9014
|
const marginLeftTransition = useDrawerTransition("margin-left", samplesDrawerOpen);
|
|
8818
9015
|
const marginRightTransition = useDrawerTransition("margin-right", inspectorDrawerOpen);
|
|
8819
|
-
const onChangeRef =
|
|
9016
|
+
const onChangeRef = React57.useRef(onChange);
|
|
8820
9017
|
onChangeRef.current = onChange;
|
|
8821
|
-
const prevDocJsonRef =
|
|
8822
|
-
|
|
9018
|
+
const prevDocJsonRef = React57.useRef("");
|
|
9019
|
+
React57.useEffect(() => {
|
|
8823
9020
|
var _a;
|
|
8824
9021
|
const docJson = JSON.stringify(currentDocument);
|
|
8825
9022
|
if (docJson !== prevDocJsonRef.current) {
|
|
@@ -8827,7 +9024,7 @@ var EmailEditorInternal = React62.forwardRef((props, ref) => {
|
|
|
8827
9024
|
(_a = onChangeRef.current) == null ? void 0 : _a.call(onChangeRef, currentDocument);
|
|
8828
9025
|
}
|
|
8829
9026
|
}, [currentDocument]);
|
|
8830
|
-
|
|
9027
|
+
React57.useImperativeHandle(ref, () => ({
|
|
8831
9028
|
saveTemplate: () => {
|
|
8832
9029
|
return saveTemplate();
|
|
8833
9030
|
},
|
|
@@ -8839,15 +9036,16 @@ var EmailEditorInternal = React62.forwardRef((props, ref) => {
|
|
|
8839
9036
|
return getDocument();
|
|
8840
9037
|
}
|
|
8841
9038
|
}));
|
|
8842
|
-
return /* @__PURE__ */
|
|
9039
|
+
return /* @__PURE__ */ React57__default.default.createElement(material.Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8843
9040
|
InspectorDrawer,
|
|
8844
9041
|
{
|
|
8845
9042
|
enterDuration: drawerEnterDuration,
|
|
8846
9043
|
exitDuration: drawerExitDuration,
|
|
8847
9044
|
deleteTemplate,
|
|
8848
|
-
copyTemplate
|
|
9045
|
+
copyTemplate,
|
|
9046
|
+
renameTemplate
|
|
8849
9047
|
}
|
|
8850
|
-
), /* @__PURE__ */
|
|
9048
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8851
9049
|
SamplesDrawer,
|
|
8852
9050
|
{
|
|
8853
9051
|
enterDuration: drawerEnterDuration,
|
|
@@ -8863,7 +9061,7 @@ var EmailEditorInternal = React62.forwardRef((props, ref) => {
|
|
|
8863
9061
|
setTemplateKind,
|
|
8864
9062
|
saveAs
|
|
8865
9063
|
}
|
|
8866
|
-
), /* @__PURE__ */
|
|
9064
|
+
), /* @__PURE__ */ React57__default.default.createElement(
|
|
8867
9065
|
material.Stack,
|
|
8868
9066
|
{
|
|
8869
9067
|
sx: {
|
|
@@ -8872,10 +9070,10 @@ var EmailEditorInternal = React62.forwardRef((props, ref) => {
|
|
|
8872
9070
|
transition: [marginLeftTransition, marginRightTransition].join(", ")
|
|
8873
9071
|
}
|
|
8874
9072
|
},
|
|
8875
|
-
/* @__PURE__ */
|
|
9073
|
+
/* @__PURE__ */ React57__default.default.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
|
|
8876
9074
|
));
|
|
8877
9075
|
});
|
|
8878
|
-
var EmailEditor =
|
|
9076
|
+
var EmailEditor = React57.forwardRef((props, ref) => {
|
|
8879
9077
|
const {
|
|
8880
9078
|
initialTemplate: initialTemplateProp,
|
|
8881
9079
|
initialTemplateId,
|
|
@@ -8898,25 +9096,27 @@ var EmailEditor = React62.forwardRef((props, ref) => {
|
|
|
8898
9096
|
uploadImage,
|
|
8899
9097
|
loadImages,
|
|
8900
9098
|
deleteImage,
|
|
8901
|
-
theme
|
|
9099
|
+
theme,
|
|
9100
|
+
locale
|
|
8902
9101
|
} = props;
|
|
8903
|
-
|
|
9102
|
+
activateLocale(locale);
|
|
9103
|
+
const resolvedTemplate = React57.useMemo(
|
|
8904
9104
|
() => typeof initialTemplateProp === "string" ? htmlToEditorConfig(initialTemplateProp) : initialTemplateProp,
|
|
8905
9105
|
[initialTemplateProp]
|
|
8906
9106
|
);
|
|
8907
|
-
const prevTemplateRef =
|
|
9107
|
+
const prevTemplateRef = React57.useRef(void 0);
|
|
8908
9108
|
if (resolvedTemplate && resolvedTemplate !== prevTemplateRef.current) {
|
|
8909
9109
|
prevTemplateRef.current = resolvedTemplate;
|
|
8910
9110
|
resetDocument(resolvedTemplate);
|
|
8911
9111
|
}
|
|
8912
|
-
|
|
9112
|
+
React57.useEffect(() => {
|
|
8913
9113
|
setPersistenceEnabled(persistenceEnabled);
|
|
8914
9114
|
}, [persistenceEnabled]);
|
|
8915
|
-
const imageCallbacks =
|
|
9115
|
+
const imageCallbacks = React57.useMemo(
|
|
8916
9116
|
() => ({ uploadImage, loadImages, deleteImage }),
|
|
8917
9117
|
[uploadImage, loadImages, deleteImage]
|
|
8918
9118
|
);
|
|
8919
|
-
return /* @__PURE__ */
|
|
9119
|
+
return /* @__PURE__ */ React57__default.default.createElement(react.I18nProvider, { i18n: core.i18n }, /* @__PURE__ */ React57__default.default.createElement(material.ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React57__default.default.createElement(material.CssBaseline, null), /* @__PURE__ */ React57__default.default.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React57__default.default.createElement(SnackbarProvider, null, /* @__PURE__ */ React57__default.default.createElement(ImageCallbacksProvider, { callbacks: imageCallbacks }, /* @__PURE__ */ React57__default.default.createElement(
|
|
8920
9120
|
EmailEditorProvider,
|
|
8921
9121
|
{
|
|
8922
9122
|
initialTemplate: resolvedTemplate,
|
|
@@ -8925,7 +9125,7 @@ var EmailEditor = React62.forwardRef((props, ref) => {
|
|
|
8925
9125
|
onSave,
|
|
8926
9126
|
onChange
|
|
8927
9127
|
},
|
|
8928
|
-
/* @__PURE__ */
|
|
9128
|
+
/* @__PURE__ */ React57__default.default.createElement(
|
|
8929
9129
|
EmailEditorInternal,
|
|
8930
9130
|
{
|
|
8931
9131
|
ref,
|
|
@@ -8944,7 +9144,7 @@ var EmailEditor = React62.forwardRef((props, ref) => {
|
|
|
8944
9144
|
onChange
|
|
8945
9145
|
}
|
|
8946
9146
|
)
|
|
8947
|
-
)))));
|
|
9147
|
+
))))));
|
|
8948
9148
|
});
|
|
8949
9149
|
EmailEditor.displayName = "EmailEditor";
|
|
8950
9150
|
EmailEditorInternal.displayName = "EmailEditorInternal";
|
|
@@ -8990,6 +9190,7 @@ exports.Reader = Reader;
|
|
|
8990
9190
|
exports.ReaderBlock = ReaderBlock;
|
|
8991
9191
|
exports.ReaderBlockSchema = ReaderBlockSchema;
|
|
8992
9192
|
exports.ReaderDocumentSchema = ReaderDocumentSchema;
|
|
9193
|
+
exports.SUPPORTED_LOCALES = SUPPORTED_LOCALES;
|
|
8993
9194
|
exports.Signature = signature_default;
|
|
8994
9195
|
exports.SignatureProps = SignatureProps;
|
|
8995
9196
|
exports.SignaturePropsDefaults = SignaturePropsDefaults;
|