@kontakto/email-template-editor 1.3.3 → 1.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 +1561 -420
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +760 -10
- package/dist/index.d.ts +760 -10
- package/dist/index.js +1477 -341
- package/dist/index.js.map +1 -1
- package/package.json +10 -19
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import DOMPurify from 'dompurify';
|
|
2
2
|
import { marked, Renderer } from 'marked';
|
|
3
|
-
import
|
|
3
|
+
import React72, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useContext, useState, useCallback, Fragment } from 'react';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { renderToStaticMarkup as renderToStaticMarkup$1 } from 'react-dom/server';
|
|
6
6
|
import { createTheme, alpha, lighten, darken } from '@mui/material/styles';
|
|
7
7
|
import { MenuItem, Stack, ThemeProvider, CssBaseline, useTheme, Drawer, Box, Tabs, Tab, Typography, CircularProgress, Divider as Divider$1, ToggleButtonGroup, ToggleButton, Tooltip, Snackbar, Button as Button$1, IconButton, Dialog, DialogTitle, DialogContent, TextField, DialogActions, InputLabel, FormControlLabel, Switch, Menu, Slider, ButtonBase, Paper, Fade } from '@mui/material';
|
|
8
8
|
import { create } from 'zustand';
|
|
9
|
-
import { MonitorOutlined, PhoneIphoneOutlined, EditOutlined, PreviewOutlined, CodeOutlined, DataObjectOutlined, Add, SaveOutlined, LastPageOutlined, AppRegistrationOutlined, ContentCopyOutlined, DeleteOutlined, FirstPageOutlined, MenuOutlined, FileDownloadOutlined, RoundedCornerOutlined, HeightOutlined, VerticalAlignTopOutlined, VerticalAlignCenterOutlined, VerticalAlignBottomOutlined, SpaceBarOutlined,
|
|
9
|
+
import { MonitorOutlined, PhoneIphoneOutlined, EditOutlined, PreviewOutlined, CodeOutlined, SubjectOutlined, DataObjectOutlined, Add, SaveOutlined, LastPageOutlined, AppRegistrationOutlined, ContentCopyOutlined, DeleteOutlined, FirstPageOutlined, MenuOutlined, FileDownloadOutlined, RoundedCornerOutlined, AspectRatioOutlined, HeightOutlined, VerticalAlignTopOutlined, VerticalAlignCenterOutlined, VerticalAlignBottomOutlined, SpaceBarOutlined, AddOutlined, CloseOutlined, AlignVerticalTopOutlined, AlignVerticalBottomOutlined, AlignHorizontalLeftOutlined, AlignHorizontalRightOutlined, FormatAlignLeftOutlined, FormatAlignCenterOutlined, FormatAlignRightOutlined, TextFieldsOutlined, ArrowUpwardOutlined, ArrowDownwardOutlined, HMobiledataOutlined, NotesOutlined, SmartButtonOutlined, ImageOutlined, AccountCircleOutlined, ContactMailOutlined, BusinessOutlined, HorizontalRuleOutlined, Crop32Outlined, HtmlOutlined, ViewColumnOutlined, LibraryAddOutlined } from '@mui/icons-material';
|
|
10
10
|
import { HexColorPicker, HexColorInput } from 'react-colorful';
|
|
11
11
|
import hljs from 'highlight.js';
|
|
12
12
|
import jsonHighlighter from 'highlight.js/lib/languages/json';
|
|
@@ -159,7 +159,7 @@ function renderMarkdownString(str) {
|
|
|
159
159
|
function EmailMarkdown(_a) {
|
|
160
160
|
var _b = _a, { markdown } = _b, props = __objRest(_b, ["markdown"]);
|
|
161
161
|
const data = useMemo(() => renderMarkdownString(markdown), [markdown]);
|
|
162
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ React72.createElement("div", __spreadProps(__spreadValues({}, props), { dangerouslySetInnerHTML: { __html: data } }));
|
|
163
163
|
}
|
|
164
164
|
var FONT_FAMILY_SCHEMA = z.enum([
|
|
165
165
|
"MODERN_SANS",
|
|
@@ -235,9 +235,9 @@ function Text({ style, props }) {
|
|
|
235
235
|
};
|
|
236
236
|
const text = (_f = props == null ? void 0 : props.text) != null ? _f : TextPropsDefaults.text;
|
|
237
237
|
if (props == null ? void 0 : props.markdown) {
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ React72.createElement(EmailMarkdown, { style: wStyle, markdown: text });
|
|
239
239
|
}
|
|
240
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wStyle }, text);
|
|
241
241
|
}
|
|
242
242
|
var PADDING_SCHEMA2 = z.object({
|
|
243
243
|
top: z.number(),
|
|
@@ -286,7 +286,7 @@ function Avatar({ style, props }) {
|
|
|
286
286
|
textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
|
|
287
287
|
padding: getPadding2(style == null ? void 0 : style.padding)
|
|
288
288
|
};
|
|
289
|
-
return /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ React72.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React72.createElement(
|
|
290
290
|
"img",
|
|
291
291
|
{
|
|
292
292
|
alt,
|
|
@@ -434,14 +434,14 @@ function Button({ style, props }) {
|
|
|
434
434
|
padding: `${padding[0]}px ${padding[1]}px`,
|
|
435
435
|
textDecoration: "none"
|
|
436
436
|
};
|
|
437
|
-
return /* @__PURE__ */
|
|
437
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React72.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React72.createElement(
|
|
438
438
|
"span",
|
|
439
439
|
{
|
|
440
440
|
dangerouslySetInnerHTML: {
|
|
441
441
|
__html: `<!--[if mso]><i style="letter-spacing: ${padding[1]}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
), /* @__PURE__ */
|
|
444
|
+
), /* @__PURE__ */ React72.createElement("span", null, text), /* @__PURE__ */ React72.createElement(
|
|
445
445
|
"span",
|
|
446
446
|
{
|
|
447
447
|
dangerouslySetInnerHTML: {
|
|
@@ -490,7 +490,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
490
490
|
contentAlignment: (_d = props == null ? void 0 : props.contentAlignment) != null ? _d : ColumnsContainerPropsDefaults.contentAlignment,
|
|
491
491
|
fixedWidths: props == null ? void 0 : props.fixedWidths
|
|
492
492
|
};
|
|
493
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wStyle }, /* @__PURE__ */ React72.createElement(
|
|
494
494
|
"table",
|
|
495
495
|
{
|
|
496
496
|
align: "center",
|
|
@@ -499,7 +499,7 @@ function ColumnsContainer({ style, columns, props }) {
|
|
|
499
499
|
border: 0,
|
|
500
500
|
style: { tableLayout: "fixed", borderCollapse: "collapse" }
|
|
501
501
|
},
|
|
502
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ React72.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React72.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React72.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React72.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React72.createElement(TableCell, { index: 2, props: blockProps, columns })))
|
|
503
503
|
));
|
|
504
504
|
}
|
|
505
505
|
function TableCell({ index, props, columns }) {
|
|
@@ -517,7 +517,7 @@ function TableCell({ index, props, columns }) {
|
|
|
517
517
|
width: (_d = (_c = props.fixedWidths) == null ? void 0 : _c[index]) != null ? _d : void 0
|
|
518
518
|
};
|
|
519
519
|
const children = (_e = columns && columns[index]) != null ? _e : null;
|
|
520
|
-
return /* @__PURE__ */
|
|
520
|
+
return /* @__PURE__ */ React72.createElement("td", { style }, children);
|
|
521
521
|
}
|
|
522
522
|
function getPaddingBefore(index, { columnsGap, columnsCount }) {
|
|
523
523
|
if (index === 0) {
|
|
@@ -579,9 +579,9 @@ function Container({ style, children }) {
|
|
|
579
579
|
padding: getPadding5(style == null ? void 0 : style.padding)
|
|
580
580
|
};
|
|
581
581
|
if (!children) {
|
|
582
|
-
return /* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wStyle });
|
|
583
583
|
}
|
|
584
|
-
return /* @__PURE__ */
|
|
584
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wStyle }, children);
|
|
585
585
|
}
|
|
586
586
|
var container_default = Container;
|
|
587
587
|
var COLOR_SCHEMA5 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
@@ -615,7 +615,7 @@ function Divider({ style, props }) {
|
|
|
615
615
|
};
|
|
616
616
|
const borderTopWidth = (_b = props == null ? void 0 : props.lineHeight) != null ? _b : DividerPropsDefaults.lineHeight;
|
|
617
617
|
const borderTopColor = (_c = props == null ? void 0 : props.lineColor) != null ? _c : DividerPropsDefaults.lineColor;
|
|
618
|
-
return /* @__PURE__ */
|
|
618
|
+
return /* @__PURE__ */ React72.createElement("div", { style: st }, /* @__PURE__ */ React72.createElement(
|
|
619
619
|
"hr",
|
|
620
620
|
{
|
|
621
621
|
style: {
|
|
@@ -705,11 +705,11 @@ function Heading({ props, style }) {
|
|
|
705
705
|
};
|
|
706
706
|
switch (level) {
|
|
707
707
|
case "h1":
|
|
708
|
-
return /* @__PURE__ */
|
|
708
|
+
return /* @__PURE__ */ React72.createElement("h1", { style: hStyle }, text);
|
|
709
709
|
case "h2":
|
|
710
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ React72.createElement("h2", { style: hStyle }, text);
|
|
711
711
|
case "h3":
|
|
712
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React72.createElement("h3", { style: hStyle }, text);
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
function getFontSize(level) {
|
|
@@ -791,9 +791,9 @@ function Html({ style, props }) {
|
|
|
791
791
|
padding: getPadding8(style == null ? void 0 : style.padding)
|
|
792
792
|
};
|
|
793
793
|
if (!children) {
|
|
794
|
-
return /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ React72.createElement("div", { style: cssStyle });
|
|
795
795
|
}
|
|
796
|
-
return /* @__PURE__ */
|
|
796
|
+
return /* @__PURE__ */ React72.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
797
797
|
}
|
|
798
798
|
var html_default = Html;
|
|
799
799
|
var PADDING_SCHEMA9 = z.object({
|
|
@@ -829,7 +829,7 @@ function Image({ style, props }) {
|
|
|
829
829
|
const linkHref = (_c = props == null ? void 0 : props.linkHref) != null ? _c : null;
|
|
830
830
|
const width = (_d = props == null ? void 0 : props.width) != null ? _d : void 0;
|
|
831
831
|
const height = (_e = props == null ? void 0 : props.height) != null ? _e : void 0;
|
|
832
|
-
const imageElement = /* @__PURE__ */
|
|
832
|
+
const imageElement = /* @__PURE__ */ React72.createElement(
|
|
833
833
|
"img",
|
|
834
834
|
{
|
|
835
835
|
alt: (_f = props == null ? void 0 : props.alt) != null ? _f : "",
|
|
@@ -849,11 +849,187 @@ function Image({ style, props }) {
|
|
|
849
849
|
}
|
|
850
850
|
);
|
|
851
851
|
if (!linkHref) {
|
|
852
|
-
return /* @__PURE__ */
|
|
852
|
+
return /* @__PURE__ */ React72.createElement("div", { style: sectionStyle }, imageElement);
|
|
853
853
|
}
|
|
854
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ React72.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React72.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
|
|
855
855
|
}
|
|
856
856
|
var image_default = Image;
|
|
857
|
+
var FONT_FAMILY_SCHEMA5 = z.enum([
|
|
858
|
+
"MODERN_SANS",
|
|
859
|
+
"BOOK_SANS",
|
|
860
|
+
"ORGANIC_SANS",
|
|
861
|
+
"GEOMETRIC_SANS",
|
|
862
|
+
"HEAVY_SANS",
|
|
863
|
+
"ROUNDED_SANS",
|
|
864
|
+
"MODERN_SERIF",
|
|
865
|
+
"BOOK_SERIF",
|
|
866
|
+
"MONOSPACE"
|
|
867
|
+
]).nullable().optional();
|
|
868
|
+
function getFontFamily5(fontFamily) {
|
|
869
|
+
switch (fontFamily) {
|
|
870
|
+
case "MODERN_SANS":
|
|
871
|
+
return '"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif';
|
|
872
|
+
case "BOOK_SANS":
|
|
873
|
+
return 'Optima, Candara, "Noto Sans", source-sans-pro, sans-serif';
|
|
874
|
+
case "ORGANIC_SANS":
|
|
875
|
+
return 'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif';
|
|
876
|
+
case "GEOMETRIC_SANS":
|
|
877
|
+
return 'Avenir, "Avenir Next LT Pro", Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif';
|
|
878
|
+
case "HEAVY_SANS":
|
|
879
|
+
return 'Bahnschrift, "DIN Alternate", "Franklin Gothic Medium", "Nimbus Sans Narrow", sans-serif-condensed, sans-serif';
|
|
880
|
+
case "ROUNDED_SANS":
|
|
881
|
+
return 'ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, Manjari, "Arial Rounded MT Bold", Calibri, source-sans-pro, sans-serif';
|
|
882
|
+
case "MODERN_SERIF":
|
|
883
|
+
return 'Charter, "Bitstream Charter", "Sitka Text", Cambria, serif';
|
|
884
|
+
case "BOOK_SERIF":
|
|
885
|
+
return '"Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif';
|
|
886
|
+
case "MONOSPACE":
|
|
887
|
+
return '"Nimbus Mono PS", "Courier New", "Cutive Mono", monospace';
|
|
888
|
+
}
|
|
889
|
+
return void 0;
|
|
890
|
+
}
|
|
891
|
+
var COLOR_SCHEMA8 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
892
|
+
var PADDING_SCHEMA10 = z.object({
|
|
893
|
+
top: z.number(),
|
|
894
|
+
bottom: z.number(),
|
|
895
|
+
right: z.number(),
|
|
896
|
+
left: z.number()
|
|
897
|
+
}).optional().nullable();
|
|
898
|
+
var getPadding10 = (padding) => padding ? `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px` : void 0;
|
|
899
|
+
var SignaturePropsSchema = z.object({
|
|
900
|
+
style: z.object({
|
|
901
|
+
backgroundColor: COLOR_SCHEMA8,
|
|
902
|
+
fontFamily: FONT_FAMILY_SCHEMA5,
|
|
903
|
+
padding: PADDING_SCHEMA10
|
|
904
|
+
}).optional().nullable(),
|
|
905
|
+
props: z.object({
|
|
906
|
+
greeting: z.string().optional().nullable(),
|
|
907
|
+
name: z.string().optional().nullable(),
|
|
908
|
+
title: z.string().optional().nullable(),
|
|
909
|
+
company: z.string().optional().nullable(),
|
|
910
|
+
address: z.string().optional().nullable(),
|
|
911
|
+
email: z.string().optional().nullable(),
|
|
912
|
+
phone: z.string().optional().nullable(),
|
|
913
|
+
website: z.string().optional().nullable(),
|
|
914
|
+
imageUrl: z.string().optional().nullable(),
|
|
915
|
+
imageSize: z.number().optional().nullable(),
|
|
916
|
+
imageShape: z.enum(["circle", "square", "rounded"]).optional().nullable(),
|
|
917
|
+
layout: z.enum(["horizontal", "vertical"]).optional().nullable(),
|
|
918
|
+
nameColor: COLOR_SCHEMA8,
|
|
919
|
+
textColor: COLOR_SCHEMA8,
|
|
920
|
+
linkColor: COLOR_SCHEMA8
|
|
921
|
+
}).optional().nullable()
|
|
922
|
+
});
|
|
923
|
+
var SignatureProps = SignaturePropsSchema;
|
|
924
|
+
var SignaturePropsDefaults = {
|
|
925
|
+
greeting: "",
|
|
926
|
+
name: "",
|
|
927
|
+
title: "",
|
|
928
|
+
company: "",
|
|
929
|
+
address: "",
|
|
930
|
+
email: "",
|
|
931
|
+
phone: "",
|
|
932
|
+
website: "",
|
|
933
|
+
imageUrl: "",
|
|
934
|
+
imageSize: 64,
|
|
935
|
+
imageShape: "circle",
|
|
936
|
+
layout: "horizontal",
|
|
937
|
+
nameColor: "#262626",
|
|
938
|
+
textColor: "#666666",
|
|
939
|
+
linkColor: "#0079CC"
|
|
940
|
+
};
|
|
941
|
+
function getImageBorderRadius(shape, size) {
|
|
942
|
+
switch (shape) {
|
|
943
|
+
case "circle":
|
|
944
|
+
return size;
|
|
945
|
+
case "rounded":
|
|
946
|
+
return size * 0.125;
|
|
947
|
+
case "square":
|
|
948
|
+
default:
|
|
949
|
+
return void 0;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
function Signature({ style, props }) {
|
|
953
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
954
|
+
const greeting = (_a = props == null ? void 0 : props.greeting) != null ? _a : SignaturePropsDefaults.greeting;
|
|
955
|
+
const name = (_b = props == null ? void 0 : props.name) != null ? _b : SignaturePropsDefaults.name;
|
|
956
|
+
const title = (_c = props == null ? void 0 : props.title) != null ? _c : SignaturePropsDefaults.title;
|
|
957
|
+
const company = (_d = props == null ? void 0 : props.company) != null ? _d : SignaturePropsDefaults.company;
|
|
958
|
+
const address = (_e = props == null ? void 0 : props.address) != null ? _e : SignaturePropsDefaults.address;
|
|
959
|
+
const email = (_f = props == null ? void 0 : props.email) != null ? _f : SignaturePropsDefaults.email;
|
|
960
|
+
const phone = (_g = props == null ? void 0 : props.phone) != null ? _g : SignaturePropsDefaults.phone;
|
|
961
|
+
const website = (_h = props == null ? void 0 : props.website) != null ? _h : SignaturePropsDefaults.website;
|
|
962
|
+
const imageUrl = (_i = props == null ? void 0 : props.imageUrl) != null ? _i : SignaturePropsDefaults.imageUrl;
|
|
963
|
+
const imageSize = (_j = props == null ? void 0 : props.imageSize) != null ? _j : SignaturePropsDefaults.imageSize;
|
|
964
|
+
const imageShape = (_k = props == null ? void 0 : props.imageShape) != null ? _k : SignaturePropsDefaults.imageShape;
|
|
965
|
+
const layout = (_l = props == null ? void 0 : props.layout) != null ? _l : SignaturePropsDefaults.layout;
|
|
966
|
+
const nameColor = (_m = props == null ? void 0 : props.nameColor) != null ? _m : SignaturePropsDefaults.nameColor;
|
|
967
|
+
const textColor = (_n = props == null ? void 0 : props.textColor) != null ? _n : SignaturePropsDefaults.textColor;
|
|
968
|
+
const linkColor = (_o = props == null ? void 0 : props.linkColor) != null ? _o : SignaturePropsDefaults.linkColor;
|
|
969
|
+
const wrapperStyle = {
|
|
970
|
+
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
971
|
+
fontFamily: getFontFamily5(style == null ? void 0 : style.fontFamily),
|
|
972
|
+
padding: getPadding10(style == null ? void 0 : style.padding)
|
|
973
|
+
};
|
|
974
|
+
const greetingStyle = {
|
|
975
|
+
fontSize: 14,
|
|
976
|
+
color: textColor,
|
|
977
|
+
margin: 0,
|
|
978
|
+
marginBottom: 8,
|
|
979
|
+
lineHeight: "1.4",
|
|
980
|
+
fontStyle: "italic"
|
|
981
|
+
};
|
|
982
|
+
const nameStyle = {
|
|
983
|
+
fontSize: 16,
|
|
984
|
+
fontWeight: "bold",
|
|
985
|
+
color: nameColor,
|
|
986
|
+
margin: 0,
|
|
987
|
+
lineHeight: "1.4"
|
|
988
|
+
};
|
|
989
|
+
const detailStyle = {
|
|
990
|
+
fontSize: 14,
|
|
991
|
+
color: textColor,
|
|
992
|
+
margin: 0,
|
|
993
|
+
lineHeight: "1.4"
|
|
994
|
+
};
|
|
995
|
+
const linkStyle = {
|
|
996
|
+
fontSize: 14,
|
|
997
|
+
color: linkColor,
|
|
998
|
+
textDecoration: "none"
|
|
999
|
+
};
|
|
1000
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React72.createElement(
|
|
1001
|
+
"img",
|
|
1002
|
+
{
|
|
1003
|
+
src: imageUrl,
|
|
1004
|
+
alt: name || company,
|
|
1005
|
+
width: imageSize,
|
|
1006
|
+
height: imageSize,
|
|
1007
|
+
style: {
|
|
1008
|
+
width: imageSize,
|
|
1009
|
+
height: imageSize,
|
|
1010
|
+
objectFit: "cover",
|
|
1011
|
+
borderRadius: getImageBorderRadius(imageShape, imageSize),
|
|
1012
|
+
display: "block",
|
|
1013
|
+
outline: "none",
|
|
1014
|
+
border: "none"
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
) : null;
|
|
1018
|
+
const contactParts = [];
|
|
1019
|
+
if (email) contactParts.push(/* @__PURE__ */ React72.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
|
|
1020
|
+
if (phone) contactParts.push(/* @__PURE__ */ React72.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
|
|
1021
|
+
if (website) {
|
|
1022
|
+
const href = website.startsWith("http") ? website : `https://${website}`;
|
|
1023
|
+
contactParts.push(/* @__PURE__ */ React72.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
|
|
1024
|
+
}
|
|
1025
|
+
const textContent = /* @__PURE__ */ React72.createElement("div", null, name && /* @__PURE__ */ React72.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React72.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React72.createElement(React72.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React72.createElement("span", { style: detailStyle }, " \xB7 "), part))));
|
|
1026
|
+
const greetingElement = greeting ? /* @__PURE__ */ React72.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
1027
|
+
if (layout === "vertical") {
|
|
1028
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React72.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
1029
|
+
}
|
|
1030
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React72.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React72.createElement("tbody", null, /* @__PURE__ */ React72.createElement("tr", null, imageElement && /* @__PURE__ */ React72.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React72.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
1031
|
+
}
|
|
1032
|
+
var signature_default = Signature;
|
|
857
1033
|
var SpacerPropsSchema = z.object({
|
|
858
1034
|
props: z.object({
|
|
859
1035
|
height: z.number().gte(0).optional().nullish()
|
|
@@ -868,13 +1044,13 @@ function Spacer({ props }) {
|
|
|
868
1044
|
const style = {
|
|
869
1045
|
height: (_a = props == null ? void 0 : props.height) != null ? _a : SpacerPropsDefaults.height
|
|
870
1046
|
};
|
|
871
|
-
return /* @__PURE__ */
|
|
1047
|
+
return /* @__PURE__ */ React72.createElement("div", { style });
|
|
872
1048
|
}
|
|
873
1049
|
var spacer_default = Spacer;
|
|
874
1050
|
function buildBlockComponent(blocks) {
|
|
875
1051
|
return function BlockComponent({ type, data }) {
|
|
876
1052
|
const Component = blocks[type].Component;
|
|
877
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ React72.createElement(Component, __spreadValues({}, data));
|
|
878
1054
|
};
|
|
879
1055
|
}
|
|
880
1056
|
function buildBlockConfigurationSchema(blocks) {
|
|
@@ -911,9 +1087,9 @@ function ColumnsContainerReader({ style, props }) {
|
|
|
911
1087
|
const _a = props != null ? props : {}, { columns } = _a, restProps = __objRest(_a, ["columns"]);
|
|
912
1088
|
let cols = void 0;
|
|
913
1089
|
if (columns) {
|
|
914
|
-
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */
|
|
1090
|
+
cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React72.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
915
1091
|
}
|
|
916
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ React72.createElement(columns_container_default, { props: restProps, columns: cols, style });
|
|
917
1093
|
}
|
|
918
1094
|
var ContainerPropsSchema2 = z.object({
|
|
919
1095
|
style: ContainerPropsSchema.shape.style,
|
|
@@ -924,10 +1100,10 @@ var ContainerPropsSchema2 = z.object({
|
|
|
924
1100
|
function ContainerReader({ style, props }) {
|
|
925
1101
|
var _a;
|
|
926
1102
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
927
|
-
return /* @__PURE__ */
|
|
1103
|
+
return /* @__PURE__ */ React72.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React72.createElement(ReaderBlock, { key: childId, id: childId })));
|
|
928
1104
|
}
|
|
929
|
-
var
|
|
930
|
-
var
|
|
1105
|
+
var COLOR_SCHEMA9 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
1106
|
+
var FONT_FAMILY_SCHEMA6 = z.enum([
|
|
931
1107
|
"MODERN_SANS",
|
|
932
1108
|
"BOOK_SANS",
|
|
933
1109
|
"ORGANIC_SANS",
|
|
@@ -939,15 +1115,15 @@ var FONT_FAMILY_SCHEMA5 = z.enum([
|
|
|
939
1115
|
"MONOSPACE"
|
|
940
1116
|
]).nullable().optional();
|
|
941
1117
|
var EmailLayoutPropsSchema = z.object({
|
|
942
|
-
backdropColor:
|
|
943
|
-
borderColor:
|
|
1118
|
+
backdropColor: COLOR_SCHEMA9,
|
|
1119
|
+
borderColor: COLOR_SCHEMA9,
|
|
944
1120
|
borderRadius: z.number().optional().nullable(),
|
|
945
|
-
canvasColor:
|
|
946
|
-
textColor:
|
|
947
|
-
fontFamily:
|
|
1121
|
+
canvasColor: COLOR_SCHEMA9,
|
|
1122
|
+
textColor: COLOR_SCHEMA9,
|
|
1123
|
+
fontFamily: FONT_FAMILY_SCHEMA6,
|
|
948
1124
|
childrenIds: z.array(z.string()).optional().nullable()
|
|
949
1125
|
});
|
|
950
|
-
function
|
|
1126
|
+
function getFontFamily6(fontFamily) {
|
|
951
1127
|
const f = fontFamily != null ? fontFamily : "MODERN_SANS";
|
|
952
1128
|
switch (f) {
|
|
953
1129
|
case "MODERN_SANS":
|
|
@@ -979,13 +1155,13 @@ function getBorder2({ borderColor }) {
|
|
|
979
1155
|
function EmailLayoutReader(props) {
|
|
980
1156
|
var _a, _b, _c, _d, _e;
|
|
981
1157
|
const childrenIds = (_a = props.childrenIds) != null ? _a : [];
|
|
982
|
-
return /* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ React72.createElement(
|
|
983
1159
|
"div",
|
|
984
1160
|
{
|
|
985
1161
|
style: {
|
|
986
1162
|
backgroundColor: (_b = props.backdropColor) != null ? _b : "#F5F5F5",
|
|
987
1163
|
color: (_c = props.textColor) != null ? _c : "#262626",
|
|
988
|
-
fontFamily:
|
|
1164
|
+
fontFamily: getFontFamily6(props.fontFamily),
|
|
989
1165
|
fontSize: "16px",
|
|
990
1166
|
fontWeight: "400",
|
|
991
1167
|
letterSpacing: "0.15008px",
|
|
@@ -996,7 +1172,7 @@ function EmailLayoutReader(props) {
|
|
|
996
1172
|
width: "100%"
|
|
997
1173
|
}
|
|
998
1174
|
},
|
|
999
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ React72.createElement(
|
|
1000
1176
|
"table",
|
|
1001
1177
|
{
|
|
1002
1178
|
align: "center",
|
|
@@ -1013,7 +1189,7 @@ function EmailLayoutReader(props) {
|
|
|
1013
1189
|
cellPadding: "0",
|
|
1014
1190
|
border: 0
|
|
1015
1191
|
},
|
|
1016
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ React72.createElement("tbody", null, /* @__PURE__ */ React72.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React72.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React72.createElement(ReaderBlock, { key: childId, id: childId })))))
|
|
1017
1193
|
)
|
|
1018
1194
|
);
|
|
1019
1195
|
}
|
|
@@ -1025,7 +1201,7 @@ function useReaderDocument() {
|
|
|
1025
1201
|
}
|
|
1026
1202
|
function ReaderBlock({ id }) {
|
|
1027
1203
|
const document2 = useReaderDocument();
|
|
1028
|
-
return document2[id] ? /* @__PURE__ */
|
|
1204
|
+
return document2[id] ? /* @__PURE__ */ React72.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
|
|
1029
1205
|
}
|
|
1030
1206
|
var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
1031
1207
|
ColumnsContainer: {
|
|
@@ -1072,21 +1248,159 @@ var READER_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
1072
1248
|
Text: {
|
|
1073
1249
|
schema: TextPropsSchema,
|
|
1074
1250
|
Component: Text
|
|
1251
|
+
},
|
|
1252
|
+
Signature: {
|
|
1253
|
+
schema: SignaturePropsSchema,
|
|
1254
|
+
Component: signature_default
|
|
1075
1255
|
}
|
|
1076
1256
|
});
|
|
1077
1257
|
var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
|
|
1078
1258
|
var ReaderDocumentSchema = z.record(z.string(), ReaderBlockSchema);
|
|
1079
1259
|
var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
|
|
1080
1260
|
function Reader({ document: document2, rootBlockId }) {
|
|
1081
|
-
return /* @__PURE__ */
|
|
1261
|
+
return /* @__PURE__ */ React72.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React72.createElement(ReaderBlock, { id: rootBlockId }));
|
|
1082
1262
|
}
|
|
1083
1263
|
|
|
1084
1264
|
// src/email-builder/renderers/render-to-static-markup.tsx
|
|
1085
1265
|
function renderToStaticMarkup(document2, { rootBlockId }) {
|
|
1086
1266
|
return "<!DOCTYPE html>" + renderToStaticMarkup$1(
|
|
1087
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ React72.createElement("html", null, /* @__PURE__ */ React72.createElement("body", null, /* @__PURE__ */ React72.createElement(Reader, { document: document2, rootBlockId })))
|
|
1088
1268
|
);
|
|
1089
1269
|
}
|
|
1270
|
+
|
|
1271
|
+
// src/email-builder/renderers/render-to-text.ts
|
|
1272
|
+
function renderToText(document2, { rootBlockId }) {
|
|
1273
|
+
const lines = [];
|
|
1274
|
+
renderBlock(document2, rootBlockId, lines);
|
|
1275
|
+
return lines.join("\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
1276
|
+
}
|
|
1277
|
+
function renderBlock(document2, blockId, lines) {
|
|
1278
|
+
var _a;
|
|
1279
|
+
const block = document2[blockId];
|
|
1280
|
+
if (!block) return;
|
|
1281
|
+
const { type, data } = block;
|
|
1282
|
+
switch (type) {
|
|
1283
|
+
case "EmailLayout":
|
|
1284
|
+
renderChildren(document2, data == null ? void 0 : data.childrenIds, lines);
|
|
1285
|
+
break;
|
|
1286
|
+
case "Container":
|
|
1287
|
+
renderChildren(document2, (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.childrenIds, lines);
|
|
1288
|
+
break;
|
|
1289
|
+
case "ColumnsContainer":
|
|
1290
|
+
renderColumnsContainer(document2, data, lines);
|
|
1291
|
+
break;
|
|
1292
|
+
case "Text":
|
|
1293
|
+
renderText(data, lines);
|
|
1294
|
+
break;
|
|
1295
|
+
case "Heading":
|
|
1296
|
+
renderHeading(data, lines);
|
|
1297
|
+
break;
|
|
1298
|
+
case "Button":
|
|
1299
|
+
renderButton(data, lines);
|
|
1300
|
+
break;
|
|
1301
|
+
case "Image":
|
|
1302
|
+
renderImage(data, lines);
|
|
1303
|
+
break;
|
|
1304
|
+
case "Avatar":
|
|
1305
|
+
renderAvatar(data, lines);
|
|
1306
|
+
break;
|
|
1307
|
+
case "Html":
|
|
1308
|
+
renderHtml(data, lines);
|
|
1309
|
+
break;
|
|
1310
|
+
case "Divider":
|
|
1311
|
+
lines.push("");
|
|
1312
|
+
lines.push("---");
|
|
1313
|
+
lines.push("");
|
|
1314
|
+
break;
|
|
1315
|
+
case "Spacer":
|
|
1316
|
+
lines.push("");
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
function renderChildren(document2, childrenIds, lines) {
|
|
1321
|
+
if (!childrenIds) return;
|
|
1322
|
+
for (const childId of childrenIds) {
|
|
1323
|
+
renderBlock(document2, childId, lines);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
function renderColumnsContainer(document2, data, lines) {
|
|
1327
|
+
var _a, _b;
|
|
1328
|
+
const columns = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.columns;
|
|
1329
|
+
if (!columns) return;
|
|
1330
|
+
for (const col of columns) {
|
|
1331
|
+
if ((_b = col == null ? void 0 : col.childrenIds) == null ? void 0 : _b.length) {
|
|
1332
|
+
renderChildren(document2, col.childrenIds, lines);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
function renderText(data, lines) {
|
|
1337
|
+
var _a, _b, _c;
|
|
1338
|
+
const text = (_b = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.text) != null ? _b : "";
|
|
1339
|
+
if (!text) return;
|
|
1340
|
+
if ((_c = data == null ? void 0 : data.props) == null ? void 0 : _c.markdown) {
|
|
1341
|
+
lines.push(text);
|
|
1342
|
+
} else {
|
|
1343
|
+
lines.push(text);
|
|
1344
|
+
}
|
|
1345
|
+
lines.push("");
|
|
1346
|
+
}
|
|
1347
|
+
function renderHeading(data, lines) {
|
|
1348
|
+
var _a, _b, _c, _d;
|
|
1349
|
+
const text = (_b = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.text) != null ? _b : "";
|
|
1350
|
+
if (!text) return;
|
|
1351
|
+
const level = (_d = (_c = data == null ? void 0 : data.props) == null ? void 0 : _c.level) != null ? _d : "h2";
|
|
1352
|
+
const prefix = level === "h1" ? "# " : level === "h2" ? "## " : "### ";
|
|
1353
|
+
lines.push(prefix + text);
|
|
1354
|
+
lines.push("");
|
|
1355
|
+
}
|
|
1356
|
+
function renderButton(data, lines) {
|
|
1357
|
+
var _a, _b, _c, _d;
|
|
1358
|
+
const text = (_b = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.text) != null ? _b : "";
|
|
1359
|
+
const url = (_d = (_c = data == null ? void 0 : data.props) == null ? void 0 : _c.url) != null ? _d : "";
|
|
1360
|
+
if (text && url) {
|
|
1361
|
+
lines.push(`${text}: ${url}`);
|
|
1362
|
+
} else if (text) {
|
|
1363
|
+
lines.push(text);
|
|
1364
|
+
} else if (url) {
|
|
1365
|
+
lines.push(url);
|
|
1366
|
+
}
|
|
1367
|
+
lines.push("");
|
|
1368
|
+
}
|
|
1369
|
+
function renderImage(data, lines) {
|
|
1370
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1371
|
+
const alt = (_b = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.alt) != null ? _b : "";
|
|
1372
|
+
const url = (_d = (_c = data == null ? void 0 : data.props) == null ? void 0 : _c.url) != null ? _d : "";
|
|
1373
|
+
const linkHref = (_f = (_e = data == null ? void 0 : data.props) == null ? void 0 : _e.linkHref) != null ? _f : "";
|
|
1374
|
+
if (alt && linkHref) {
|
|
1375
|
+
lines.push(`[${alt}] ${linkHref}`);
|
|
1376
|
+
} else if (alt) {
|
|
1377
|
+
lines.push(`[${alt}]`);
|
|
1378
|
+
} else if (url) {
|
|
1379
|
+
lines.push(`[Image: ${url}]`);
|
|
1380
|
+
}
|
|
1381
|
+
lines.push("");
|
|
1382
|
+
}
|
|
1383
|
+
function renderAvatar(data, lines) {
|
|
1384
|
+
var _a, _b;
|
|
1385
|
+
const alt = (_b = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.alt) != null ? _b : "";
|
|
1386
|
+
if (alt) {
|
|
1387
|
+
lines.push(`[${alt}]`);
|
|
1388
|
+
lines.push("");
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
function renderHtml(data, lines) {
|
|
1392
|
+
var _a, _b;
|
|
1393
|
+
const contents = (_b = (_a = data == null ? void 0 : data.props) == null ? void 0 : _a.contents) != null ? _b : "";
|
|
1394
|
+
if (!contents) return;
|
|
1395
|
+
const text = stripHtml(contents);
|
|
1396
|
+
if (text) {
|
|
1397
|
+
lines.push(text);
|
|
1398
|
+
lines.push("");
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function stripHtml(html2) {
|
|
1402
|
+
return html2.replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|h[1-6]|li|tr|blockquote)>/gi, "\n").replace(/<hr\s*\/?>/gi, "\n---\n").replace(/<[^>]+>/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").split("\n").map((line) => line.trim()).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
1403
|
+
}
|
|
1090
1404
|
var BRAND_NAVY = "#212443";
|
|
1091
1405
|
var BRAND_BLUE = "#0079CC";
|
|
1092
1406
|
var BRAND_GREEN = "#1F8466";
|
|
@@ -1737,7 +2051,7 @@ var EmailEditorProvider = ({
|
|
|
1737
2051
|
registerSaveListener,
|
|
1738
2052
|
setCurrentTemplate
|
|
1739
2053
|
}), [currentTemplateId, currentTemplateName, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
|
|
1740
|
-
return /* @__PURE__ */
|
|
2054
|
+
return /* @__PURE__ */ React72.createElement(EmailEditorContext.Provider, { value }, children);
|
|
1741
2055
|
};
|
|
1742
2056
|
var useEmailEditor = () => {
|
|
1743
2057
|
const context = useContext(EmailEditorContext);
|
|
@@ -1747,14 +2061,14 @@ var useEmailEditor = () => {
|
|
|
1747
2061
|
return context;
|
|
1748
2062
|
};
|
|
1749
2063
|
function BaseSidebarPanel({ title, children }) {
|
|
1750
|
-
return /* @__PURE__ */
|
|
2064
|
+
return /* @__PURE__ */ React72.createElement(Box, { p: 2 }, /* @__PURE__ */ React72.createElement(Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, title), /* @__PURE__ */ React72.createElement(Stack, { spacing: 5, mb: 3 }, children));
|
|
1751
2065
|
}
|
|
1752
2066
|
function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
1753
2067
|
const [value, setValue] = useState(defaultValue);
|
|
1754
2068
|
useEffect(() => {
|
|
1755
2069
|
setValue(defaultValue);
|
|
1756
2070
|
}, [defaultValue]);
|
|
1757
|
-
return /* @__PURE__ */
|
|
2071
|
+
return /* @__PURE__ */ React72.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React72.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React72.createElement(
|
|
1758
2072
|
ToggleButtonGroup,
|
|
1759
2073
|
{
|
|
1760
2074
|
exclusive: true,
|
|
@@ -1774,7 +2088,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
|
|
|
1774
2088
|
}
|
|
1775
2089
|
function RawSliderInput(_a) {
|
|
1776
2090
|
var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
|
|
1777
|
-
return /* @__PURE__ */
|
|
2091
|
+
return /* @__PURE__ */ React72.createElement(Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React72.createElement(Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React72.createElement(
|
|
1778
2092
|
Slider,
|
|
1779
2093
|
__spreadProps(__spreadValues({}, props), {
|
|
1780
2094
|
value,
|
|
@@ -1785,14 +2099,14 @@ function RawSliderInput(_a) {
|
|
|
1785
2099
|
setValue(value2);
|
|
1786
2100
|
}
|
|
1787
2101
|
})
|
|
1788
|
-
), /* @__PURE__ */
|
|
2102
|
+
), /* @__PURE__ */ React72.createElement(Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React72.createElement(Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
|
|
1789
2103
|
}
|
|
1790
2104
|
|
|
1791
2105
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
|
|
1792
2106
|
function SliderInput(_a) {
|
|
1793
2107
|
var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
|
|
1794
2108
|
const [value, setValue] = useState(defaultValue);
|
|
1795
|
-
return /* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ React72.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React72.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React72.createElement(
|
|
1796
2110
|
RawSliderInput,
|
|
1797
2111
|
__spreadValues({
|
|
1798
2112
|
value,
|
|
@@ -1809,7 +2123,7 @@ function TextInput({ helperText, label, placeholder, rows, InputProps: InputProp
|
|
|
1809
2123
|
useEffect(() => {
|
|
1810
2124
|
setValue(defaultValue);
|
|
1811
2125
|
}, [defaultValue]);
|
|
1812
|
-
return /* @__PURE__ */
|
|
2126
|
+
return /* @__PURE__ */ React72.createElement(
|
|
1813
2127
|
TextField,
|
|
1814
2128
|
{
|
|
1815
2129
|
fullWidth: true,
|
|
@@ -1834,8 +2148,8 @@ var TILE_BUTTON = {
|
|
|
1834
2148
|
height: 24
|
|
1835
2149
|
};
|
|
1836
2150
|
function Swatch({ paletteColors, value, onChange }) {
|
|
1837
|
-
const
|
|
1838
|
-
return /* @__PURE__ */
|
|
2151
|
+
const renderButton2 = (colorValue) => {
|
|
2152
|
+
return /* @__PURE__ */ React72.createElement(
|
|
1839
2153
|
Button$1,
|
|
1840
2154
|
{
|
|
1841
2155
|
key: colorValue,
|
|
@@ -1854,7 +2168,7 @@ function Swatch({ paletteColors, value, onChange }) {
|
|
|
1854
2168
|
}
|
|
1855
2169
|
);
|
|
1856
2170
|
};
|
|
1857
|
-
return /* @__PURE__ */
|
|
2171
|
+
return /* @__PURE__ */ React72.createElement(Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
|
|
1858
2172
|
}
|
|
1859
2173
|
|
|
1860
2174
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
|
|
@@ -1921,7 +2235,7 @@ var SX = {
|
|
|
1921
2235
|
}
|
|
1922
2236
|
};
|
|
1923
2237
|
function Picker({ value, onChange }) {
|
|
1924
|
-
return /* @__PURE__ */
|
|
2238
|
+
return /* @__PURE__ */ React72.createElement(Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React72.createElement(HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React72.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React72.createElement(Box, { pt: 1 }, /* @__PURE__ */ React72.createElement(HexColorInput, { prefixed: true, color: value, onChange })));
|
|
1925
2239
|
}
|
|
1926
2240
|
|
|
1927
2241
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
|
|
@@ -1946,7 +2260,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
1946
2260
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
1947
2261
|
return null;
|
|
1948
2262
|
}
|
|
1949
|
-
return /* @__PURE__ */
|
|
2263
|
+
return /* @__PURE__ */ React72.createElement(
|
|
1950
2264
|
ButtonBase,
|
|
1951
2265
|
{
|
|
1952
2266
|
onClick: () => {
|
|
@@ -1954,16 +2268,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
1954
2268
|
onChange(null);
|
|
1955
2269
|
}
|
|
1956
2270
|
},
|
|
1957
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ React72.createElement(CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
|
|
1958
2272
|
);
|
|
1959
2273
|
};
|
|
1960
2274
|
const renderOpenButton = () => {
|
|
1961
2275
|
if (value) {
|
|
1962
|
-
return /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ React72.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
|
|
1963
2277
|
}
|
|
1964
|
-
return /* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ React72.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React72.createElement(AddOutlined, { fontSize: "small" }));
|
|
1965
2279
|
};
|
|
1966
|
-
return /* @__PURE__ */
|
|
2280
|
+
return /* @__PURE__ */ React72.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React72.createElement(InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React72.createElement(Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React72.createElement(
|
|
1967
2281
|
Menu,
|
|
1968
2282
|
{
|
|
1969
2283
|
anchorEl,
|
|
@@ -1973,7 +2287,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
1973
2287
|
sx: { height: "auto", padding: 0 }
|
|
1974
2288
|
}
|
|
1975
2289
|
},
|
|
1976
|
-
/* @__PURE__ */
|
|
2290
|
+
/* @__PURE__ */ React72.createElement(
|
|
1977
2291
|
Picker,
|
|
1978
2292
|
{
|
|
1979
2293
|
value: value || "",
|
|
@@ -1988,10 +2302,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
|
|
|
1988
2302
|
|
|
1989
2303
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
|
|
1990
2304
|
function ColorInput2(props) {
|
|
1991
|
-
return /* @__PURE__ */
|
|
2305
|
+
return /* @__PURE__ */ React72.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
|
|
1992
2306
|
}
|
|
1993
2307
|
function NullableColorInput(props) {
|
|
1994
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ React72.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
|
|
1995
2309
|
}
|
|
1996
2310
|
|
|
1997
2311
|
// src/editor/blocks/helpers/font-family.ts
|
|
@@ -2044,13 +2358,13 @@ var FONT_FAMILIES = [
|
|
|
2044
2358
|
];
|
|
2045
2359
|
|
|
2046
2360
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
|
|
2047
|
-
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */
|
|
2361
|
+
var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React72.createElement(MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
|
|
2048
2362
|
function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
2049
2363
|
const [value, setValue] = useState(defaultValue != null ? defaultValue : "inherit");
|
|
2050
2364
|
useEffect(() => {
|
|
2051
2365
|
setValue(defaultValue != null ? defaultValue : "inherit");
|
|
2052
2366
|
}, [defaultValue]);
|
|
2053
|
-
return /* @__PURE__ */
|
|
2367
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2054
2368
|
TextField,
|
|
2055
2369
|
{
|
|
2056
2370
|
select: true,
|
|
@@ -2063,7 +2377,7 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
|
|
|
2063
2377
|
onChange(v === null ? null : v);
|
|
2064
2378
|
}
|
|
2065
2379
|
},
|
|
2066
|
-
/* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ React72.createElement(MenuItem, { value: "inherit" }, "Match email settings"),
|
|
2067
2381
|
OPTIONS
|
|
2068
2382
|
);
|
|
2069
2383
|
}
|
|
@@ -2076,10 +2390,10 @@ function FontSizeInput({ label, defaultValue, onChange }) {
|
|
|
2076
2390
|
setValue(value2);
|
|
2077
2391
|
onChange(value2);
|
|
2078
2392
|
};
|
|
2079
|
-
return /* @__PURE__ */
|
|
2393
|
+
return /* @__PURE__ */ React72.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React72.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React72.createElement(
|
|
2080
2394
|
RawSliderInput,
|
|
2081
2395
|
{
|
|
2082
|
-
iconLabel: /* @__PURE__ */
|
|
2396
|
+
iconLabel: /* @__PURE__ */ React72.createElement(TextFieldsOutlined, { sx: { fontSize: 16 } }),
|
|
2083
2397
|
value,
|
|
2084
2398
|
setValue: handleChange,
|
|
2085
2399
|
units: "px",
|
|
@@ -2094,7 +2408,7 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2094
2408
|
useEffect(() => {
|
|
2095
2409
|
setValue(defaultValue);
|
|
2096
2410
|
}, [defaultValue]);
|
|
2097
|
-
return /* @__PURE__ */
|
|
2411
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2098
2412
|
RadioGroupInput,
|
|
2099
2413
|
{
|
|
2100
2414
|
label,
|
|
@@ -2104,8 +2418,8 @@ function FontWeightInput({ label, defaultValue, onChange }) {
|
|
|
2104
2418
|
onChange(fontWeight);
|
|
2105
2419
|
}
|
|
2106
2420
|
},
|
|
2107
|
-
/* @__PURE__ */
|
|
2108
|
-
/* @__PURE__ */
|
|
2421
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "normal" }, "Regular"),
|
|
2422
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "bold" }, "Bold")
|
|
2109
2423
|
);
|
|
2110
2424
|
}
|
|
2111
2425
|
function PaddingInput({ label, defaultValue, onChange }) {
|
|
@@ -2127,10 +2441,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2127
2441
|
setValue(v);
|
|
2128
2442
|
onChange(v);
|
|
2129
2443
|
}
|
|
2130
|
-
return /* @__PURE__ */
|
|
2444
|
+
return /* @__PURE__ */ React72.createElement(Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React72.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React72.createElement(
|
|
2131
2445
|
RawSliderInput,
|
|
2132
2446
|
{
|
|
2133
|
-
iconLabel: /* @__PURE__ */
|
|
2447
|
+
iconLabel: /* @__PURE__ */ React72.createElement(AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
|
|
2134
2448
|
value: value.top,
|
|
2135
2449
|
setValue: (num) => handleChange("top", num),
|
|
2136
2450
|
units: "px",
|
|
@@ -2139,10 +2453,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2139
2453
|
max: 80,
|
|
2140
2454
|
marks: true
|
|
2141
2455
|
}
|
|
2142
|
-
), /* @__PURE__ */
|
|
2456
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2143
2457
|
RawSliderInput,
|
|
2144
2458
|
{
|
|
2145
|
-
iconLabel: /* @__PURE__ */
|
|
2459
|
+
iconLabel: /* @__PURE__ */ React72.createElement(AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
|
|
2146
2460
|
value: value.bottom,
|
|
2147
2461
|
setValue: (num) => handleChange("bottom", num),
|
|
2148
2462
|
units: "px",
|
|
@@ -2151,10 +2465,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2151
2465
|
max: 80,
|
|
2152
2466
|
marks: true
|
|
2153
2467
|
}
|
|
2154
|
-
), /* @__PURE__ */
|
|
2468
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2155
2469
|
RawSliderInput,
|
|
2156
2470
|
{
|
|
2157
|
-
iconLabel: /* @__PURE__ */
|
|
2471
|
+
iconLabel: /* @__PURE__ */ React72.createElement(AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
|
|
2158
2472
|
value: value.left,
|
|
2159
2473
|
setValue: (num) => handleChange("left", num),
|
|
2160
2474
|
units: "px",
|
|
@@ -2163,10 +2477,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
|
|
|
2163
2477
|
max: 80,
|
|
2164
2478
|
marks: true
|
|
2165
2479
|
}
|
|
2166
|
-
), /* @__PURE__ */
|
|
2480
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2167
2481
|
RawSliderInput,
|
|
2168
2482
|
{
|
|
2169
|
-
iconLabel: /* @__PURE__ */
|
|
2483
|
+
iconLabel: /* @__PURE__ */ React72.createElement(AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
|
|
2170
2484
|
value: value.right,
|
|
2171
2485
|
setValue: (num) => handleChange("right", num),
|
|
2172
2486
|
units: "px",
|
|
@@ -2182,7 +2496,7 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2182
2496
|
useEffect(() => {
|
|
2183
2497
|
setValue(defaultValue != null ? defaultValue : "left");
|
|
2184
2498
|
}, [defaultValue]);
|
|
2185
|
-
return /* @__PURE__ */
|
|
2499
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2186
2500
|
RadioGroupInput,
|
|
2187
2501
|
{
|
|
2188
2502
|
label,
|
|
@@ -2192,9 +2506,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
|
|
|
2192
2506
|
onChange(value2);
|
|
2193
2507
|
}
|
|
2194
2508
|
},
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2509
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "left" }, /* @__PURE__ */ React72.createElement(FormatAlignLeftOutlined, { fontSize: "small" })),
|
|
2510
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "center" }, /* @__PURE__ */ React72.createElement(FormatAlignCenterOutlined, { fontSize: "small" })),
|
|
2511
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "right" }, /* @__PURE__ */ React72.createElement(FormatAlignRightOutlined, { fontSize: "small" }))
|
|
2198
2512
|
);
|
|
2199
2513
|
}
|
|
2200
2514
|
|
|
@@ -2207,14 +2521,14 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2207
2521
|
};
|
|
2208
2522
|
switch (name) {
|
|
2209
2523
|
case "backgroundColor":
|
|
2210
|
-
return /* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ React72.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
|
|
2211
2525
|
case "borderColor":
|
|
2212
|
-
return /* @__PURE__ */
|
|
2526
|
+
return /* @__PURE__ */ React72.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
|
|
2213
2527
|
case "borderRadius":
|
|
2214
|
-
return /* @__PURE__ */
|
|
2528
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2215
2529
|
SliderInput,
|
|
2216
2530
|
{
|
|
2217
|
-
iconLabel: /* @__PURE__ */
|
|
2531
|
+
iconLabel: /* @__PURE__ */ React72.createElement(RoundedCornerOutlined, null),
|
|
2218
2532
|
units: "px",
|
|
2219
2533
|
step: 4,
|
|
2220
2534
|
marks: true,
|
|
@@ -2226,23 +2540,23 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
|
|
|
2226
2540
|
}
|
|
2227
2541
|
);
|
|
2228
2542
|
case "color":
|
|
2229
|
-
return /* @__PURE__ */
|
|
2543
|
+
return /* @__PURE__ */ React72.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
|
|
2230
2544
|
case "fontFamily":
|
|
2231
|
-
return /* @__PURE__ */
|
|
2545
|
+
return /* @__PURE__ */ React72.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
|
|
2232
2546
|
case "fontSize":
|
|
2233
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ React72.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
|
|
2234
2548
|
case "fontWeight":
|
|
2235
|
-
return /* @__PURE__ */
|
|
2549
|
+
return /* @__PURE__ */ React72.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
|
|
2236
2550
|
case "textAlign":
|
|
2237
|
-
return /* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ React72.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
|
|
2238
2552
|
case "padding":
|
|
2239
|
-
return /* @__PURE__ */
|
|
2553
|
+
return /* @__PURE__ */ React72.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
|
|
2240
2554
|
}
|
|
2241
2555
|
}
|
|
2242
2556
|
|
|
2243
2557
|
// src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
|
|
2244
2558
|
function MultiStylePropertyPanel({ names, value, onChange }) {
|
|
2245
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, names.map((name) => /* @__PURE__ */ React72.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
|
|
2246
2560
|
}
|
|
2247
2561
|
|
|
2248
2562
|
// src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
|
|
@@ -2262,11 +2576,11 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2262
2576
|
const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
|
|
2263
2577
|
const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
|
|
2264
2578
|
const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
|
|
2265
|
-
return /* @__PURE__ */
|
|
2579
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React72.createElement(
|
|
2266
2580
|
SliderInput,
|
|
2267
2581
|
{
|
|
2268
2582
|
label: "Size",
|
|
2269
|
-
iconLabel: /* @__PURE__ */
|
|
2583
|
+
iconLabel: /* @__PURE__ */ React72.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
2270
2584
|
units: "px",
|
|
2271
2585
|
step: 3,
|
|
2272
2586
|
min: 32,
|
|
@@ -2276,7 +2590,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2276
2590
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
|
|
2277
2591
|
}
|
|
2278
2592
|
}
|
|
2279
|
-
), /* @__PURE__ */
|
|
2593
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2280
2594
|
RadioGroupInput,
|
|
2281
2595
|
{
|
|
2282
2596
|
label: "Shape",
|
|
@@ -2285,10 +2599,10 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2285
2599
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
|
|
2286
2600
|
}
|
|
2287
2601
|
},
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2291
|
-
), /* @__PURE__ */
|
|
2602
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "circle" }, "Circle"),
|
|
2603
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "square" }, "Square"),
|
|
2604
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "rounded" }, "Rounded")
|
|
2605
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2292
2606
|
TextInput,
|
|
2293
2607
|
{
|
|
2294
2608
|
label: "Image URL",
|
|
@@ -2297,7 +2611,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2297
2611
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
|
|
2298
2612
|
}
|
|
2299
2613
|
}
|
|
2300
|
-
), /* @__PURE__ */
|
|
2614
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2301
2615
|
TextInput,
|
|
2302
2616
|
{
|
|
2303
2617
|
label: "Alt text",
|
|
@@ -2306,7 +2620,7 @@ function AvatarSidebarPanel({ data, setData }) {
|
|
|
2306
2620
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
|
|
2307
2621
|
}
|
|
2308
2622
|
}
|
|
2309
|
-
), /* @__PURE__ */
|
|
2623
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2310
2624
|
MultiStylePropertyPanel,
|
|
2311
2625
|
{
|
|
2312
2626
|
names: ["textAlign", "padding"],
|
|
@@ -2334,65 +2648,65 @@ function ButtonSidebarPanel({ data, setData }) {
|
|
|
2334
2648
|
const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
|
|
2335
2649
|
const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
|
|
2336
2650
|
const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
|
|
2337
|
-
return /* @__PURE__ */
|
|
2651
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React72.createElement(
|
|
2338
2652
|
TextInput,
|
|
2339
2653
|
{
|
|
2340
2654
|
label: "Text",
|
|
2341
2655
|
defaultValue: text,
|
|
2342
2656
|
onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
|
|
2343
2657
|
}
|
|
2344
|
-
), /* @__PURE__ */
|
|
2658
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2345
2659
|
TextInput,
|
|
2346
2660
|
{
|
|
2347
2661
|
label: "Url",
|
|
2348
2662
|
defaultValue: url,
|
|
2349
2663
|
onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
|
|
2350
2664
|
}
|
|
2351
|
-
), /* @__PURE__ */
|
|
2665
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2352
2666
|
RadioGroupInput,
|
|
2353
2667
|
{
|
|
2354
2668
|
label: "Width",
|
|
2355
2669
|
defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
|
|
2356
2670
|
onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
|
|
2357
2671
|
},
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2360
|
-
), /* @__PURE__ */
|
|
2672
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "FULL_WIDTH" }, "Full"),
|
|
2673
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "AUTO" }, "Auto")
|
|
2674
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2361
2675
|
RadioGroupInput,
|
|
2362
2676
|
{
|
|
2363
2677
|
label: "Size",
|
|
2364
2678
|
defaultValue: size,
|
|
2365
2679
|
onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
|
|
2366
2680
|
},
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
), /* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "x-small" }, "Xs"),
|
|
2682
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "small" }, "Sm"),
|
|
2683
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "medium" }, "Md"),
|
|
2684
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "large" }, "Lg")
|
|
2685
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2372
2686
|
RadioGroupInput,
|
|
2373
2687
|
{
|
|
2374
2688
|
label: "Style",
|
|
2375
2689
|
defaultValue: buttonStyle,
|
|
2376
2690
|
onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
|
|
2377
2691
|
},
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2380
|
-
/* @__PURE__ */
|
|
2381
|
-
), /* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "rectangle" }, "Rectangle"),
|
|
2693
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "rounded" }, "Rounded"),
|
|
2694
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "pill" }, "Pill")
|
|
2695
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2382
2696
|
ColorInput2,
|
|
2383
2697
|
{
|
|
2384
2698
|
label: "Text color",
|
|
2385
2699
|
defaultValue: buttonTextColor,
|
|
2386
2700
|
onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
|
|
2387
2701
|
}
|
|
2388
|
-
), /* @__PURE__ */
|
|
2702
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2389
2703
|
ColorInput2,
|
|
2390
2704
|
{
|
|
2391
2705
|
label: "Button color",
|
|
2392
2706
|
defaultValue: buttonBackgroundColor,
|
|
2393
2707
|
onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
|
|
2394
2708
|
}
|
|
2395
|
-
), /* @__PURE__ */
|
|
2709
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2396
2710
|
MultiStylePropertyPanel,
|
|
2397
2711
|
{
|
|
2398
2712
|
names: ["backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -2418,7 +2732,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2418
2732
|
const value = parseInt(ev.target.value);
|
|
2419
2733
|
onChange(isNaN(value) ? null : value);
|
|
2420
2734
|
};
|
|
2421
|
-
return /* @__PURE__ */
|
|
2735
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2422
2736
|
TextField,
|
|
2423
2737
|
{
|
|
2424
2738
|
fullWidth: true,
|
|
@@ -2429,7 +2743,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
|
|
|
2429
2743
|
placeholder: "auto",
|
|
2430
2744
|
size: "small",
|
|
2431
2745
|
InputProps: {
|
|
2432
|
-
endAdornment: /* @__PURE__ */
|
|
2746
|
+
endAdornment: /* @__PURE__ */ React72.createElement(Typography, { variant: "body2", color: "text.secondary" }, "px")
|
|
2433
2747
|
}
|
|
2434
2748
|
}
|
|
2435
2749
|
);
|
|
@@ -2451,7 +2765,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2451
2765
|
};
|
|
2452
2766
|
let column3 = null;
|
|
2453
2767
|
{
|
|
2454
|
-
column3 = /* @__PURE__ */
|
|
2768
|
+
column3 = /* @__PURE__ */ React72.createElement(
|
|
2455
2769
|
TextDimensionInput,
|
|
2456
2770
|
{
|
|
2457
2771
|
label: "Column 3",
|
|
@@ -2462,7 +2776,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2462
2776
|
}
|
|
2463
2777
|
);
|
|
2464
2778
|
}
|
|
2465
|
-
return /* @__PURE__ */
|
|
2779
|
+
return /* @__PURE__ */ React72.createElement(Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React72.createElement(
|
|
2466
2780
|
TextDimensionInput,
|
|
2467
2781
|
{
|
|
2468
2782
|
label: "Column 1",
|
|
@@ -2471,7 +2785,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
|
|
|
2471
2785
|
setIndexValue(0, v);
|
|
2472
2786
|
}
|
|
2473
2787
|
}
|
|
2474
|
-
), /* @__PURE__ */
|
|
2788
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2475
2789
|
TextDimensionInput,
|
|
2476
2790
|
{
|
|
2477
2791
|
label: "Column 2",
|
|
@@ -2496,7 +2810,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2496
2810
|
setErrors(res.error);
|
|
2497
2811
|
}
|
|
2498
2812
|
};
|
|
2499
|
-
return /* @__PURE__ */
|
|
2813
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React72.createElement(
|
|
2500
2814
|
RadioGroupInput,
|
|
2501
2815
|
{
|
|
2502
2816
|
label: "Number of columns",
|
|
@@ -2505,9 +2819,9 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2505
2819
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
|
|
2506
2820
|
}
|
|
2507
2821
|
},
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
), /* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "2" }, "2"),
|
|
2823
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "3" }, "3")
|
|
2824
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2511
2825
|
ColumnWidthsInput,
|
|
2512
2826
|
{
|
|
2513
2827
|
defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
|
|
@@ -2515,11 +2829,11 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2515
2829
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
|
|
2516
2830
|
}
|
|
2517
2831
|
}
|
|
2518
|
-
), /* @__PURE__ */
|
|
2832
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2519
2833
|
SliderInput,
|
|
2520
2834
|
{
|
|
2521
2835
|
label: "Columns gap",
|
|
2522
|
-
iconLabel: /* @__PURE__ */
|
|
2836
|
+
iconLabel: /* @__PURE__ */ React72.createElement(SpaceBarOutlined, { sx: { color: "text.secondary" } }),
|
|
2523
2837
|
units: "px",
|
|
2524
2838
|
step: 4,
|
|
2525
2839
|
marks: true,
|
|
@@ -2528,7 +2842,7 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2528
2842
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
|
|
2529
2843
|
onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
|
|
2530
2844
|
}
|
|
2531
|
-
), /* @__PURE__ */
|
|
2845
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2532
2846
|
RadioGroupInput,
|
|
2533
2847
|
{
|
|
2534
2848
|
label: "Alignment",
|
|
@@ -2537,10 +2851,10 @@ function ColumnsContainerPanel({ data, setData }) {
|
|
|
2537
2851
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
|
|
2538
2852
|
}
|
|
2539
2853
|
},
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
), /* @__PURE__ */
|
|
2854
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React72.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
2855
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React72.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
2856
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React72.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
2857
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2544
2858
|
MultiStylePropertyPanel,
|
|
2545
2859
|
{
|
|
2546
2860
|
names: ["backgroundColor", "padding"],
|
|
@@ -2569,7 +2883,7 @@ function ContainerSidebarPanel({ data, setData }) {
|
|
|
2569
2883
|
setErrors(res.error);
|
|
2570
2884
|
}
|
|
2571
2885
|
};
|
|
2572
|
-
return /* @__PURE__ */
|
|
2886
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React72.createElement(
|
|
2573
2887
|
MultiStylePropertyPanel,
|
|
2574
2888
|
{
|
|
2575
2889
|
names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
|
|
@@ -2592,18 +2906,18 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2592
2906
|
};
|
|
2593
2907
|
const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
|
|
2594
2908
|
const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
|
|
2595
|
-
return /* @__PURE__ */
|
|
2909
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React72.createElement(
|
|
2596
2910
|
ColorInput2,
|
|
2597
2911
|
{
|
|
2598
2912
|
label: "Color",
|
|
2599
2913
|
defaultValue: lineColor,
|
|
2600
2914
|
onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
|
|
2601
2915
|
}
|
|
2602
|
-
), /* @__PURE__ */
|
|
2916
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2603
2917
|
SliderInput,
|
|
2604
2918
|
{
|
|
2605
2919
|
label: "Height",
|
|
2606
|
-
iconLabel: /* @__PURE__ */
|
|
2920
|
+
iconLabel: /* @__PURE__ */ React72.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
2607
2921
|
units: "px",
|
|
2608
2922
|
step: 1,
|
|
2609
2923
|
min: 1,
|
|
@@ -2611,7 +2925,7 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2611
2925
|
defaultValue: lineHeight,
|
|
2612
2926
|
onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
|
|
2613
2927
|
}
|
|
2614
|
-
), /* @__PURE__ */
|
|
2928
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2615
2929
|
MultiStylePropertyPanel,
|
|
2616
2930
|
{
|
|
2617
2931
|
names: ["backgroundColor", "padding"],
|
|
@@ -2620,8 +2934,8 @@ function DividerSidebarPanel({ data, setData }) {
|
|
|
2620
2934
|
}
|
|
2621
2935
|
));
|
|
2622
2936
|
}
|
|
2623
|
-
var
|
|
2624
|
-
var
|
|
2937
|
+
var COLOR_SCHEMA10 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
2938
|
+
var FONT_FAMILY_SCHEMA7 = z.enum([
|
|
2625
2939
|
"MODERN_SANS",
|
|
2626
2940
|
"BOOK_SANS",
|
|
2627
2941
|
"ORGANIC_SANS",
|
|
@@ -2633,12 +2947,12 @@ var FONT_FAMILY_SCHEMA6 = z.enum([
|
|
|
2633
2947
|
"MONOSPACE"
|
|
2634
2948
|
]).nullable().optional();
|
|
2635
2949
|
var EmailLayoutPropsSchema2 = z.object({
|
|
2636
|
-
backdropColor:
|
|
2637
|
-
borderColor:
|
|
2950
|
+
backdropColor: COLOR_SCHEMA10,
|
|
2951
|
+
borderColor: COLOR_SCHEMA10,
|
|
2638
2952
|
borderRadius: z.number().optional().nullable(),
|
|
2639
|
-
canvasColor:
|
|
2640
|
-
textColor:
|
|
2641
|
-
fontFamily:
|
|
2953
|
+
canvasColor: COLOR_SCHEMA10,
|
|
2954
|
+
textColor: COLOR_SCHEMA10,
|
|
2955
|
+
fontFamily: FONT_FAMILY_SCHEMA7,
|
|
2642
2956
|
childrenIds: z.array(z.string()).optional().nullable()
|
|
2643
2957
|
});
|
|
2644
2958
|
var email_layout_props_schema_default = EmailLayoutPropsSchema2;
|
|
@@ -2656,31 +2970,31 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
2656
2970
|
setErrors(res.error);
|
|
2657
2971
|
}
|
|
2658
2972
|
};
|
|
2659
|
-
return /* @__PURE__ */
|
|
2973
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React72.createElement(
|
|
2660
2974
|
ColorInput2,
|
|
2661
2975
|
{
|
|
2662
2976
|
label: "Backdrop color",
|
|
2663
2977
|
defaultValue: (_a = data.backdropColor) != null ? _a : "#F5F5F5",
|
|
2664
2978
|
onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
|
|
2665
2979
|
}
|
|
2666
|
-
), /* @__PURE__ */
|
|
2980
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2667
2981
|
ColorInput2,
|
|
2668
2982
|
{
|
|
2669
2983
|
label: "Canvas color",
|
|
2670
2984
|
defaultValue: (_b = data.canvasColor) != null ? _b : "#FFFFFF",
|
|
2671
2985
|
onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
|
|
2672
2986
|
}
|
|
2673
|
-
), /* @__PURE__ */
|
|
2987
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2674
2988
|
NullableColorInput,
|
|
2675
2989
|
{
|
|
2676
2990
|
label: "Canvas border color",
|
|
2677
2991
|
defaultValue: (_c = data.borderColor) != null ? _c : null,
|
|
2678
2992
|
onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
|
|
2679
2993
|
}
|
|
2680
|
-
), /* @__PURE__ */
|
|
2994
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2681
2995
|
SliderInput,
|
|
2682
2996
|
{
|
|
2683
|
-
iconLabel: /* @__PURE__ */
|
|
2997
|
+
iconLabel: /* @__PURE__ */ React72.createElement(RoundedCornerOutlined, null),
|
|
2684
2998
|
units: "px",
|
|
2685
2999
|
step: 4,
|
|
2686
3000
|
marks: true,
|
|
@@ -2690,14 +3004,14 @@ function EmailLayoutSidebarFields({ data, setData }) {
|
|
|
2690
3004
|
defaultValue: (_d = data.borderRadius) != null ? _d : 0,
|
|
2691
3005
|
onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
|
|
2692
3006
|
}
|
|
2693
|
-
), /* @__PURE__ */
|
|
3007
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2694
3008
|
NullableFontFamily,
|
|
2695
3009
|
{
|
|
2696
3010
|
label: "Font family",
|
|
2697
3011
|
defaultValue: "MODERN_SANS",
|
|
2698
3012
|
onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
|
|
2699
3013
|
}
|
|
2700
|
-
), /* @__PURE__ */
|
|
3014
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2701
3015
|
ColorInput2,
|
|
2702
3016
|
{
|
|
2703
3017
|
label: "Text color",
|
|
@@ -2718,7 +3032,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
2718
3032
|
setErrors(res.error);
|
|
2719
3033
|
}
|
|
2720
3034
|
};
|
|
2721
|
-
return /* @__PURE__ */
|
|
3035
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React72.createElement(
|
|
2722
3036
|
TextInput,
|
|
2723
3037
|
{
|
|
2724
3038
|
label: "Content",
|
|
@@ -2728,7 +3042,7 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
2728
3042
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
|
|
2729
3043
|
}
|
|
2730
3044
|
}
|
|
2731
|
-
), /* @__PURE__ */
|
|
3045
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2732
3046
|
RadioGroupInput,
|
|
2733
3047
|
{
|
|
2734
3048
|
label: "Level",
|
|
@@ -2737,10 +3051,10 @@ function HeadingSidebarPanel({ data, setData }) {
|
|
|
2737
3051
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
|
|
2738
3052
|
}
|
|
2739
3053
|
},
|
|
2740
|
-
/* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
/* @__PURE__ */
|
|
2743
|
-
), /* @__PURE__ */
|
|
3054
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "h1" }, "H1"),
|
|
3055
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "h2" }, "H2"),
|
|
3056
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "h3" }, "H3")
|
|
3057
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2744
3058
|
MultiStylePropertyPanel,
|
|
2745
3059
|
{
|
|
2746
3060
|
names: ["color", "backgroundColor", "fontFamily", "fontWeight", "textAlign", "padding"],
|
|
@@ -2761,7 +3075,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
2761
3075
|
setErrors(res.error);
|
|
2762
3076
|
}
|
|
2763
3077
|
};
|
|
2764
|
-
return /* @__PURE__ */
|
|
3078
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React72.createElement(
|
|
2765
3079
|
TextInput,
|
|
2766
3080
|
{
|
|
2767
3081
|
label: "Content",
|
|
@@ -2769,7 +3083,7 @@ function HtmlSidebarPanel({ data, setData }) {
|
|
|
2769
3083
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
|
|
2770
3084
|
onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
|
|
2771
3085
|
}
|
|
2772
|
-
), /* @__PURE__ */
|
|
3086
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2773
3087
|
MultiStylePropertyPanel,
|
|
2774
3088
|
{
|
|
2775
3089
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
|
|
@@ -2790,7 +3104,7 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
2790
3104
|
setErrors(res.error);
|
|
2791
3105
|
}
|
|
2792
3106
|
};
|
|
2793
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Image block" }, /* @__PURE__ */ React72.createElement(
|
|
2794
3108
|
TextInput,
|
|
2795
3109
|
{
|
|
2796
3110
|
label: "Source URL",
|
|
@@ -2800,14 +3114,14 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
2800
3114
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url }) }));
|
|
2801
3115
|
}
|
|
2802
3116
|
}
|
|
2803
|
-
), /* @__PURE__ */
|
|
3117
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2804
3118
|
TextInput,
|
|
2805
3119
|
{
|
|
2806
3120
|
label: "Alt text",
|
|
2807
3121
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
|
|
2808
3122
|
onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
|
|
2809
3123
|
}
|
|
2810
|
-
), /* @__PURE__ */
|
|
3124
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2811
3125
|
TextInput,
|
|
2812
3126
|
{
|
|
2813
3127
|
label: "Click through URL",
|
|
@@ -2817,31 +3131,31 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
2817
3131
|
updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
|
|
2818
3132
|
}
|
|
2819
3133
|
}
|
|
2820
|
-
), /* @__PURE__ */
|
|
3134
|
+
), /* @__PURE__ */ React72.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React72.createElement(
|
|
2821
3135
|
TextDimensionInput,
|
|
2822
3136
|
{
|
|
2823
3137
|
label: "Width",
|
|
2824
3138
|
defaultValue: (_g = data.props) == null ? void 0 : _g.width,
|
|
2825
3139
|
onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
|
|
2826
3140
|
}
|
|
2827
|
-
), /* @__PURE__ */
|
|
3141
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2828
3142
|
TextDimensionInput,
|
|
2829
3143
|
{
|
|
2830
3144
|
label: "Height",
|
|
2831
3145
|
defaultValue: (_h = data.props) == null ? void 0 : _h.height,
|
|
2832
3146
|
onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
|
|
2833
3147
|
}
|
|
2834
|
-
)), /* @__PURE__ */
|
|
3148
|
+
)), /* @__PURE__ */ React72.createElement(
|
|
2835
3149
|
RadioGroupInput,
|
|
2836
3150
|
{
|
|
2837
3151
|
label: "Alignment",
|
|
2838
3152
|
defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
|
|
2839
3153
|
onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
|
|
2840
3154
|
},
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
), /* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React72.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
|
|
3156
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React72.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
|
|
3157
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React72.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
|
|
3158
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2845
3159
|
MultiStylePropertyPanel,
|
|
2846
3160
|
{
|
|
2847
3161
|
names: ["backgroundColor", "textAlign", "padding"],
|
|
@@ -2850,6 +3164,157 @@ function ImageSidebarPanel({ data, setData }) {
|
|
|
2850
3164
|
}
|
|
2851
3165
|
));
|
|
2852
3166
|
}
|
|
3167
|
+
function SignatureSidebarPanel({ data, setData }) {
|
|
3168
|
+
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;
|
|
3169
|
+
const [, setErrors] = useState(null);
|
|
3170
|
+
const updateData = (d) => {
|
|
3171
|
+
const res = SignaturePropsSchema.safeParse(d);
|
|
3172
|
+
if (res.success) {
|
|
3173
|
+
setData(res.data);
|
|
3174
|
+
setErrors(null);
|
|
3175
|
+
} else {
|
|
3176
|
+
setErrors(res.error);
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
const greeting = (_b = (_a = data.props) == null ? void 0 : _a.greeting) != null ? _b : SignaturePropsDefaults.greeting;
|
|
3180
|
+
const name = (_d = (_c = data.props) == null ? void 0 : _c.name) != null ? _d : SignaturePropsDefaults.name;
|
|
3181
|
+
const title = (_f = (_e = data.props) == null ? void 0 : _e.title) != null ? _f : SignaturePropsDefaults.title;
|
|
3182
|
+
const company = (_h = (_g = data.props) == null ? void 0 : _g.company) != null ? _h : SignaturePropsDefaults.company;
|
|
3183
|
+
const address = (_j = (_i = data.props) == null ? void 0 : _i.address) != null ? _j : SignaturePropsDefaults.address;
|
|
3184
|
+
const email = (_l = (_k = data.props) == null ? void 0 : _k.email) != null ? _l : SignaturePropsDefaults.email;
|
|
3185
|
+
const phone = (_n = (_m = data.props) == null ? void 0 : _m.phone) != null ? _n : SignaturePropsDefaults.phone;
|
|
3186
|
+
const website = (_p = (_o = data.props) == null ? void 0 : _o.website) != null ? _p : SignaturePropsDefaults.website;
|
|
3187
|
+
const imageUrl = (_r = (_q = data.props) == null ? void 0 : _q.imageUrl) != null ? _r : SignaturePropsDefaults.imageUrl;
|
|
3188
|
+
const imageSize = (_t = (_s = data.props) == null ? void 0 : _s.imageSize) != null ? _t : SignaturePropsDefaults.imageSize;
|
|
3189
|
+
const imageShape = (_v = (_u = data.props) == null ? void 0 : _u.imageShape) != null ? _v : SignaturePropsDefaults.imageShape;
|
|
3190
|
+
const layout = (_x = (_w = data.props) == null ? void 0 : _w.layout) != null ? _x : SignaturePropsDefaults.layout;
|
|
3191
|
+
const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
|
|
3192
|
+
const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
|
|
3193
|
+
const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
|
|
3194
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React72.createElement(
|
|
3195
|
+
TextInput,
|
|
3196
|
+
{
|
|
3197
|
+
label: "Greeting",
|
|
3198
|
+
defaultValue: greeting,
|
|
3199
|
+
onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
|
|
3200
|
+
}
|
|
3201
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3202
|
+
TextInput,
|
|
3203
|
+
{
|
|
3204
|
+
label: "Name",
|
|
3205
|
+
defaultValue: name,
|
|
3206
|
+
onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
|
|
3207
|
+
}
|
|
3208
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3209
|
+
TextInput,
|
|
3210
|
+
{
|
|
3211
|
+
label: "Title",
|
|
3212
|
+
defaultValue: title,
|
|
3213
|
+
onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
|
|
3214
|
+
}
|
|
3215
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3216
|
+
TextInput,
|
|
3217
|
+
{
|
|
3218
|
+
label: "Company",
|
|
3219
|
+
defaultValue: company,
|
|
3220
|
+
onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
|
|
3221
|
+
}
|
|
3222
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3223
|
+
TextInput,
|
|
3224
|
+
{
|
|
3225
|
+
label: "Address",
|
|
3226
|
+
defaultValue: address,
|
|
3227
|
+
onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
|
|
3228
|
+
}
|
|
3229
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3230
|
+
TextInput,
|
|
3231
|
+
{
|
|
3232
|
+
label: "Email",
|
|
3233
|
+
defaultValue: email,
|
|
3234
|
+
onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
|
|
3235
|
+
}
|
|
3236
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3237
|
+
TextInput,
|
|
3238
|
+
{
|
|
3239
|
+
label: "Phone",
|
|
3240
|
+
defaultValue: phone,
|
|
3241
|
+
onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
|
|
3242
|
+
}
|
|
3243
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3244
|
+
TextInput,
|
|
3245
|
+
{
|
|
3246
|
+
label: "Website",
|
|
3247
|
+
defaultValue: website,
|
|
3248
|
+
onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
|
|
3249
|
+
}
|
|
3250
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3251
|
+
TextInput,
|
|
3252
|
+
{
|
|
3253
|
+
label: "Image URL",
|
|
3254
|
+
defaultValue: imageUrl,
|
|
3255
|
+
onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
|
|
3256
|
+
}
|
|
3257
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3258
|
+
SliderInput,
|
|
3259
|
+
{
|
|
3260
|
+
label: "Image size",
|
|
3261
|
+
iconLabel: /* @__PURE__ */ React72.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
|
|
3262
|
+
units: "px",
|
|
3263
|
+
step: 4,
|
|
3264
|
+
min: 32,
|
|
3265
|
+
max: 128,
|
|
3266
|
+
defaultValue: imageSize,
|
|
3267
|
+
onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
|
|
3268
|
+
}
|
|
3269
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3270
|
+
RadioGroupInput,
|
|
3271
|
+
{
|
|
3272
|
+
label: "Image shape",
|
|
3273
|
+
defaultValue: imageShape,
|
|
3274
|
+
onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
|
|
3275
|
+
},
|
|
3276
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "circle" }, "Circle"),
|
|
3277
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "square" }, "Square"),
|
|
3278
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "rounded" }, "Rounded")
|
|
3279
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3280
|
+
RadioGroupInput,
|
|
3281
|
+
{
|
|
3282
|
+
label: "Layout",
|
|
3283
|
+
defaultValue: layout,
|
|
3284
|
+
onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
|
|
3285
|
+
},
|
|
3286
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "horizontal" }, "Horizontal"),
|
|
3287
|
+
/* @__PURE__ */ React72.createElement(ToggleButton, { value: "vertical" }, "Vertical")
|
|
3288
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3289
|
+
ColorInput2,
|
|
3290
|
+
{
|
|
3291
|
+
label: "Name color",
|
|
3292
|
+
defaultValue: nameColor,
|
|
3293
|
+
onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
|
|
3294
|
+
}
|
|
3295
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3296
|
+
ColorInput2,
|
|
3297
|
+
{
|
|
3298
|
+
label: "Text color",
|
|
3299
|
+
defaultValue: textColor,
|
|
3300
|
+
onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
|
|
3301
|
+
}
|
|
3302
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3303
|
+
ColorInput2,
|
|
3304
|
+
{
|
|
3305
|
+
label: "Link color",
|
|
3306
|
+
defaultValue: linkColor,
|
|
3307
|
+
onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
|
|
3308
|
+
}
|
|
3309
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3310
|
+
MultiStylePropertyPanel,
|
|
3311
|
+
{
|
|
3312
|
+
names: ["backgroundColor", "fontFamily", "padding"],
|
|
3313
|
+
value: data.style,
|
|
3314
|
+
onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
|
|
3315
|
+
}
|
|
3316
|
+
));
|
|
3317
|
+
}
|
|
2853
3318
|
function SpacerSidebarPanel({ data, setData }) {
|
|
2854
3319
|
var _a, _b;
|
|
2855
3320
|
const [, setErrors] = useState(null);
|
|
@@ -2862,11 +3327,11 @@ function SpacerSidebarPanel({ data, setData }) {
|
|
|
2862
3327
|
setErrors(res.error);
|
|
2863
3328
|
}
|
|
2864
3329
|
};
|
|
2865
|
-
return /* @__PURE__ */
|
|
3330
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React72.createElement(
|
|
2866
3331
|
SliderInput,
|
|
2867
3332
|
{
|
|
2868
3333
|
label: "Height",
|
|
2869
|
-
iconLabel: /* @__PURE__ */
|
|
3334
|
+
iconLabel: /* @__PURE__ */ React72.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
|
|
2870
3335
|
units: "px",
|
|
2871
3336
|
step: 4,
|
|
2872
3337
|
min: 4,
|
|
@@ -2881,11 +3346,11 @@ function BooleanInput({ label, defaultValue, onChange }) {
|
|
|
2881
3346
|
useEffect(() => {
|
|
2882
3347
|
setValue(defaultValue);
|
|
2883
3348
|
}, [defaultValue]);
|
|
2884
|
-
return /* @__PURE__ */
|
|
3349
|
+
return /* @__PURE__ */ React72.createElement(
|
|
2885
3350
|
FormControlLabel,
|
|
2886
3351
|
{
|
|
2887
3352
|
label,
|
|
2888
|
-
control: /* @__PURE__ */
|
|
3353
|
+
control: /* @__PURE__ */ React72.createElement(
|
|
2889
3354
|
Switch,
|
|
2890
3355
|
{
|
|
2891
3356
|
checked: value,
|
|
@@ -2912,7 +3377,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
2912
3377
|
setErrors(res.error);
|
|
2913
3378
|
}
|
|
2914
3379
|
};
|
|
2915
|
-
return /* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React72.createElement(
|
|
2916
3381
|
TextInput,
|
|
2917
3382
|
{
|
|
2918
3383
|
label: "Content",
|
|
@@ -2920,14 +3385,14 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
2920
3385
|
defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
|
|
2921
3386
|
onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
|
|
2922
3387
|
}
|
|
2923
|
-
), /* @__PURE__ */
|
|
3388
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2924
3389
|
BooleanInput,
|
|
2925
3390
|
{
|
|
2926
3391
|
label: "Markdown",
|
|
2927
3392
|
defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
|
|
2928
3393
|
onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
|
|
2929
3394
|
}
|
|
2930
|
-
), /* @__PURE__ */
|
|
3395
|
+
), /* @__PURE__ */ React72.createElement(
|
|
2931
3396
|
MultiStylePropertyPanel,
|
|
2932
3397
|
{
|
|
2933
3398
|
names: ["color", "backgroundColor", "fontFamily", "fontSize", "fontWeight", "textAlign", "padding"],
|
|
@@ -2939,7 +3404,7 @@ function TextSidebarPanel({ data, setData }) {
|
|
|
2939
3404
|
|
|
2940
3405
|
// src/app/inspector-drawer/configuration-panel/index.tsx
|
|
2941
3406
|
function renderMessage(val) {
|
|
2942
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ React72.createElement(Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React72.createElement(Typography, { color: "text.secondary" }, val));
|
|
2943
3408
|
}
|
|
2944
3409
|
function ConfigurationPanel() {
|
|
2945
3410
|
const document2 = useDocument();
|
|
@@ -2955,53 +3420,55 @@ function ConfigurationPanel() {
|
|
|
2955
3420
|
const { data, type } = block;
|
|
2956
3421
|
switch (type) {
|
|
2957
3422
|
case "Avatar":
|
|
2958
|
-
return /* @__PURE__ */
|
|
3423
|
+
return /* @__PURE__ */ React72.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2959
3424
|
case "Button":
|
|
2960
|
-
return /* @__PURE__ */
|
|
3425
|
+
return /* @__PURE__ */ React72.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2961
3426
|
case "ColumnsContainer":
|
|
2962
|
-
return /* @__PURE__ */
|
|
3427
|
+
return /* @__PURE__ */ React72.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2963
3428
|
case "Container":
|
|
2964
|
-
return /* @__PURE__ */
|
|
3429
|
+
return /* @__PURE__ */ React72.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2965
3430
|
case "Divider":
|
|
2966
|
-
return /* @__PURE__ */
|
|
3431
|
+
return /* @__PURE__ */ React72.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2967
3432
|
case "Heading":
|
|
2968
|
-
return /* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ React72.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2969
3434
|
case "Html":
|
|
2970
|
-
return /* @__PURE__ */
|
|
3435
|
+
return /* @__PURE__ */ React72.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2971
3436
|
case "Image":
|
|
2972
|
-
return /* @__PURE__ */
|
|
3437
|
+
return /* @__PURE__ */ React72.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2973
3438
|
case "EmailLayout":
|
|
2974
|
-
return /* @__PURE__ */
|
|
3439
|
+
return /* @__PURE__ */ React72.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2975
3440
|
case "Spacer":
|
|
2976
|
-
return /* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ React72.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
3442
|
+
case "Signature":
|
|
3443
|
+
return /* @__PURE__ */ React72.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2977
3444
|
case "Text":
|
|
2978
|
-
return /* @__PURE__ */
|
|
3445
|
+
return /* @__PURE__ */ React72.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
|
|
2979
3446
|
default:
|
|
2980
|
-
return /* @__PURE__ */
|
|
3447
|
+
return /* @__PURE__ */ React72.createElement("pre", null, JSON.stringify(block, null, " "));
|
|
2981
3448
|
}
|
|
2982
3449
|
}
|
|
2983
3450
|
function StylesPanel() {
|
|
2984
3451
|
const block = useDocument().root;
|
|
2985
3452
|
if (!block) {
|
|
2986
|
-
return /* @__PURE__ */
|
|
3453
|
+
return /* @__PURE__ */ React72.createElement("p", null, "Block not found");
|
|
2987
3454
|
}
|
|
2988
3455
|
const { data, type } = block;
|
|
2989
3456
|
if (type !== "EmailLayout") {
|
|
2990
3457
|
throw new Error('Expected "root" element to be of type EmailLayout');
|
|
2991
3458
|
}
|
|
2992
|
-
return /* @__PURE__ */
|
|
3459
|
+
return /* @__PURE__ */ React72.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
|
|
2993
3460
|
}
|
|
2994
3461
|
function TemplateDownloadButton() {
|
|
2995
3462
|
const doc = useDocument();
|
|
2996
3463
|
const href = useMemo(() => {
|
|
2997
3464
|
return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
|
|
2998
3465
|
}, [doc]);
|
|
2999
|
-
return /* @__PURE__ */
|
|
3466
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3000
3467
|
Button$1,
|
|
3001
3468
|
{
|
|
3002
3469
|
variant: "outlined",
|
|
3003
3470
|
color: "primary",
|
|
3004
|
-
startIcon: /* @__PURE__ */
|
|
3471
|
+
startIcon: /* @__PURE__ */ React72.createElement(FileDownloadOutlined, null),
|
|
3005
3472
|
href,
|
|
3006
3473
|
download: "emailTemplate.json",
|
|
3007
3474
|
fullWidth: true
|
|
@@ -3033,9 +3500,9 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3033
3500
|
}
|
|
3034
3501
|
};
|
|
3035
3502
|
if (!currentTemplateId) {
|
|
3036
|
-
return /* @__PURE__ */
|
|
3503
|
+
return /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected");
|
|
3037
3504
|
}
|
|
3038
|
-
return /* @__PURE__ */
|
|
3505
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React72.createElement(Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React72.createElement(
|
|
3039
3506
|
Typography,
|
|
3040
3507
|
{
|
|
3041
3508
|
variant: "body2",
|
|
@@ -3048,29 +3515,29 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
|
|
|
3048
3515
|
}
|
|
3049
3516
|
},
|
|
3050
3517
|
"Save functionality is disabled. To enable saving, provide the necessary callback functions."
|
|
3051
|
-
), persistenceEnabled && /* @__PURE__ */
|
|
3518
|
+
), persistenceEnabled && /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
3052
3519
|
Button$1,
|
|
3053
3520
|
{
|
|
3054
3521
|
variant: "outlined",
|
|
3055
3522
|
color: "primary",
|
|
3056
|
-
startIcon: /* @__PURE__ */
|
|
3523
|
+
startIcon: /* @__PURE__ */ React72.createElement(ContentCopyOutlined, null),
|
|
3057
3524
|
onClick: handleCopyToSamples,
|
|
3058
3525
|
fullWidth: true,
|
|
3059
3526
|
disabled: !copyTemplate
|
|
3060
3527
|
},
|
|
3061
3528
|
"Save as Sample Template"
|
|
3062
|
-
), /* @__PURE__ */
|
|
3529
|
+
), /* @__PURE__ */ React72.createElement(
|
|
3063
3530
|
Button$1,
|
|
3064
3531
|
{
|
|
3065
3532
|
variant: "outlined",
|
|
3066
3533
|
color: "error",
|
|
3067
|
-
startIcon: /* @__PURE__ */
|
|
3534
|
+
startIcon: /* @__PURE__ */ React72.createElement(DeleteOutlined, null),
|
|
3068
3535
|
onClick: handleDelete,
|
|
3069
3536
|
fullWidth: true,
|
|
3070
3537
|
disabled: !deleteTemplate
|
|
3071
3538
|
},
|
|
3072
3539
|
"Delete Template"
|
|
3073
|
-
)))), persistenceEnabled && /* @__PURE__ */
|
|
3540
|
+
)))), persistenceEnabled && /* @__PURE__ */ React72.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React72.createElement(Stack, { spacing: 2 }, /* @__PURE__ */ React72.createElement(TemplateDownloadButton, null))));
|
|
3074
3541
|
}
|
|
3075
3542
|
|
|
3076
3543
|
// src/app/inspector-drawer/index.tsx
|
|
@@ -3087,11 +3554,11 @@ function InspectorDrawer({
|
|
|
3087
3554
|
const renderCurrentSidebarPanel = () => {
|
|
3088
3555
|
switch (selectedSidebarTab) {
|
|
3089
3556
|
case "block-configuration":
|
|
3090
|
-
return /* @__PURE__ */
|
|
3557
|
+
return /* @__PURE__ */ React72.createElement(ConfigurationPanel, null);
|
|
3091
3558
|
case "styles":
|
|
3092
|
-
return /* @__PURE__ */
|
|
3559
|
+
return /* @__PURE__ */ React72.createElement(StylesPanel, null);
|
|
3093
3560
|
case "template-settings":
|
|
3094
|
-
return /* @__PURE__ */
|
|
3561
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3095
3562
|
TemplatePanel,
|
|
3096
3563
|
{
|
|
3097
3564
|
deleteTemplate,
|
|
@@ -3100,7 +3567,7 @@ function InspectorDrawer({
|
|
|
3100
3567
|
);
|
|
3101
3568
|
}
|
|
3102
3569
|
};
|
|
3103
|
-
return /* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3104
3571
|
Drawer,
|
|
3105
3572
|
{
|
|
3106
3573
|
variant: "persistent",
|
|
@@ -3122,8 +3589,8 @@ function InspectorDrawer({
|
|
|
3122
3589
|
width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
|
|
3123
3590
|
}
|
|
3124
3591
|
},
|
|
3125
|
-
/* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ React72.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React72.createElement(Box, { px: 2 }, /* @__PURE__ */ React72.createElement(Tabs, { value: selectedSidebarTab, onChange: (_, v) => setSidebarTab(v) }, /* @__PURE__ */ React72.createElement(Tab, { value: "styles", label: "Styles" }), /* @__PURE__ */ React72.createElement(Tab, { value: "block-configuration", label: "Inspect" }), /* @__PURE__ */ React72.createElement(Tab, { value: "template-settings", label: "Settings" })))),
|
|
3593
|
+
/* @__PURE__ */ React72.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
|
|
3127
3594
|
);
|
|
3128
3595
|
}
|
|
3129
3596
|
function SidebarButton({
|
|
@@ -3145,7 +3612,7 @@ function SidebarButton({
|
|
|
3145
3612
|
console.error("Error loading template:", error);
|
|
3146
3613
|
}
|
|
3147
3614
|
});
|
|
3148
|
-
return /* @__PURE__ */
|
|
3615
|
+
return /* @__PURE__ */ React72.createElement(Button$1, { size: "small", onClick: handleClick, sx: sx2 }, children);
|
|
3149
3616
|
}
|
|
3150
3617
|
|
|
3151
3618
|
// sample-templates/empty-email-message.ts
|
|
@@ -3234,7 +3701,7 @@ function SamplesDrawer({
|
|
|
3234
3701
|
if (!enabled) {
|
|
3235
3702
|
return null;
|
|
3236
3703
|
}
|
|
3237
|
-
return /* @__PURE__ */
|
|
3704
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
3238
3705
|
Drawer,
|
|
3239
3706
|
{
|
|
3240
3707
|
variant: "persistent",
|
|
@@ -3256,7 +3723,7 @@ function SamplesDrawer({
|
|
|
3256
3723
|
width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0
|
|
3257
3724
|
}
|
|
3258
3725
|
},
|
|
3259
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ React72.createElement(
|
|
3260
3727
|
Stack,
|
|
3261
3728
|
{
|
|
3262
3729
|
spacing: 3,
|
|
@@ -3266,7 +3733,7 @@ function SamplesDrawer({
|
|
|
3266
3733
|
justifyContent: "space-between",
|
|
3267
3734
|
height: "100%"
|
|
3268
3735
|
},
|
|
3269
|
-
/* @__PURE__ */
|
|
3736
|
+
/* @__PURE__ */ React72.createElement(
|
|
3270
3737
|
Stack,
|
|
3271
3738
|
{
|
|
3272
3739
|
spacing: 2,
|
|
@@ -3277,8 +3744,8 @@ function SamplesDrawer({
|
|
|
3277
3744
|
}
|
|
3278
3745
|
}
|
|
3279
3746
|
},
|
|
3280
|
-
/* @__PURE__ */
|
|
3281
|
-
loadTemplates && /* @__PURE__ */
|
|
3747
|
+
/* @__PURE__ */ React72.createElement(Typography, { variant: "h6", component: "h1", sx: { p: 2 } }, "Templates"),
|
|
3748
|
+
loadTemplates && /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
3282
3749
|
Typography,
|
|
3283
3750
|
{
|
|
3284
3751
|
variant: "subtitle2",
|
|
@@ -3286,7 +3753,7 @@ function SamplesDrawer({
|
|
|
3286
3753
|
sx: { fontWeight: "bold", mt: 2 }
|
|
3287
3754
|
},
|
|
3288
3755
|
"Your Templates"
|
|
3289
|
-
), loadingTemplates ? /* @__PURE__ */
|
|
3756
|
+
), loadingTemplates ? /* @__PURE__ */ React72.createElement(Stack, { alignItems: "center", width: "100%", py: 1 }, /* @__PURE__ */ React72.createElement(CircularProgress, { size: 24 })) : templates.length > 0 ? /* @__PURE__ */ React72.createElement(Stack, { alignItems: "flex-start", width: "100%" }, templates.map((template) => /* @__PURE__ */ React72.createElement(
|
|
3290
3757
|
Box,
|
|
3291
3758
|
{
|
|
3292
3759
|
key: template.id,
|
|
@@ -3301,7 +3768,7 @@ function SamplesDrawer({
|
|
|
3301
3768
|
}
|
|
3302
3769
|
}
|
|
3303
3770
|
},
|
|
3304
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ React72.createElement(
|
|
3305
3772
|
SidebarButton,
|
|
3306
3773
|
{
|
|
3307
3774
|
templateId: template.id,
|
|
@@ -3310,15 +3777,15 @@ function SamplesDrawer({
|
|
|
3310
3777
|
},
|
|
3311
3778
|
template.name
|
|
3312
3779
|
)
|
|
3313
|
-
))) : /* @__PURE__ */
|
|
3780
|
+
))) : /* @__PURE__ */ React72.createElement(
|
|
3314
3781
|
Typography,
|
|
3315
3782
|
{
|
|
3316
3783
|
variant: "body2",
|
|
3317
3784
|
sx: { color: "text.secondary", py: 1 }
|
|
3318
3785
|
},
|
|
3319
3786
|
"No saved templates"
|
|
3320
|
-
), /* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
3787
|
+
), /* @__PURE__ */ React72.createElement(Divider$1, null)),
|
|
3788
|
+
/* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
3322
3789
|
Typography,
|
|
3323
3790
|
{
|
|
3324
3791
|
variant: "subtitle2",
|
|
@@ -3326,7 +3793,7 @@ function SamplesDrawer({
|
|
|
3326
3793
|
sx: { fontWeight: "bold", mt: 1 }
|
|
3327
3794
|
},
|
|
3328
3795
|
"Sample Templates"
|
|
3329
|
-
), loadingSamples ? /* @__PURE__ */
|
|
3796
|
+
), loadingSamples ? /* @__PURE__ */ React72.createElement(Stack, { alignItems: "center", width: "100%", py: 1 }, /* @__PURE__ */ React72.createElement(CircularProgress, { size: 24 })) : /* @__PURE__ */ React72.createElement(Stack, { alignItems: "flex-start" }, samples.map((sample) => /* @__PURE__ */ React72.createElement(
|
|
3330
3797
|
SidebarButton,
|
|
3331
3798
|
{
|
|
3332
3799
|
key: sample.id,
|
|
@@ -3351,7 +3818,7 @@ var ICON_SX = {
|
|
|
3351
3818
|
borderColor: "cadet.300"
|
|
3352
3819
|
};
|
|
3353
3820
|
function BlockTypeButton({ label, icon, onClick }) {
|
|
3354
|
-
return /* @__PURE__ */
|
|
3821
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3355
3822
|
Button$1,
|
|
3356
3823
|
{
|
|
3357
3824
|
sx: BUTTON_SX2,
|
|
@@ -3360,14 +3827,14 @@ function BlockTypeButton({ label, icon, onClick }) {
|
|
|
3360
3827
|
onClick();
|
|
3361
3828
|
}
|
|
3362
3829
|
},
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3830
|
+
/* @__PURE__ */ React72.createElement(Box, { sx: ICON_SX }, icon),
|
|
3831
|
+
/* @__PURE__ */ React72.createElement(Typography, { variant: "body2" }, label)
|
|
3365
3832
|
);
|
|
3366
3833
|
}
|
|
3367
3834
|
var BUTTONS = [
|
|
3368
3835
|
{
|
|
3369
3836
|
label: "Heading",
|
|
3370
|
-
icon: /* @__PURE__ */
|
|
3837
|
+
icon: /* @__PURE__ */ React72.createElement(HMobiledataOutlined, null),
|
|
3371
3838
|
block: () => ({
|
|
3372
3839
|
type: "Heading",
|
|
3373
3840
|
data: {
|
|
@@ -3380,7 +3847,7 @@ var BUTTONS = [
|
|
|
3380
3847
|
},
|
|
3381
3848
|
{
|
|
3382
3849
|
label: "Text",
|
|
3383
|
-
icon: /* @__PURE__ */
|
|
3850
|
+
icon: /* @__PURE__ */ React72.createElement(NotesOutlined, null),
|
|
3384
3851
|
block: () => ({
|
|
3385
3852
|
type: "Text",
|
|
3386
3853
|
data: {
|
|
@@ -3394,7 +3861,7 @@ var BUTTONS = [
|
|
|
3394
3861
|
},
|
|
3395
3862
|
{
|
|
3396
3863
|
label: "Button",
|
|
3397
|
-
icon: /* @__PURE__ */
|
|
3864
|
+
icon: /* @__PURE__ */ React72.createElement(SmartButtonOutlined, null),
|
|
3398
3865
|
block: () => ({
|
|
3399
3866
|
type: "Button",
|
|
3400
3867
|
data: {
|
|
@@ -3408,7 +3875,7 @@ var BUTTONS = [
|
|
|
3408
3875
|
},
|
|
3409
3876
|
{
|
|
3410
3877
|
label: "Image",
|
|
3411
|
-
icon: /* @__PURE__ */
|
|
3878
|
+
icon: /* @__PURE__ */ React72.createElement(ImageOutlined, null),
|
|
3412
3879
|
block: () => ({
|
|
3413
3880
|
type: "Image",
|
|
3414
3881
|
data: {
|
|
@@ -3424,7 +3891,7 @@ var BUTTONS = [
|
|
|
3424
3891
|
},
|
|
3425
3892
|
{
|
|
3426
3893
|
label: "Avatar",
|
|
3427
|
-
icon: /* @__PURE__ */
|
|
3894
|
+
icon: /* @__PURE__ */ React72.createElement(AccountCircleOutlined, null),
|
|
3428
3895
|
block: () => ({
|
|
3429
3896
|
type: "Avatar",
|
|
3430
3897
|
data: {
|
|
@@ -3436,9 +3903,51 @@ var BUTTONS = [
|
|
|
3436
3903
|
}
|
|
3437
3904
|
})
|
|
3438
3905
|
},
|
|
3906
|
+
{
|
|
3907
|
+
label: "Personal Signature",
|
|
3908
|
+
icon: /* @__PURE__ */ React72.createElement(ContactMailOutlined, null),
|
|
3909
|
+
block: () => ({
|
|
3910
|
+
type: "Signature",
|
|
3911
|
+
data: {
|
|
3912
|
+
props: {
|
|
3913
|
+
greeting: "Best regards,",
|
|
3914
|
+
name: "John Doe",
|
|
3915
|
+
title: "Software Engineer",
|
|
3916
|
+
company: "Acme Inc.",
|
|
3917
|
+
email: "john@example.com",
|
|
3918
|
+
phone: "+1 234 567 890",
|
|
3919
|
+
imageUrl: "https://ui-avatars.com/api/?name=John+Doe&size=128",
|
|
3920
|
+
imageSize: 64,
|
|
3921
|
+
imageShape: "circle",
|
|
3922
|
+
layout: "horizontal"
|
|
3923
|
+
},
|
|
3924
|
+
style: { padding: { top: 16, bottom: 16, left: 24, right: 24 } }
|
|
3925
|
+
}
|
|
3926
|
+
})
|
|
3927
|
+
},
|
|
3928
|
+
{
|
|
3929
|
+
label: "Company Signature",
|
|
3930
|
+
icon: /* @__PURE__ */ React72.createElement(BusinessOutlined, null),
|
|
3931
|
+
block: () => ({
|
|
3932
|
+
type: "Signature",
|
|
3933
|
+
data: {
|
|
3934
|
+
props: {
|
|
3935
|
+
company: "Acme Inc.",
|
|
3936
|
+
address: "123 Main Street, City, Country",
|
|
3937
|
+
email: "support@example.com",
|
|
3938
|
+
website: "www.example.com",
|
|
3939
|
+
imageUrl: "https://placehold.co/128x128/EEE/999?text=Logo",
|
|
3940
|
+
imageSize: 48,
|
|
3941
|
+
imageShape: "rounded",
|
|
3942
|
+
layout: "horizontal"
|
|
3943
|
+
},
|
|
3944
|
+
style: { padding: { top: 16, bottom: 16, left: 24, right: 24 } }
|
|
3945
|
+
}
|
|
3946
|
+
})
|
|
3947
|
+
},
|
|
3439
3948
|
{
|
|
3440
3949
|
label: "Divider",
|
|
3441
|
-
icon: /* @__PURE__ */
|
|
3950
|
+
icon: /* @__PURE__ */ React72.createElement(HorizontalRuleOutlined, null),
|
|
3442
3951
|
block: () => ({
|
|
3443
3952
|
type: "Divider",
|
|
3444
3953
|
data: {
|
|
@@ -3451,7 +3960,7 @@ var BUTTONS = [
|
|
|
3451
3960
|
},
|
|
3452
3961
|
{
|
|
3453
3962
|
label: "Spacer",
|
|
3454
|
-
icon: /* @__PURE__ */
|
|
3963
|
+
icon: /* @__PURE__ */ React72.createElement(Crop32Outlined, null),
|
|
3455
3964
|
block: () => ({
|
|
3456
3965
|
type: "Spacer",
|
|
3457
3966
|
data: {}
|
|
@@ -3459,7 +3968,7 @@ var BUTTONS = [
|
|
|
3459
3968
|
},
|
|
3460
3969
|
{
|
|
3461
3970
|
label: "Html",
|
|
3462
|
-
icon: /* @__PURE__ */
|
|
3971
|
+
icon: /* @__PURE__ */ React72.createElement(HtmlOutlined, null),
|
|
3463
3972
|
block: () => ({
|
|
3464
3973
|
type: "Html",
|
|
3465
3974
|
data: {
|
|
@@ -3474,7 +3983,7 @@ var BUTTONS = [
|
|
|
3474
3983
|
},
|
|
3475
3984
|
{
|
|
3476
3985
|
label: "Columns",
|
|
3477
|
-
icon: /* @__PURE__ */
|
|
3986
|
+
icon: /* @__PURE__ */ React72.createElement(ViewColumnOutlined, null),
|
|
3478
3987
|
block: () => ({
|
|
3479
3988
|
type: "ColumnsContainer",
|
|
3480
3989
|
data: {
|
|
@@ -3489,7 +3998,7 @@ var BUTTONS = [
|
|
|
3489
3998
|
},
|
|
3490
3999
|
{
|
|
3491
4000
|
label: "Container",
|
|
3492
|
-
icon: /* @__PURE__ */
|
|
4001
|
+
icon: /* @__PURE__ */ React72.createElement(LibraryAddOutlined, null),
|
|
3493
4002
|
block: () => ({
|
|
3494
4003
|
type: "Container",
|
|
3495
4004
|
data: {
|
|
@@ -3513,7 +4022,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
3513
4022
|
if (anchorEl === null) {
|
|
3514
4023
|
return null;
|
|
3515
4024
|
}
|
|
3516
|
-
return /* @__PURE__ */
|
|
4025
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3517
4026
|
Menu,
|
|
3518
4027
|
{
|
|
3519
4028
|
open: true,
|
|
@@ -3522,7 +4031,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
|
|
|
3522
4031
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
3523
4032
|
transformOrigin: { vertical: "top", horizontal: "center" }
|
|
3524
4033
|
},
|
|
3525
|
-
/* @__PURE__ */
|
|
4034
|
+
/* @__PURE__ */ React72.createElement(Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React72.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
|
|
3526
4035
|
);
|
|
3527
4036
|
}
|
|
3528
4037
|
function DividerButton({ buttonElement, onClick }) {
|
|
@@ -3549,7 +4058,7 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
3549
4058
|
window.removeEventListener("mousemove", listener);
|
|
3550
4059
|
};
|
|
3551
4060
|
}, [buttonElement, setVisible]);
|
|
3552
|
-
return /* @__PURE__ */
|
|
4061
|
+
return /* @__PURE__ */ React72.createElement(Fade, { in: visible }, /* @__PURE__ */ React72.createElement(
|
|
3553
4062
|
IconButton,
|
|
3554
4063
|
{
|
|
3555
4064
|
size: "small",
|
|
@@ -3572,11 +4081,11 @@ function DividerButton({ buttonElement, onClick }) {
|
|
|
3572
4081
|
onClick();
|
|
3573
4082
|
}
|
|
3574
4083
|
},
|
|
3575
|
-
/* @__PURE__ */
|
|
4084
|
+
/* @__PURE__ */ React72.createElement(AddOutlined, { fontSize: "small" })
|
|
3576
4085
|
));
|
|
3577
4086
|
}
|
|
3578
4087
|
function PlaceholderButton({ onClick }) {
|
|
3579
|
-
return /* @__PURE__ */
|
|
4088
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3580
4089
|
ButtonBase,
|
|
3581
4090
|
{
|
|
3582
4091
|
onClick: (ev) => {
|
|
@@ -3592,7 +4101,7 @@ function PlaceholderButton({ onClick }) {
|
|
|
3592
4101
|
bgcolor: "rgba(0,0,0, 0.05)"
|
|
3593
4102
|
}
|
|
3594
4103
|
},
|
|
3595
|
-
/* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ React72.createElement(
|
|
3596
4105
|
AddOutlined,
|
|
3597
4106
|
{
|
|
3598
4107
|
sx: {
|
|
@@ -3614,14 +4123,14 @@ function AddBlockButton({ onSelect, placeholder }) {
|
|
|
3614
4123
|
const handleButtonClick = () => {
|
|
3615
4124
|
setMenuAnchorEl(buttonElement);
|
|
3616
4125
|
};
|
|
3617
|
-
const
|
|
4126
|
+
const renderButton2 = () => {
|
|
3618
4127
|
if (placeholder) {
|
|
3619
|
-
return /* @__PURE__ */
|
|
4128
|
+
return /* @__PURE__ */ React72.createElement(PlaceholderButton, { onClick: handleButtonClick });
|
|
3620
4129
|
} else {
|
|
3621
|
-
return /* @__PURE__ */
|
|
4130
|
+
return /* @__PURE__ */ React72.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
|
|
3622
4131
|
}
|
|
3623
4132
|
};
|
|
3624
|
-
return /* @__PURE__ */
|
|
4133
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React72.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
|
|
3625
4134
|
}
|
|
3626
4135
|
|
|
3627
4136
|
// src/editor/blocks/helpers/editor-children-ids/index.tsx
|
|
@@ -3648,9 +4157,9 @@ function EditorChildrenIds({ childrenIds, onChange }) {
|
|
|
3648
4157
|
});
|
|
3649
4158
|
};
|
|
3650
4159
|
if (!childrenIds || childrenIds.length === 0) {
|
|
3651
|
-
return /* @__PURE__ */
|
|
4160
|
+
return /* @__PURE__ */ React72.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock });
|
|
3652
4161
|
}
|
|
3653
|
-
return /* @__PURE__ */
|
|
4162
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React72.createElement(Fragment, { key: childId }, /* @__PURE__ */ React72.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), /* @__PURE__ */ React72.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React72.createElement(AddBlockButton, { onSelect: appendBlock }));
|
|
3654
4163
|
}
|
|
3655
4164
|
|
|
3656
4165
|
// src/editor/blocks/columns-container/columns-container-editor.tsx
|
|
@@ -3677,15 +4186,15 @@ function ColumnsContainerEditor({ style, props }) {
|
|
|
3677
4186
|
});
|
|
3678
4187
|
setSelectedBlockId(blockId);
|
|
3679
4188
|
};
|
|
3680
|
-
return /* @__PURE__ */
|
|
4189
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3681
4190
|
columns_container_default,
|
|
3682
4191
|
{
|
|
3683
4192
|
props: restProps,
|
|
3684
4193
|
style,
|
|
3685
4194
|
columns: [
|
|
3686
|
-
/* @__PURE__ */
|
|
3687
|
-
/* @__PURE__ */
|
|
3688
|
-
/* @__PURE__ */
|
|
4195
|
+
/* @__PURE__ */ React72.createElement(EditorChildrenIds, { childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds, onChange: (change) => updateColumn(0, change) }),
|
|
4196
|
+
/* @__PURE__ */ React72.createElement(EditorChildrenIds, { childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds, onChange: (change) => updateColumn(1, change) }),
|
|
4197
|
+
/* @__PURE__ */ React72.createElement(EditorChildrenIds, { childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds, onChange: (change) => updateColumn(2, change) })
|
|
3689
4198
|
]
|
|
3690
4199
|
}
|
|
3691
4200
|
);
|
|
@@ -3695,7 +4204,7 @@ function ContainerEditor({ style, props }) {
|
|
|
3695
4204
|
const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
|
|
3696
4205
|
const document2 = useDocument();
|
|
3697
4206
|
const currentBlockId = useCurrentBlockId();
|
|
3698
|
-
return /* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ React72.createElement(container_default, { style }, /* @__PURE__ */ React72.createElement(
|
|
3699
4208
|
EditorChildrenIds,
|
|
3700
4209
|
{
|
|
3701
4210
|
childrenIds,
|
|
@@ -3714,7 +4223,65 @@ function ContainerEditor({ style, props }) {
|
|
|
3714
4223
|
}
|
|
3715
4224
|
));
|
|
3716
4225
|
}
|
|
3717
|
-
function
|
|
4226
|
+
function generateId2() {
|
|
4227
|
+
return `block-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
4228
|
+
}
|
|
4229
|
+
function rekeyBlocks(blocks, rootBlockId) {
|
|
4230
|
+
var _a, _b, _c;
|
|
4231
|
+
const idMap = {};
|
|
4232
|
+
for (const oldId of Object.keys(blocks)) {
|
|
4233
|
+
idMap[oldId] = generateId2();
|
|
4234
|
+
}
|
|
4235
|
+
const remapIds = (ids) => ids == null ? void 0 : ids.map((id) => {
|
|
4236
|
+
var _a2;
|
|
4237
|
+
return (_a2 = idMap[id]) != null ? _a2 : id;
|
|
4238
|
+
});
|
|
4239
|
+
const newBlocks = {};
|
|
4240
|
+
for (const [oldId, block] of Object.entries(blocks)) {
|
|
4241
|
+
const b = block;
|
|
4242
|
+
const newId = idMap[oldId];
|
|
4243
|
+
if (b.type === "Container") {
|
|
4244
|
+
newBlocks[newId] = __spreadProps(__spreadValues({}, b), {
|
|
4245
|
+
data: __spreadProps(__spreadValues({}, b.data), {
|
|
4246
|
+
props: __spreadProps(__spreadValues({}, b.data.props), { childrenIds: remapIds((_a = b.data.props) == null ? void 0 : _a.childrenIds) })
|
|
4247
|
+
})
|
|
4248
|
+
});
|
|
4249
|
+
} else if (b.type === "ColumnsContainer") {
|
|
4250
|
+
newBlocks[newId] = __spreadProps(__spreadValues({}, b), {
|
|
4251
|
+
data: __spreadProps(__spreadValues({}, b.data), {
|
|
4252
|
+
props: __spreadProps(__spreadValues({}, b.data.props), {
|
|
4253
|
+
columns: (_c = (_b = b.data.props) == null ? void 0 : _b.columns) == null ? void 0 : _c.map((c) => __spreadProps(__spreadValues({}, c), {
|
|
4254
|
+
childrenIds: remapIds(c.childrenIds)
|
|
4255
|
+
}))
|
|
4256
|
+
})
|
|
4257
|
+
})
|
|
4258
|
+
});
|
|
4259
|
+
} else {
|
|
4260
|
+
newBlocks[newId] = b;
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
return { blocks: newBlocks, newRootId: idMap[rootBlockId] };
|
|
4264
|
+
}
|
|
4265
|
+
function collectBlock(blockId, document2) {
|
|
4266
|
+
var _a, _b, _c, _d, _e;
|
|
4267
|
+
const block = document2[blockId];
|
|
4268
|
+
if (!block) return {};
|
|
4269
|
+
const result = { [blockId]: block };
|
|
4270
|
+
if (block.type === "Container") {
|
|
4271
|
+
for (const childId of (_b = (_a = block.data.props) == null ? void 0 : _a.childrenIds) != null ? _b : []) {
|
|
4272
|
+
Object.assign(result, collectBlock(childId, document2));
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
if (block.type === "ColumnsContainer") {
|
|
4276
|
+
for (const col of (_d = (_c = block.data.props) == null ? void 0 : _c.columns) != null ? _d : []) {
|
|
4277
|
+
for (const childId of (_e = col.childrenIds) != null ? _e : []) {
|
|
4278
|
+
Object.assign(result, collectBlock(childId, document2));
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
return result;
|
|
4283
|
+
}
|
|
4284
|
+
function getFontFamily7(fontFamily) {
|
|
3718
4285
|
const f = fontFamily != null ? fontFamily : "MODERN_SANS";
|
|
3719
4286
|
switch (f) {
|
|
3720
4287
|
case "MODERN_SANS":
|
|
@@ -3742,16 +4309,102 @@ function EmailLayoutEditor(props) {
|
|
|
3742
4309
|
const childrenIds = (_a = props.childrenIds) != null ? _a : [];
|
|
3743
4310
|
const document2 = useDocument();
|
|
3744
4311
|
const currentBlockId = useCurrentBlockId();
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
4312
|
+
const selectedBlockId = useSelectedBlockId();
|
|
4313
|
+
const handleDelete = useCallback((e) => {
|
|
4314
|
+
var _a2, _b2, _c2;
|
|
4315
|
+
if (e.key !== "Delete" && e.key !== "Backspace") return;
|
|
4316
|
+
if (!selectedBlockId) return;
|
|
4317
|
+
const target = e.target;
|
|
4318
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
4319
|
+
return;
|
|
4320
|
+
}
|
|
4321
|
+
e.preventDefault();
|
|
4322
|
+
const filterChildrenIds = (ids) => ids == null ? void 0 : ids.filter((id) => id !== selectedBlockId);
|
|
4323
|
+
const nDocument = __spreadValues({}, document2);
|
|
4324
|
+
for (const [id, b] of Object.entries(nDocument)) {
|
|
4325
|
+
const block = b;
|
|
4326
|
+
if (id === selectedBlockId) continue;
|
|
4327
|
+
switch (block.type) {
|
|
4328
|
+
case "EmailLayout":
|
|
4329
|
+
nDocument[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, block.data), { childrenIds: filterChildrenIds(block.data.childrenIds) }) });
|
|
4330
|
+
break;
|
|
4331
|
+
case "Container":
|
|
4332
|
+
nDocument[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, block.data), { props: __spreadProps(__spreadValues({}, block.data.props), { childrenIds: filterChildrenIds((_a2 = block.data.props) == null ? void 0 : _a2.childrenIds) }) }) });
|
|
4333
|
+
break;
|
|
4334
|
+
case "ColumnsContainer":
|
|
4335
|
+
nDocument[id] = __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, block.data), { props: __spreadProps(__spreadValues({}, block.data.props), { columns: (_c2 = (_b2 = block.data.props) == null ? void 0 : _b2.columns) == null ? void 0 : _c2.map((c) => __spreadProps(__spreadValues({}, c), { childrenIds: filterChildrenIds(c.childrenIds) })) }) }) });
|
|
4336
|
+
break;
|
|
4337
|
+
default:
|
|
4338
|
+
nDocument[id] = block;
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
delete nDocument[selectedBlockId];
|
|
4342
|
+
resetDocument(nDocument);
|
|
4343
|
+
}, [selectedBlockId, document2]);
|
|
4344
|
+
const handleCopy = useCallback((e) => {
|
|
4345
|
+
if (!(e.metaKey || e.ctrlKey) || e.key !== "c") return;
|
|
4346
|
+
if (!selectedBlockId) return;
|
|
4347
|
+
const target = e.target;
|
|
4348
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
4349
|
+
return;
|
|
4350
|
+
}
|
|
4351
|
+
const blocks = collectBlock(selectedBlockId, document2);
|
|
4352
|
+
if (Object.keys(blocks).length === 0) return;
|
|
4353
|
+
e.preventDefault();
|
|
4354
|
+
const payload = JSON.stringify({ __emailEditorBlocks: true, rootBlockId: selectedBlockId, blocks });
|
|
4355
|
+
navigator.clipboard.writeText(payload);
|
|
4356
|
+
}, [selectedBlockId, document2]);
|
|
4357
|
+
const handlePaste = useCallback((e) => __async(null, null, function* () {
|
|
4358
|
+
var _a2;
|
|
4359
|
+
const target = e.target;
|
|
4360
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
4361
|
+
return;
|
|
4362
|
+
}
|
|
4363
|
+
const text = (_a2 = e.clipboardData) == null ? void 0 : _a2.getData("text/plain");
|
|
4364
|
+
if (!text) return;
|
|
4365
|
+
let parsed;
|
|
4366
|
+
try {
|
|
4367
|
+
parsed = JSON.parse(text);
|
|
4368
|
+
} catch (e2) {
|
|
4369
|
+
return;
|
|
4370
|
+
}
|
|
4371
|
+
if (!(parsed == null ? void 0 : parsed.__emailEditorBlocks) || !parsed.rootBlockId || !parsed.blocks) return;
|
|
4372
|
+
e.preventDefault();
|
|
4373
|
+
const { blocks: newBlocks, newRootId } = rekeyBlocks(parsed.blocks, parsed.rootBlockId);
|
|
4374
|
+
const doc = __spreadValues({}, document2);
|
|
4375
|
+
Object.assign(doc, newBlocks);
|
|
4376
|
+
const currentChildrenIds = [...childrenIds || []];
|
|
4377
|
+
const insertIndex = selectedBlockId ? currentChildrenIds.indexOf(selectedBlockId) + 1 : currentChildrenIds.length;
|
|
4378
|
+
currentChildrenIds.splice(insertIndex, 0, newRootId);
|
|
4379
|
+
doc[currentBlockId] = {
|
|
4380
|
+
type: "EmailLayout",
|
|
4381
|
+
data: __spreadProps(__spreadValues({}, document2[currentBlockId].data), {
|
|
4382
|
+
childrenIds: currentChildrenIds
|
|
4383
|
+
})
|
|
4384
|
+
};
|
|
4385
|
+
resetDocument(doc);
|
|
4386
|
+
setSelectedBlockId(newRootId);
|
|
4387
|
+
}), [document2, childrenIds, selectedBlockId, currentBlockId]);
|
|
4388
|
+
useEffect(() => {
|
|
4389
|
+
window.addEventListener("keydown", handleDelete);
|
|
4390
|
+
window.addEventListener("keydown", handleCopy);
|
|
4391
|
+
window.addEventListener("paste", handlePaste);
|
|
4392
|
+
return () => {
|
|
4393
|
+
window.removeEventListener("keydown", handleDelete);
|
|
4394
|
+
window.removeEventListener("keydown", handleCopy);
|
|
4395
|
+
window.removeEventListener("paste", handlePaste);
|
|
4396
|
+
};
|
|
4397
|
+
}, [handleDelete, handleCopy, handlePaste]);
|
|
4398
|
+
return /* @__PURE__ */ React72.createElement(
|
|
4399
|
+
"div",
|
|
4400
|
+
{
|
|
4401
|
+
onClick: () => {
|
|
4402
|
+
setSelectedBlockId(null);
|
|
4403
|
+
},
|
|
4404
|
+
style: {
|
|
4405
|
+
backgroundColor: (_b = props.backdropColor) != null ? _b : "#F5F5F5",
|
|
4406
|
+
color: (_c = props.textColor) != null ? _c : "#262626",
|
|
4407
|
+
fontFamily: getFontFamily7(props.fontFamily),
|
|
3755
4408
|
fontSize: "16px",
|
|
3756
4409
|
fontWeight: "400",
|
|
3757
4410
|
letterSpacing: "0.15008px",
|
|
@@ -3762,7 +4415,7 @@ function EmailLayoutEditor(props) {
|
|
|
3762
4415
|
minHeight: "100%"
|
|
3763
4416
|
}
|
|
3764
4417
|
},
|
|
3765
|
-
/* @__PURE__ */
|
|
4418
|
+
/* @__PURE__ */ React72.createElement(
|
|
3766
4419
|
"table",
|
|
3767
4420
|
{
|
|
3768
4421
|
align: "center",
|
|
@@ -3785,7 +4438,7 @@ function EmailLayoutEditor(props) {
|
|
|
3785
4438
|
cellPadding: "0",
|
|
3786
4439
|
border: 0
|
|
3787
4440
|
},
|
|
3788
|
-
/* @__PURE__ */
|
|
4441
|
+
/* @__PURE__ */ React72.createElement("tbody", null, /* @__PURE__ */ React72.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React72.createElement("td", null, /* @__PURE__ */ React72.createElement(
|
|
3789
4442
|
EditorChildrenIds,
|
|
3790
4443
|
{
|
|
3791
4444
|
childrenIds,
|
|
@@ -3815,6 +4468,33 @@ var sx = {
|
|
|
3815
4468
|
paddingY: 1,
|
|
3816
4469
|
zIndex: "fab"
|
|
3817
4470
|
};
|
|
4471
|
+
function collectBlock2(blockId, document2) {
|
|
4472
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4473
|
+
const block = document2[blockId];
|
|
4474
|
+
if (!block) return {};
|
|
4475
|
+
const result = { [blockId]: block };
|
|
4476
|
+
if (block.type === "Container") {
|
|
4477
|
+
const childrenIds = (_b = (_a = block.data.props) == null ? void 0 : _a.childrenIds) != null ? _b : [];
|
|
4478
|
+
for (const childId of childrenIds) {
|
|
4479
|
+
Object.assign(result, collectBlock2(childId, document2));
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
if (block.type === "ColumnsContainer") {
|
|
4483
|
+
const columns = (_d = (_c = block.data.props) == null ? void 0 : _c.columns) != null ? _d : [];
|
|
4484
|
+
for (const col of columns) {
|
|
4485
|
+
for (const childId of (_e = col.childrenIds) != null ? _e : []) {
|
|
4486
|
+
Object.assign(result, collectBlock2(childId, document2));
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
if (block.type === "EmailLayout") {
|
|
4491
|
+
const childrenIds = (_f = block.data.childrenIds) != null ? _f : [];
|
|
4492
|
+
for (const childId of childrenIds) {
|
|
4493
|
+
Object.assign(result, collectBlock2(childId, document2));
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
return result;
|
|
4497
|
+
}
|
|
3818
4498
|
function TuneMenu({ blockId }) {
|
|
3819
4499
|
const document2 = useDocument();
|
|
3820
4500
|
const handleDeleteClick = () => {
|
|
@@ -3868,6 +4548,11 @@ function TuneMenu({ blockId }) {
|
|
|
3868
4548
|
delete nDocument[blockId];
|
|
3869
4549
|
resetDocument(nDocument);
|
|
3870
4550
|
};
|
|
4551
|
+
const handleCopyClick = () => {
|
|
4552
|
+
const blocks = collectBlock2(blockId, document2);
|
|
4553
|
+
const payload = JSON.stringify({ __emailEditorBlocks: true, rootBlockId: blockId, blocks });
|
|
4554
|
+
navigator.clipboard.writeText(payload);
|
|
4555
|
+
};
|
|
3871
4556
|
const handleMoveClick = (direction) => {
|
|
3872
4557
|
var _a, _b, _c;
|
|
3873
4558
|
const moveChildrenIds = (ids) => {
|
|
@@ -3929,7 +4614,7 @@ function TuneMenu({ blockId }) {
|
|
|
3929
4614
|
resetDocument(nDocument);
|
|
3930
4615
|
setSelectedBlockId(blockId);
|
|
3931
4616
|
};
|
|
3932
|
-
return /* @__PURE__ */
|
|
4617
|
+
return /* @__PURE__ */ React72.createElement(Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React72.createElement(Stack, null, /* @__PURE__ */ React72.createElement(Tooltip, { title: "Move up", placement: "left-start" }, /* @__PURE__ */ React72.createElement(IconButton, { onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React72.createElement(ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React72.createElement(Tooltip, { title: "Move down", placement: "left-start" }, /* @__PURE__ */ React72.createElement(IconButton, { onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React72.createElement(ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React72.createElement(Tooltip, { title: "Copy block", placement: "left-start" }, /* @__PURE__ */ React72.createElement(IconButton, { onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React72.createElement(ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React72.createElement(Tooltip, { title: "Delete", placement: "left-start" }, /* @__PURE__ */ React72.createElement(IconButton, { onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React72.createElement(DeleteOutlined, { fontSize: "small" })))));
|
|
3933
4618
|
}
|
|
3934
4619
|
|
|
3935
4620
|
// src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
|
|
@@ -3947,9 +4632,9 @@ function EditorBlockWrapper({ children }) {
|
|
|
3947
4632
|
if (selectedBlockId !== blockId) {
|
|
3948
4633
|
return null;
|
|
3949
4634
|
}
|
|
3950
|
-
return /* @__PURE__ */
|
|
4635
|
+
return /* @__PURE__ */ React72.createElement(TuneMenu, { blockId });
|
|
3951
4636
|
};
|
|
3952
|
-
return /* @__PURE__ */
|
|
4637
|
+
return /* @__PURE__ */ React72.createElement(
|
|
3953
4638
|
Box,
|
|
3954
4639
|
{
|
|
3955
4640
|
sx: {
|
|
@@ -3968,14 +4653,131 @@ function EditorBlockWrapper({ children }) {
|
|
|
3968
4653
|
onClick: (ev) => {
|
|
3969
4654
|
setSelectedBlockId(blockId);
|
|
3970
4655
|
ev.stopPropagation();
|
|
3971
|
-
ev.preventDefault();
|
|
3972
4656
|
}
|
|
3973
4657
|
},
|
|
3974
4658
|
renderMenu(),
|
|
3975
4659
|
children
|
|
3976
4660
|
);
|
|
3977
4661
|
}
|
|
3978
|
-
function
|
|
4662
|
+
function getFontFamily8(fontFamily) {
|
|
4663
|
+
switch (fontFamily) {
|
|
4664
|
+
case "MODERN_SANS":
|
|
4665
|
+
return '"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif';
|
|
4666
|
+
case "BOOK_SANS":
|
|
4667
|
+
return 'Optima, Candara, "Noto Sans", source-sans-pro, sans-serif';
|
|
4668
|
+
case "ORGANIC_SANS":
|
|
4669
|
+
return 'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif';
|
|
4670
|
+
case "GEOMETRIC_SANS":
|
|
4671
|
+
return 'Avenir, "Avenir Next LT Pro", Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif';
|
|
4672
|
+
case "HEAVY_SANS":
|
|
4673
|
+
return 'Bahnschrift, "DIN Alternate", "Franklin Gothic Medium", "Nimbus Sans Narrow", sans-serif-condensed, sans-serif';
|
|
4674
|
+
case "ROUNDED_SANS":
|
|
4675
|
+
return 'ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, Manjari, "Arial Rounded MT Bold", Calibri, source-sans-pro, sans-serif';
|
|
4676
|
+
case "MODERN_SERIF":
|
|
4677
|
+
return 'Charter, "Bitstream Charter", "Sitka Text", Cambria, serif';
|
|
4678
|
+
case "BOOK_SERIF":
|
|
4679
|
+
return '"Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif';
|
|
4680
|
+
case "MONOSPACE":
|
|
4681
|
+
return '"Nimbus Mono PS", "Courier New", "Cutive Mono", monospace';
|
|
4682
|
+
}
|
|
4683
|
+
return void 0;
|
|
4684
|
+
}
|
|
4685
|
+
var getPadding11 = (padding) => padding ? `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px` : void 0;
|
|
4686
|
+
function getRoundedCorners2(props) {
|
|
4687
|
+
var _a;
|
|
4688
|
+
const buttonStyle = (_a = props == null ? void 0 : props.buttonStyle) != null ? _a : ButtonPropsDefaults.buttonStyle;
|
|
4689
|
+
switch (buttonStyle) {
|
|
4690
|
+
case "rectangle":
|
|
4691
|
+
return void 0;
|
|
4692
|
+
case "pill":
|
|
4693
|
+
return 64;
|
|
4694
|
+
case "rounded":
|
|
4695
|
+
default:
|
|
4696
|
+
return 4;
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
4699
|
+
function getButtonSizePadding2(props) {
|
|
4700
|
+
var _a;
|
|
4701
|
+
const size = (_a = props == null ? void 0 : props.size) != null ? _a : ButtonPropsDefaults.size;
|
|
4702
|
+
switch (size) {
|
|
4703
|
+
case "x-small":
|
|
4704
|
+
return [4, 8];
|
|
4705
|
+
case "small":
|
|
4706
|
+
return [8, 12];
|
|
4707
|
+
case "large":
|
|
4708
|
+
return [16, 32];
|
|
4709
|
+
case "medium":
|
|
4710
|
+
default:
|
|
4711
|
+
return [12, 20];
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
function ButtonEditor({ style, props }) {
|
|
4715
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4716
|
+
const blockId = useCurrentBlockId();
|
|
4717
|
+
const selectedBlockId = useSelectedBlockId();
|
|
4718
|
+
const isSelected = selectedBlockId === blockId;
|
|
4719
|
+
const text = (_a = props == null ? void 0 : props.text) != null ? _a : ButtonPropsDefaults.text;
|
|
4720
|
+
const fullWidth = (_b = props == null ? void 0 : props.fullWidth) != null ? _b : ButtonPropsDefaults.fullWidth;
|
|
4721
|
+
const buttonTextColor = (_c = props == null ? void 0 : props.buttonTextColor) != null ? _c : ButtonPropsDefaults.buttonTextColor;
|
|
4722
|
+
const buttonBackgroundColor = (_d = props == null ? void 0 : props.buttonBackgroundColor) != null ? _d : ButtonPropsDefaults.buttonBackgroundColor;
|
|
4723
|
+
const [localText, setLocalText] = useState(text);
|
|
4724
|
+
useEffect(() => {
|
|
4725
|
+
setLocalText(text);
|
|
4726
|
+
}, [text]);
|
|
4727
|
+
const padding = getButtonSizePadding2(props);
|
|
4728
|
+
const wrapperStyle = {
|
|
4729
|
+
backgroundColor: (_e = style == null ? void 0 : style.backgroundColor) != null ? _e : void 0,
|
|
4730
|
+
textAlign: (_f = style == null ? void 0 : style.textAlign) != null ? _f : void 0,
|
|
4731
|
+
padding: getPadding11(style == null ? void 0 : style.padding)
|
|
4732
|
+
};
|
|
4733
|
+
const linkStyle = {
|
|
4734
|
+
color: buttonTextColor,
|
|
4735
|
+
fontSize: (_g = style == null ? void 0 : style.fontSize) != null ? _g : 16,
|
|
4736
|
+
fontFamily: getFontFamily8(style == null ? void 0 : style.fontFamily),
|
|
4737
|
+
fontWeight: (_h = style == null ? void 0 : style.fontWeight) != null ? _h : "bold",
|
|
4738
|
+
backgroundColor: buttonBackgroundColor,
|
|
4739
|
+
borderRadius: getRoundedCorners2(props),
|
|
4740
|
+
display: fullWidth ? "block" : "inline-block",
|
|
4741
|
+
padding: `${padding[0]}px ${padding[1]}px`,
|
|
4742
|
+
textDecoration: "none"
|
|
4743
|
+
};
|
|
4744
|
+
const handleTextChange = (e) => {
|
|
4745
|
+
const newText = e.target.value;
|
|
4746
|
+
setLocalText(newText);
|
|
4747
|
+
setDocument({
|
|
4748
|
+
[blockId]: {
|
|
4749
|
+
type: "Button",
|
|
4750
|
+
data: {
|
|
4751
|
+
style,
|
|
4752
|
+
props: __spreadProps(__spreadValues({}, props), {
|
|
4753
|
+
text: newText
|
|
4754
|
+
})
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
});
|
|
4758
|
+
};
|
|
4759
|
+
if (isSelected) {
|
|
4760
|
+
const inputStyle = __spreadProps(__spreadValues({}, linkStyle), {
|
|
4761
|
+
border: "none",
|
|
4762
|
+
outline: "none",
|
|
4763
|
+
cursor: "text",
|
|
4764
|
+
width: fullWidth ? "100%" : void 0,
|
|
4765
|
+
textAlign: "center"
|
|
4766
|
+
});
|
|
4767
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React72.createElement(
|
|
4768
|
+
"input",
|
|
4769
|
+
{
|
|
4770
|
+
type: "text",
|
|
4771
|
+
value: localText,
|
|
4772
|
+
onChange: handleTextChange,
|
|
4773
|
+
style: inputStyle,
|
|
4774
|
+
onClick: (e) => e.stopPropagation()
|
|
4775
|
+
}
|
|
4776
|
+
));
|
|
4777
|
+
}
|
|
4778
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React72.createElement("span", { style: linkStyle }, /* @__PURE__ */ React72.createElement("span", null, text)));
|
|
4779
|
+
}
|
|
4780
|
+
function getFontFamily9(fontFamily) {
|
|
3979
4781
|
switch (fontFamily) {
|
|
3980
4782
|
case "MODERN_SANS":
|
|
3981
4783
|
return '"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif';
|
|
@@ -4002,7 +4804,7 @@ function getFontFamily7(fontFamily) {
|
|
|
4002
4804
|
}
|
|
4003
4805
|
return void 0;
|
|
4004
4806
|
}
|
|
4005
|
-
function
|
|
4807
|
+
function getPadding12(padding) {
|
|
4006
4808
|
if (!padding) return void 0;
|
|
4007
4809
|
if (typeof padding === "object" && !Array.isArray(padding) && "top" in padding && "right" in padding && "bottom" in padding && "left" in padding) {
|
|
4008
4810
|
return `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px`;
|
|
@@ -4046,11 +4848,11 @@ function HeadingEditor({ style, props }) {
|
|
|
4046
4848
|
const textContent = (_b = props == null ? void 0 : props.text) != null ? _b : HeadingPropsDefaults.text;
|
|
4047
4849
|
const [localText, setLocalText] = useState(textContent);
|
|
4048
4850
|
const rootBlock = document2.root;
|
|
4049
|
-
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ?
|
|
4851
|
+
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily9(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
4050
4852
|
useEffect(() => {
|
|
4051
4853
|
setLocalText(textContent);
|
|
4052
4854
|
}, [textContent]);
|
|
4053
|
-
const fontFamily =
|
|
4855
|
+
const fontFamily = getFontFamily9(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
4054
4856
|
const hStyle = {
|
|
4055
4857
|
color: (_c = style == null ? void 0 : style.color) != null ? _c : void 0,
|
|
4056
4858
|
backgroundColor: (_d = style == null ? void 0 : style.backgroundColor) != null ? _d : void 0,
|
|
@@ -4059,7 +4861,7 @@ function HeadingEditor({ style, props }) {
|
|
|
4059
4861
|
margin: 0,
|
|
4060
4862
|
fontFamily,
|
|
4061
4863
|
fontSize: getFontSize2(level),
|
|
4062
|
-
padding:
|
|
4864
|
+
padding: getPadding12(style == null ? void 0 : style.padding),
|
|
4063
4865
|
width: "100%",
|
|
4064
4866
|
minHeight: "1em"
|
|
4065
4867
|
};
|
|
@@ -4096,7 +4898,7 @@ function HeadingEditor({ style, props }) {
|
|
|
4096
4898
|
}
|
|
4097
4899
|
};
|
|
4098
4900
|
if (isSelected) {
|
|
4099
|
-
return /* @__PURE__ */
|
|
4901
|
+
return /* @__PURE__ */ React72.createElement(
|
|
4100
4902
|
"textarea",
|
|
4101
4903
|
{
|
|
4102
4904
|
value: localText,
|
|
@@ -4111,14 +4913,310 @@ function HeadingEditor({ style, props }) {
|
|
|
4111
4913
|
}
|
|
4112
4914
|
switch (level) {
|
|
4113
4915
|
case "h1":
|
|
4114
|
-
return /* @__PURE__ */
|
|
4916
|
+
return /* @__PURE__ */ React72.createElement("h1", { style: hStyle }, textContent);
|
|
4115
4917
|
case "h2":
|
|
4116
|
-
return /* @__PURE__ */
|
|
4918
|
+
return /* @__PURE__ */ React72.createElement("h2", { style: hStyle }, textContent);
|
|
4117
4919
|
case "h3":
|
|
4118
|
-
return /* @__PURE__ */
|
|
4920
|
+
return /* @__PURE__ */ React72.createElement("h3", { style: hStyle }, textContent);
|
|
4119
4921
|
}
|
|
4120
4922
|
}
|
|
4121
|
-
function
|
|
4923
|
+
function HtmlEditor({ style, props }) {
|
|
4924
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4925
|
+
const blockId = useCurrentBlockId();
|
|
4926
|
+
const selectedBlockId = useSelectedBlockId();
|
|
4927
|
+
const isSelected = selectedBlockId === blockId;
|
|
4928
|
+
const contents = (_a = props == null ? void 0 : props.contents) != null ? _a : "";
|
|
4929
|
+
const [localContents, setLocalContents] = useState(contents);
|
|
4930
|
+
useEffect(() => {
|
|
4931
|
+
setLocalContents(contents);
|
|
4932
|
+
}, [contents]);
|
|
4933
|
+
const cssStyle = {
|
|
4934
|
+
color: (_b = style == null ? void 0 : style.color) != null ? _b : void 0,
|
|
4935
|
+
backgroundColor: (_c = style == null ? void 0 : style.backgroundColor) != null ? _c : void 0,
|
|
4936
|
+
fontSize: (_d = style == null ? void 0 : style.fontSize) != null ? _d : void 0,
|
|
4937
|
+
textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
|
|
4938
|
+
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
|
|
4939
|
+
};
|
|
4940
|
+
const handleChange = (e) => {
|
|
4941
|
+
const newContents = e.target.value;
|
|
4942
|
+
setLocalContents(newContents);
|
|
4943
|
+
setDocument({
|
|
4944
|
+
[blockId]: {
|
|
4945
|
+
type: "Html",
|
|
4946
|
+
data: {
|
|
4947
|
+
style,
|
|
4948
|
+
props: __spreadProps(__spreadValues({}, props), {
|
|
4949
|
+
contents: newContents
|
|
4950
|
+
})
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4953
|
+
});
|
|
4954
|
+
};
|
|
4955
|
+
const adjustTextareaHeight = (element) => {
|
|
4956
|
+
if (element) {
|
|
4957
|
+
element.style.height = "auto";
|
|
4958
|
+
element.style.height = `${element.scrollHeight}px`;
|
|
4959
|
+
}
|
|
4960
|
+
};
|
|
4961
|
+
if (isSelected) {
|
|
4962
|
+
const textareaStyle = __spreadProps(__spreadValues({}, cssStyle), {
|
|
4963
|
+
fontFamily: '"Nimbus Mono PS", "Courier New", monospace',
|
|
4964
|
+
fontSize: 13,
|
|
4965
|
+
color: (_f = cssStyle.color) != null ? _f : "#333",
|
|
4966
|
+
border: "none",
|
|
4967
|
+
outline: "none",
|
|
4968
|
+
resize: "none",
|
|
4969
|
+
overflow: "hidden",
|
|
4970
|
+
width: "100%",
|
|
4971
|
+
display: "block",
|
|
4972
|
+
margin: 0,
|
|
4973
|
+
backgroundColor: "transparent"
|
|
4974
|
+
});
|
|
4975
|
+
return /* @__PURE__ */ React72.createElement("div", { style: cssStyle }, /* @__PURE__ */ React72.createElement(
|
|
4976
|
+
"textarea",
|
|
4977
|
+
{
|
|
4978
|
+
value: localContents,
|
|
4979
|
+
onChange: handleChange,
|
|
4980
|
+
style: textareaStyle,
|
|
4981
|
+
rows: 3,
|
|
4982
|
+
onInput: (e) => adjustTextareaHeight(e.target),
|
|
4983
|
+
ref: (el) => el && adjustTextareaHeight(el),
|
|
4984
|
+
onClick: (e) => e.stopPropagation()
|
|
4985
|
+
}
|
|
4986
|
+
));
|
|
4987
|
+
}
|
|
4988
|
+
if (!contents) {
|
|
4989
|
+
return /* @__PURE__ */ React72.createElement("div", { style: cssStyle });
|
|
4990
|
+
}
|
|
4991
|
+
return /* @__PURE__ */ React72.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
|
|
4992
|
+
}
|
|
4993
|
+
function getImageBorderRadius2(shape, size) {
|
|
4994
|
+
switch (shape) {
|
|
4995
|
+
case "circle":
|
|
4996
|
+
return size;
|
|
4997
|
+
case "rounded":
|
|
4998
|
+
return size * 0.125;
|
|
4999
|
+
case "square":
|
|
5000
|
+
default:
|
|
5001
|
+
return void 0;
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
function SignatureEditor({ style, props }) {
|
|
5005
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
5006
|
+
const blockId = useCurrentBlockId();
|
|
5007
|
+
const selectedBlockId = useSelectedBlockId();
|
|
5008
|
+
const isSelected = selectedBlockId === blockId;
|
|
5009
|
+
const greeting = (_a = props == null ? void 0 : props.greeting) != null ? _a : SignaturePropsDefaults.greeting;
|
|
5010
|
+
const name = (_b = props == null ? void 0 : props.name) != null ? _b : SignaturePropsDefaults.name;
|
|
5011
|
+
const title = (_c = props == null ? void 0 : props.title) != null ? _c : SignaturePropsDefaults.title;
|
|
5012
|
+
const company = (_d = props == null ? void 0 : props.company) != null ? _d : SignaturePropsDefaults.company;
|
|
5013
|
+
const address = (_e = props == null ? void 0 : props.address) != null ? _e : SignaturePropsDefaults.address;
|
|
5014
|
+
const email = (_f = props == null ? void 0 : props.email) != null ? _f : SignaturePropsDefaults.email;
|
|
5015
|
+
const phone = (_g = props == null ? void 0 : props.phone) != null ? _g : SignaturePropsDefaults.phone;
|
|
5016
|
+
const website = (_h = props == null ? void 0 : props.website) != null ? _h : SignaturePropsDefaults.website;
|
|
5017
|
+
const imageUrl = (_i = props == null ? void 0 : props.imageUrl) != null ? _i : SignaturePropsDefaults.imageUrl;
|
|
5018
|
+
const imageSize = (_j = props == null ? void 0 : props.imageSize) != null ? _j : SignaturePropsDefaults.imageSize;
|
|
5019
|
+
const imageShape = (_k = props == null ? void 0 : props.imageShape) != null ? _k : SignaturePropsDefaults.imageShape;
|
|
5020
|
+
const layout = (_l = props == null ? void 0 : props.layout) != null ? _l : SignaturePropsDefaults.layout;
|
|
5021
|
+
const nameColor = (_m = props == null ? void 0 : props.nameColor) != null ? _m : SignaturePropsDefaults.nameColor;
|
|
5022
|
+
const textColor = (_n = props == null ? void 0 : props.textColor) != null ? _n : SignaturePropsDefaults.textColor;
|
|
5023
|
+
const linkColor = (_o = props == null ? void 0 : props.linkColor) != null ? _o : SignaturePropsDefaults.linkColor;
|
|
5024
|
+
const [localGreeting, setLocalGreeting] = useState(greeting);
|
|
5025
|
+
const [localName, setLocalName] = useState(name);
|
|
5026
|
+
const [localTitle, setLocalTitle] = useState(title);
|
|
5027
|
+
const [localCompany, setLocalCompany] = useState(company);
|
|
5028
|
+
const [localAddress, setLocalAddress] = useState(address);
|
|
5029
|
+
const [localEmail, setLocalEmail] = useState(email);
|
|
5030
|
+
const [localPhone, setLocalPhone] = useState(phone);
|
|
5031
|
+
const [localWebsite, setLocalWebsite] = useState(website);
|
|
5032
|
+
useEffect(() => {
|
|
5033
|
+
setLocalGreeting(greeting);
|
|
5034
|
+
}, [greeting]);
|
|
5035
|
+
useEffect(() => {
|
|
5036
|
+
setLocalName(name);
|
|
5037
|
+
}, [name]);
|
|
5038
|
+
useEffect(() => {
|
|
5039
|
+
setLocalTitle(title);
|
|
5040
|
+
}, [title]);
|
|
5041
|
+
useEffect(() => {
|
|
5042
|
+
setLocalCompany(company);
|
|
5043
|
+
}, [company]);
|
|
5044
|
+
useEffect(() => {
|
|
5045
|
+
setLocalAddress(address);
|
|
5046
|
+
}, [address]);
|
|
5047
|
+
useEffect(() => {
|
|
5048
|
+
setLocalEmail(email);
|
|
5049
|
+
}, [email]);
|
|
5050
|
+
useEffect(() => {
|
|
5051
|
+
setLocalPhone(phone);
|
|
5052
|
+
}, [phone]);
|
|
5053
|
+
useEffect(() => {
|
|
5054
|
+
setLocalWebsite(website);
|
|
5055
|
+
}, [website]);
|
|
5056
|
+
const updateProps = (updates) => {
|
|
5057
|
+
setDocument({
|
|
5058
|
+
[blockId]: {
|
|
5059
|
+
type: "Signature",
|
|
5060
|
+
data: {
|
|
5061
|
+
style,
|
|
5062
|
+
props: __spreadValues(__spreadValues({}, props), updates)
|
|
5063
|
+
}
|
|
5064
|
+
}
|
|
5065
|
+
});
|
|
5066
|
+
};
|
|
5067
|
+
const greetingStyle = {
|
|
5068
|
+
fontSize: 14,
|
|
5069
|
+
color: textColor,
|
|
5070
|
+
margin: 0,
|
|
5071
|
+
marginBottom: 8,
|
|
5072
|
+
lineHeight: "1.4",
|
|
5073
|
+
fontStyle: "italic"
|
|
5074
|
+
};
|
|
5075
|
+
const nameStyle = {
|
|
5076
|
+
fontSize: 16,
|
|
5077
|
+
fontWeight: "bold",
|
|
5078
|
+
color: nameColor,
|
|
5079
|
+
margin: 0,
|
|
5080
|
+
lineHeight: "1.4"
|
|
5081
|
+
};
|
|
5082
|
+
const detailStyle = {
|
|
5083
|
+
fontSize: 14,
|
|
5084
|
+
color: textColor,
|
|
5085
|
+
margin: 0,
|
|
5086
|
+
lineHeight: "1.4"
|
|
5087
|
+
};
|
|
5088
|
+
const linkStyle = {
|
|
5089
|
+
fontSize: 14,
|
|
5090
|
+
color: linkColor,
|
|
5091
|
+
textDecoration: "none"
|
|
5092
|
+
};
|
|
5093
|
+
const inputBase = {
|
|
5094
|
+
border: "none",
|
|
5095
|
+
outline: "none",
|
|
5096
|
+
backgroundColor: "transparent",
|
|
5097
|
+
width: "100%",
|
|
5098
|
+
padding: 0,
|
|
5099
|
+
margin: 0,
|
|
5100
|
+
fontFamily: "inherit"
|
|
5101
|
+
};
|
|
5102
|
+
const wrapperStyle = {
|
|
5103
|
+
backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
|
|
5104
|
+
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
|
|
5105
|
+
};
|
|
5106
|
+
const imageElement = imageUrl ? /* @__PURE__ */ React72.createElement(
|
|
5107
|
+
"img",
|
|
5108
|
+
{
|
|
5109
|
+
src: imageUrl,
|
|
5110
|
+
alt: name || company,
|
|
5111
|
+
width: imageSize,
|
|
5112
|
+
height: imageSize,
|
|
5113
|
+
style: {
|
|
5114
|
+
width: imageSize,
|
|
5115
|
+
height: imageSize,
|
|
5116
|
+
objectFit: "cover",
|
|
5117
|
+
borderRadius: getImageBorderRadius2(imageShape, imageSize),
|
|
5118
|
+
display: "block",
|
|
5119
|
+
outline: "none",
|
|
5120
|
+
border: "none"
|
|
5121
|
+
}
|
|
5122
|
+
}
|
|
5123
|
+
) : null;
|
|
5124
|
+
const greetingElement = isSelected ? /* @__PURE__ */ React72.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React72.createElement(
|
|
5125
|
+
"input",
|
|
5126
|
+
{
|
|
5127
|
+
value: localGreeting,
|
|
5128
|
+
onChange: (e) => {
|
|
5129
|
+
setLocalGreeting(e.target.value);
|
|
5130
|
+
updateProps({ greeting: e.target.value });
|
|
5131
|
+
},
|
|
5132
|
+
placeholder: "Greeting (e.g. Best regards,)",
|
|
5133
|
+
style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
|
|
5134
|
+
}
|
|
5135
|
+
)) : greeting ? /* @__PURE__ */ React72.createElement("p", { style: greetingStyle }, greeting) : null;
|
|
5136
|
+
const textContent = isSelected ? /* @__PURE__ */ React72.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React72.createElement(
|
|
5137
|
+
"input",
|
|
5138
|
+
{
|
|
5139
|
+
value: localName,
|
|
5140
|
+
onChange: (e) => {
|
|
5141
|
+
setLocalName(e.target.value);
|
|
5142
|
+
updateProps({ name: e.target.value });
|
|
5143
|
+
},
|
|
5144
|
+
placeholder: "Name",
|
|
5145
|
+
style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
|
|
5146
|
+
}
|
|
5147
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5148
|
+
"input",
|
|
5149
|
+
{
|
|
5150
|
+
value: localTitle,
|
|
5151
|
+
onChange: (e) => {
|
|
5152
|
+
setLocalTitle(e.target.value);
|
|
5153
|
+
updateProps({ title: e.target.value });
|
|
5154
|
+
},
|
|
5155
|
+
placeholder: "Title",
|
|
5156
|
+
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5157
|
+
}
|
|
5158
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5159
|
+
"input",
|
|
5160
|
+
{
|
|
5161
|
+
value: localCompany,
|
|
5162
|
+
onChange: (e) => {
|
|
5163
|
+
setLocalCompany(e.target.value);
|
|
5164
|
+
updateProps({ company: e.target.value });
|
|
5165
|
+
},
|
|
5166
|
+
placeholder: "Company",
|
|
5167
|
+
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5168
|
+
}
|
|
5169
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5170
|
+
"input",
|
|
5171
|
+
{
|
|
5172
|
+
value: localAddress,
|
|
5173
|
+
onChange: (e) => {
|
|
5174
|
+
setLocalAddress(e.target.value);
|
|
5175
|
+
updateProps({ address: e.target.value });
|
|
5176
|
+
},
|
|
5177
|
+
placeholder: "Address",
|
|
5178
|
+
style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
|
|
5179
|
+
}
|
|
5180
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5181
|
+
"input",
|
|
5182
|
+
{
|
|
5183
|
+
value: localEmail,
|
|
5184
|
+
onChange: (e) => {
|
|
5185
|
+
setLocalEmail(e.target.value);
|
|
5186
|
+
updateProps({ email: e.target.value });
|
|
5187
|
+
},
|
|
5188
|
+
placeholder: "Email",
|
|
5189
|
+
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
|
|
5190
|
+
}
|
|
5191
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5192
|
+
"input",
|
|
5193
|
+
{
|
|
5194
|
+
value: localPhone,
|
|
5195
|
+
onChange: (e) => {
|
|
5196
|
+
setLocalPhone(e.target.value);
|
|
5197
|
+
updateProps({ phone: e.target.value });
|
|
5198
|
+
},
|
|
5199
|
+
placeholder: "Phone",
|
|
5200
|
+
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5201
|
+
}
|
|
5202
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5203
|
+
"input",
|
|
5204
|
+
{
|
|
5205
|
+
value: localWebsite,
|
|
5206
|
+
onChange: (e) => {
|
|
5207
|
+
setLocalWebsite(e.target.value);
|
|
5208
|
+
updateProps({ website: e.target.value });
|
|
5209
|
+
},
|
|
5210
|
+
placeholder: "Website",
|
|
5211
|
+
style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
|
|
5212
|
+
}
|
|
5213
|
+
)) : /* @__PURE__ */ React72.createElement("div", null, name && /* @__PURE__ */ React72.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React72.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React72.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React72.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React72.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React72.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React72.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React72.createElement("p", { style: detailStyle }, "Click to edit signature"));
|
|
5214
|
+
if (layout === "vertical") {
|
|
5215
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React72.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
|
|
5216
|
+
}
|
|
5217
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React72.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React72.createElement("tbody", null, /* @__PURE__ */ React72.createElement("tr", null, imageElement && /* @__PURE__ */ React72.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React72.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
|
|
5218
|
+
}
|
|
5219
|
+
function getFontFamily10(fontFamily) {
|
|
4122
5220
|
switch (fontFamily) {
|
|
4123
5221
|
case "MODERN_SANS":
|
|
4124
5222
|
return '"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif';
|
|
@@ -4145,7 +5243,7 @@ function getFontFamily8(fontFamily) {
|
|
|
4145
5243
|
}
|
|
4146
5244
|
return void 0;
|
|
4147
5245
|
}
|
|
4148
|
-
function
|
|
5246
|
+
function getPadding13(padding) {
|
|
4149
5247
|
if (!padding) return void 0;
|
|
4150
5248
|
if (typeof padding === "object" && !Array.isArray(padding) && "top" in padding && "right" in padding && "bottom" in padding && "left" in padding) {
|
|
4151
5249
|
return `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px`;
|
|
@@ -4179,11 +5277,11 @@ function TextEditor({ style, props }) {
|
|
|
4179
5277
|
const [localText, setLocalText] = useState(textContent);
|
|
4180
5278
|
const isMarkdown = (_b = props == null ? void 0 : props.markdown) != null ? _b : false;
|
|
4181
5279
|
const rootBlock = document2.root;
|
|
4182
|
-
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ?
|
|
5280
|
+
const rootFontFamily = rootBlock && rootBlock.type === "EmailLayout" ? getFontFamily10(rootBlock.data.fontFamily) : '"Helvetica Neue", Arial, sans-serif';
|
|
4183
5281
|
useEffect(() => {
|
|
4184
5282
|
setLocalText(textContent);
|
|
4185
5283
|
}, [textContent]);
|
|
4186
|
-
const fontFamily =
|
|
5284
|
+
const fontFamily = getFontFamily10(style == null ? void 0 : style.fontFamily) || rootFontFamily;
|
|
4187
5285
|
const wStyle = {
|
|
4188
5286
|
color: (_c = style == null ? void 0 : style.color) != null ? _c : void 0,
|
|
4189
5287
|
backgroundColor: (_d = style == null ? void 0 : style.backgroundColor) != null ? _d : void 0,
|
|
@@ -4191,7 +5289,7 @@ function TextEditor({ style, props }) {
|
|
|
4191
5289
|
fontFamily,
|
|
4192
5290
|
fontWeight: (_f = style == null ? void 0 : style.fontWeight) != null ? _f : void 0,
|
|
4193
5291
|
textAlign: (_g = style == null ? void 0 : style.textAlign) != null ? _g : void 0,
|
|
4194
|
-
padding:
|
|
5292
|
+
padding: getPadding13(style == null ? void 0 : style.padding),
|
|
4195
5293
|
width: "100%",
|
|
4196
5294
|
minHeight: "1em"
|
|
4197
5295
|
};
|
|
@@ -4231,7 +5329,7 @@ function TextEditor({ style, props }) {
|
|
|
4231
5329
|
}
|
|
4232
5330
|
};
|
|
4233
5331
|
if (isSelected && !isMarkdown) {
|
|
4234
|
-
return /* @__PURE__ */
|
|
5332
|
+
return /* @__PURE__ */ React72.createElement(
|
|
4235
5333
|
"textarea",
|
|
4236
5334
|
{
|
|
4237
5335
|
value: localText,
|
|
@@ -4245,36 +5343,36 @@ function TextEditor({ style, props }) {
|
|
|
4245
5343
|
);
|
|
4246
5344
|
}
|
|
4247
5345
|
if (isMarkdown) {
|
|
4248
|
-
return /* @__PURE__ */
|
|
5346
|
+
return /* @__PURE__ */ React72.createElement(EmailMarkdown, { style: wStyle, markdown: textContent });
|
|
4249
5347
|
}
|
|
4250
|
-
return /* @__PURE__ */
|
|
5348
|
+
return /* @__PURE__ */ React72.createElement("div", { style: wStyle }, textContent);
|
|
4251
5349
|
}
|
|
4252
5350
|
|
|
4253
5351
|
// src/editor/core.tsx
|
|
4254
5352
|
var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
4255
5353
|
Avatar: {
|
|
4256
5354
|
schema: AvatarPropsSchema,
|
|
4257
|
-
Component: (props) => /* @__PURE__ */
|
|
5355
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(avatar_default, __spreadValues({}, props)))
|
|
4258
5356
|
},
|
|
4259
5357
|
Button: {
|
|
4260
5358
|
schema: ButtonPropsSchema,
|
|
4261
|
-
Component: (props) => /* @__PURE__ */
|
|
5359
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(ButtonEditor, __spreadValues({}, props)))
|
|
4262
5360
|
},
|
|
4263
5361
|
Container: {
|
|
4264
5362
|
schema: container_props_schema_default,
|
|
4265
|
-
Component: (props) => /* @__PURE__ */
|
|
5363
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(ContainerEditor, __spreadValues({}, props)))
|
|
4266
5364
|
},
|
|
4267
5365
|
ColumnsContainer: {
|
|
4268
5366
|
schema: columns_container_props_schema_default2,
|
|
4269
|
-
Component: (props) => /* @__PURE__ */
|
|
5367
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
|
|
4270
5368
|
},
|
|
4271
5369
|
Heading: {
|
|
4272
5370
|
schema: HeadingPropsSchema,
|
|
4273
|
-
Component: (props) => /* @__PURE__ */
|
|
5371
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(HeadingEditor, __spreadValues({}, props)))
|
|
4274
5372
|
},
|
|
4275
5373
|
Html: {
|
|
4276
5374
|
schema: HtmlPropsSchema,
|
|
4277
|
-
Component: (props) => /* @__PURE__ */
|
|
5375
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(HtmlEditor, __spreadValues({}, props)))
|
|
4278
5376
|
},
|
|
4279
5377
|
Image: {
|
|
4280
5378
|
schema: ImagePropsSchema,
|
|
@@ -4282,27 +5380,32 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
|
|
|
4282
5380
|
var _a, _b;
|
|
4283
5381
|
const props = __spreadProps(__spreadValues({}, data), {
|
|
4284
5382
|
props: __spreadProps(__spreadValues({}, data.props), {
|
|
4285
|
-
url: (_b = (_a = data.props) == null ? void 0 : _a.url) != null ? _b : "https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"
|
|
5383
|
+
url: (_b = (_a = data.props) == null ? void 0 : _a.url) != null ? _b : "https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image",
|
|
5384
|
+
linkHref: null
|
|
4286
5385
|
})
|
|
4287
5386
|
});
|
|
4288
|
-
return /* @__PURE__ */
|
|
5387
|
+
return /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(image_default, __spreadValues({}, props)));
|
|
4289
5388
|
}
|
|
4290
5389
|
},
|
|
4291
5390
|
Text: {
|
|
4292
5391
|
schema: TextPropsSchema,
|
|
4293
|
-
Component: (props) => /* @__PURE__ */
|
|
5392
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(TextEditor, __spreadValues({}, props)))
|
|
4294
5393
|
},
|
|
4295
5394
|
EmailLayout: {
|
|
4296
5395
|
schema: email_layout_props_schema_default,
|
|
4297
|
-
Component: (p) => /* @__PURE__ */
|
|
5396
|
+
Component: (p) => /* @__PURE__ */ React72.createElement(EmailLayoutEditor, __spreadValues({}, p))
|
|
4298
5397
|
},
|
|
4299
5398
|
Spacer: {
|
|
4300
5399
|
schema: SpacerPropsSchema,
|
|
4301
|
-
Component: (props) => /* @__PURE__ */
|
|
5400
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(spacer_default, __spreadValues({}, props)))
|
|
4302
5401
|
},
|
|
4303
5402
|
Divider: {
|
|
4304
5403
|
schema: DividerPropsSchema,
|
|
4305
|
-
Component: (props) => /* @__PURE__ */
|
|
5404
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(divider_default, __spreadValues({}, props)))
|
|
5405
|
+
},
|
|
5406
|
+
Signature: {
|
|
5407
|
+
schema: SignaturePropsSchema,
|
|
5408
|
+
Component: (props) => /* @__PURE__ */ React72.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React72.createElement(SignatureEditor, __spreadValues({}, props)))
|
|
4306
5409
|
}
|
|
4307
5410
|
});
|
|
4308
5411
|
var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
|
|
@@ -4318,7 +5421,7 @@ function EditorBlock({ id }) {
|
|
|
4318
5421
|
if (!block) {
|
|
4319
5422
|
throw new Error("Could not find block");
|
|
4320
5423
|
}
|
|
4321
|
-
return /* @__PURE__ */
|
|
5424
|
+
return /* @__PURE__ */ React72.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React72.createElement(EditorBlock2, __spreadValues({}, block)));
|
|
4322
5425
|
}
|
|
4323
5426
|
function ToggleInspectorPanelButton() {
|
|
4324
5427
|
const inspectorDrawerOpen = useInspectorDrawerOpen();
|
|
@@ -4326,20 +5429,20 @@ function ToggleInspectorPanelButton() {
|
|
|
4326
5429
|
toggleInspectorDrawerOpen();
|
|
4327
5430
|
};
|
|
4328
5431
|
if (inspectorDrawerOpen) {
|
|
4329
|
-
return /* @__PURE__ */
|
|
5432
|
+
return /* @__PURE__ */ React72.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React72.createElement(LastPageOutlined, { fontSize: "small" }));
|
|
4330
5433
|
}
|
|
4331
|
-
return /* @__PURE__ */
|
|
5434
|
+
return /* @__PURE__ */ React72.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React72.createElement(AppRegistrationOutlined, { fontSize: "small" }));
|
|
4332
5435
|
}
|
|
4333
5436
|
function useIcon() {
|
|
4334
5437
|
const samplesDrawerOpen = useSamplesDrawerOpen();
|
|
4335
5438
|
if (samplesDrawerOpen) {
|
|
4336
|
-
return /* @__PURE__ */
|
|
5439
|
+
return /* @__PURE__ */ React72.createElement(FirstPageOutlined, { fontSize: "small" });
|
|
4337
5440
|
}
|
|
4338
|
-
return /* @__PURE__ */
|
|
5441
|
+
return /* @__PURE__ */ React72.createElement(MenuOutlined, { fontSize: "small" });
|
|
4339
5442
|
}
|
|
4340
5443
|
function ToggleSamplesPanelButton() {
|
|
4341
5444
|
const icon = useIcon();
|
|
4342
|
-
return /* @__PURE__ */
|
|
5445
|
+
return /* @__PURE__ */ React72.createElement(IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
|
|
4343
5446
|
}
|
|
4344
5447
|
function formatHtml(html2, spaces = 2) {
|
|
4345
5448
|
try {
|
|
@@ -4401,7 +5504,7 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
4401
5504
|
if (code === null) {
|
|
4402
5505
|
return null;
|
|
4403
5506
|
}
|
|
4404
|
-
return /* @__PURE__ */
|
|
5507
|
+
return /* @__PURE__ */ React72.createElement(
|
|
4405
5508
|
"pre",
|
|
4406
5509
|
{
|
|
4407
5510
|
style: {
|
|
@@ -4427,12 +5530,36 @@ function HighlightedCodePanel({ type, value }) {
|
|
|
4427
5530
|
function HtmlPanel() {
|
|
4428
5531
|
const document2 = useDocument();
|
|
4429
5532
|
const code = useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
|
|
4430
|
-
return /* @__PURE__ */
|
|
5533
|
+
return /* @__PURE__ */ React72.createElement(HighlightedCodePanel, { type: "html", value: code });
|
|
4431
5534
|
}
|
|
4432
5535
|
function JsonPanel() {
|
|
4433
5536
|
const document2 = useDocument();
|
|
4434
5537
|
const code = useMemo(() => JSON.stringify(document2, null, " "), [document2]);
|
|
4435
|
-
return /* @__PURE__ */
|
|
5538
|
+
return /* @__PURE__ */ React72.createElement(HighlightedCodePanel, { type: "json", value: code });
|
|
5539
|
+
}
|
|
5540
|
+
function TextPanel() {
|
|
5541
|
+
const document2 = useDocument();
|
|
5542
|
+
const text = useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
|
|
5543
|
+
return /* @__PURE__ */ React72.createElement(
|
|
5544
|
+
"pre",
|
|
5545
|
+
{
|
|
5546
|
+
style: {
|
|
5547
|
+
margin: 0,
|
|
5548
|
+
padding: 16,
|
|
5549
|
+
overflowX: "auto",
|
|
5550
|
+
whiteSpace: "pre-wrap",
|
|
5551
|
+
fontSize: "13px",
|
|
5552
|
+
fontFamily: "monospace",
|
|
5553
|
+
lineHeight: "1.5"
|
|
5554
|
+
},
|
|
5555
|
+
onClick: (ev) => {
|
|
5556
|
+
const s = window.getSelection();
|
|
5557
|
+
if (s === null) return;
|
|
5558
|
+
s.selectAllChildren(ev.currentTarget);
|
|
5559
|
+
}
|
|
5560
|
+
},
|
|
5561
|
+
text
|
|
5562
|
+
);
|
|
4436
5563
|
}
|
|
4437
5564
|
function MainTabsGroup() {
|
|
4438
5565
|
const selectedMainTab = useSelectedMainTab();
|
|
@@ -4442,35 +5569,42 @@ function MainTabsGroup() {
|
|
|
4442
5569
|
case "preview":
|
|
4443
5570
|
case "editor":
|
|
4444
5571
|
case "html":
|
|
5572
|
+
case "text":
|
|
4445
5573
|
setSelectedMainTab(v);
|
|
4446
5574
|
return;
|
|
4447
5575
|
default:
|
|
4448
5576
|
setSelectedMainTab("editor");
|
|
4449
5577
|
}
|
|
4450
5578
|
};
|
|
4451
|
-
return /* @__PURE__ */
|
|
5579
|
+
return /* @__PURE__ */ React72.createElement(Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React72.createElement(
|
|
4452
5580
|
Tab,
|
|
4453
5581
|
{
|
|
4454
5582
|
value: "editor",
|
|
4455
|
-
label: /* @__PURE__ */
|
|
5583
|
+
label: /* @__PURE__ */ React72.createElement(Tooltip, { title: "Edit" }, /* @__PURE__ */ React72.createElement(EditOutlined, { fontSize: "small" }))
|
|
4456
5584
|
}
|
|
4457
|
-
), /* @__PURE__ */
|
|
5585
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4458
5586
|
Tab,
|
|
4459
5587
|
{
|
|
4460
5588
|
value: "preview",
|
|
4461
|
-
label: /* @__PURE__ */
|
|
5589
|
+
label: /* @__PURE__ */ React72.createElement(Tooltip, { title: "Preview" }, /* @__PURE__ */ React72.createElement(PreviewOutlined, { fontSize: "small" }))
|
|
4462
5590
|
}
|
|
4463
|
-
), /* @__PURE__ */
|
|
5591
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4464
5592
|
Tab,
|
|
4465
5593
|
{
|
|
4466
5594
|
value: "html",
|
|
4467
|
-
label: /* @__PURE__ */
|
|
5595
|
+
label: /* @__PURE__ */ React72.createElement(Tooltip, { title: "HTML output" }, /* @__PURE__ */ React72.createElement(CodeOutlined, { fontSize: "small" }))
|
|
5596
|
+
}
|
|
5597
|
+
), /* @__PURE__ */ React72.createElement(
|
|
5598
|
+
Tab,
|
|
5599
|
+
{
|
|
5600
|
+
value: "text",
|
|
5601
|
+
label: /* @__PURE__ */ React72.createElement(Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React72.createElement(SubjectOutlined, { fontSize: "small" }))
|
|
4468
5602
|
}
|
|
4469
|
-
), /* @__PURE__ */
|
|
5603
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4470
5604
|
Tab,
|
|
4471
5605
|
{
|
|
4472
5606
|
value: "json",
|
|
4473
|
-
label: /* @__PURE__ */
|
|
5607
|
+
label: /* @__PURE__ */ React72.createElement(Tooltip, { title: "JSON output" }, /* @__PURE__ */ React72.createElement(DataObjectOutlined, { fontSize: "small" }))
|
|
4474
5608
|
}
|
|
4475
5609
|
));
|
|
4476
5610
|
}
|
|
@@ -4492,7 +5626,7 @@ function SnackbarProvider({ children }) {
|
|
|
4492
5626
|
const handleClose = () => {
|
|
4493
5627
|
setMessage(null);
|
|
4494
5628
|
};
|
|
4495
|
-
return /* @__PURE__ */
|
|
5629
|
+
return /* @__PURE__ */ React72.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React72.createElement(
|
|
4496
5630
|
Snackbar,
|
|
4497
5631
|
{
|
|
4498
5632
|
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
@@ -4568,7 +5702,7 @@ function SaveTemplateDialog({
|
|
|
4568
5702
|
setInternalError("");
|
|
4569
5703
|
onClose();
|
|
4570
5704
|
};
|
|
4571
|
-
return /* @__PURE__ */
|
|
5705
|
+
return /* @__PURE__ */ React72.createElement(
|
|
4572
5706
|
Dialog,
|
|
4573
5707
|
{
|
|
4574
5708
|
open,
|
|
@@ -4576,8 +5710,8 @@ function SaveTemplateDialog({
|
|
|
4576
5710
|
maxWidth: "sm",
|
|
4577
5711
|
fullWidth: true
|
|
4578
5712
|
},
|
|
4579
|
-
/* @__PURE__ */
|
|
4580
|
-
/* @__PURE__ */
|
|
5713
|
+
/* @__PURE__ */ React72.createElement(DialogTitle, null, "Save Email Template"),
|
|
5714
|
+
/* @__PURE__ */ React72.createElement(DialogContent, null, /* @__PURE__ */ React72.createElement(Box, { sx: { pt: 1 } }, /* @__PURE__ */ React72.createElement(
|
|
4581
5715
|
TextField,
|
|
4582
5716
|
{
|
|
4583
5717
|
autoFocus: true,
|
|
@@ -4599,7 +5733,7 @@ function SaveTemplateDialog({
|
|
|
4599
5733
|
disabled: isSubmitting
|
|
4600
5734
|
}
|
|
4601
5735
|
))),
|
|
4602
|
-
/* @__PURE__ */
|
|
5736
|
+
/* @__PURE__ */ React72.createElement(DialogActions, null, /* @__PURE__ */ React72.createElement(Button$1, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React72.createElement(
|
|
4603
5737
|
Button$1,
|
|
4604
5738
|
{
|
|
4605
5739
|
onClick: handleSave,
|
|
@@ -4654,7 +5788,7 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
4654
5788
|
return false;
|
|
4655
5789
|
}
|
|
4656
5790
|
});
|
|
4657
|
-
return /* @__PURE__ */
|
|
5791
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
4658
5792
|
IconButton,
|
|
4659
5793
|
{
|
|
4660
5794
|
onClick: handleSave,
|
|
@@ -4665,8 +5799,8 @@ function SaveButton({ loadTemplates, saveAs }) {
|
|
|
4665
5799
|
}
|
|
4666
5800
|
}
|
|
4667
5801
|
},
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
), /* @__PURE__ */
|
|
5802
|
+
/* @__PURE__ */ React72.createElement(Tooltip, { title: "Save template" }, /* @__PURE__ */ React72.createElement(SaveOutlined, { fontSize: "small" }))
|
|
5803
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4670
5804
|
SaveTemplateDialog,
|
|
4671
5805
|
{
|
|
4672
5806
|
open: saveDialogOpen,
|
|
@@ -4736,7 +5870,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
4736
5870
|
}
|
|
4737
5871
|
return false;
|
|
4738
5872
|
});
|
|
4739
|
-
return /* @__PURE__ */
|
|
5873
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
4740
5874
|
IconButton,
|
|
4741
5875
|
{
|
|
4742
5876
|
onClick: handleNewTemplate,
|
|
@@ -4747,8 +5881,8 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
4747
5881
|
}
|
|
4748
5882
|
}
|
|
4749
5883
|
},
|
|
4750
|
-
/* @__PURE__ */
|
|
4751
|
-
), /* @__PURE__ */
|
|
5884
|
+
/* @__PURE__ */ React72.createElement(Tooltip, { title: "New template" }, /* @__PURE__ */ React72.createElement(Add, { fontSize: "small" }))
|
|
5885
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4752
5886
|
SaveTemplateDialog,
|
|
4753
5887
|
{
|
|
4754
5888
|
open: saveDialogOpen,
|
|
@@ -4765,7 +5899,7 @@ function NewTemplateButton({ loadTemplates, saveAs }) {
|
|
|
4765
5899
|
}
|
|
4766
5900
|
|
|
4767
5901
|
// src/app/email-canvas/index.tsx
|
|
4768
|
-
function TemplatePanel2({ loadTemplates, saveAs }) {
|
|
5902
|
+
function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true }) {
|
|
4769
5903
|
const document2 = useDocument();
|
|
4770
5904
|
const selectedMainTab = useSelectedMainTab();
|
|
4771
5905
|
const selectedScreenSize = useSelectedScreenSize();
|
|
@@ -4795,17 +5929,19 @@ function TemplatePanel2({ loadTemplates, saveAs }) {
|
|
|
4795
5929
|
const renderMainPanel = () => {
|
|
4796
5930
|
switch (selectedMainTab) {
|
|
4797
5931
|
case "editor":
|
|
4798
|
-
return /* @__PURE__ */
|
|
5932
|
+
return /* @__PURE__ */ React72.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React72.createElement(EditorBlock, { id: "root" }));
|
|
4799
5933
|
case "preview":
|
|
4800
|
-
return /* @__PURE__ */
|
|
5934
|
+
return /* @__PURE__ */ React72.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React72.createElement(Reader, { document: document2, rootBlockId: "root" }));
|
|
4801
5935
|
case "html":
|
|
4802
|
-
return /* @__PURE__ */
|
|
5936
|
+
return /* @__PURE__ */ React72.createElement(HtmlPanel, null);
|
|
5937
|
+
case "text":
|
|
5938
|
+
return /* @__PURE__ */ React72.createElement(TextPanel, null);
|
|
4803
5939
|
case "json":
|
|
4804
|
-
return /* @__PURE__ */
|
|
5940
|
+
return /* @__PURE__ */ React72.createElement(JsonPanel, null);
|
|
4805
5941
|
}
|
|
4806
5942
|
};
|
|
4807
5943
|
const showSaveButtons = persistenceEnabled;
|
|
4808
|
-
return /* @__PURE__ */
|
|
5944
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
4809
5945
|
Stack,
|
|
4810
5946
|
{
|
|
4811
5947
|
sx: {
|
|
@@ -4822,10 +5958,10 @@ function TemplatePanel2({ loadTemplates, saveAs }) {
|
|
|
4822
5958
|
justifyContent: "space-between",
|
|
4823
5959
|
alignItems: "center"
|
|
4824
5960
|
},
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
4828
|
-
), /* @__PURE__ */
|
|
5961
|
+
samplesDrawerEnabled && /* @__PURE__ */ React72.createElement(ToggleSamplesPanelButton, null),
|
|
5962
|
+
/* @__PURE__ */ React72.createElement(Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React72.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React72.createElement(MainTabsGroup, null)), /* @__PURE__ */ React72.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React72.createElement(ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React72.createElement(ToggleButton, { value: "desktop" }, /* @__PURE__ */ React72.createElement(Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React72.createElement(MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React72.createElement(ToggleButton, { value: "mobile" }, /* @__PURE__ */ React72.createElement(Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React72.createElement(PhoneIphoneOutlined, { fontSize: "small" })))), showSaveButtons && /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(NewTemplateButton, { loadTemplates, saveAs }), /* @__PURE__ */ React72.createElement(SaveButton, { loadTemplates, saveAs })))),
|
|
5963
|
+
/* @__PURE__ */ React72.createElement(ToggleInspectorPanelButton, null)
|
|
5964
|
+
), /* @__PURE__ */ React72.createElement(Box, { sx: {
|
|
4829
5965
|
paddingBottom: "50px",
|
|
4830
5966
|
minWidth: 370
|
|
4831
5967
|
} }, renderMainPanel()));
|
|
@@ -4907,7 +6043,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
4907
6043
|
return getDocument();
|
|
4908
6044
|
}
|
|
4909
6045
|
}));
|
|
4910
|
-
return /* @__PURE__ */
|
|
6046
|
+
return /* @__PURE__ */ React72.createElement(Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React72.createElement(
|
|
4911
6047
|
InspectorDrawer,
|
|
4912
6048
|
{
|
|
4913
6049
|
enterDuration: drawerEnterDuration,
|
|
@@ -4915,7 +6051,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
4915
6051
|
deleteTemplate,
|
|
4916
6052
|
copyTemplate
|
|
4917
6053
|
}
|
|
4918
|
-
), /* @__PURE__ */
|
|
6054
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4919
6055
|
SamplesDrawer,
|
|
4920
6056
|
{
|
|
4921
6057
|
enterDuration: drawerEnterDuration,
|
|
@@ -4927,7 +6063,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
4927
6063
|
currentTemplateId,
|
|
4928
6064
|
deleteTemplate
|
|
4929
6065
|
}
|
|
4930
|
-
), /* @__PURE__ */
|
|
6066
|
+
), /* @__PURE__ */ React72.createElement(
|
|
4931
6067
|
Stack,
|
|
4932
6068
|
{
|
|
4933
6069
|
sx: {
|
|
@@ -4936,7 +6072,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
|
|
|
4936
6072
|
transition: [marginLeftTransition, marginRightTransition].join(", ")
|
|
4937
6073
|
}
|
|
4938
6074
|
},
|
|
4939
|
-
/* @__PURE__ */
|
|
6075
|
+
/* @__PURE__ */ React72.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
|
|
4940
6076
|
));
|
|
4941
6077
|
});
|
|
4942
6078
|
var EmailEditor = forwardRef((props, ref) => {
|
|
@@ -4971,7 +6107,7 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
4971
6107
|
useEffect(() => {
|
|
4972
6108
|
setPersistenceEnabled(persistenceEnabled);
|
|
4973
6109
|
}, [persistenceEnabled]);
|
|
4974
|
-
return /* @__PURE__ */
|
|
6110
|
+
return /* @__PURE__ */ React72.createElement(ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React72.createElement(CssBaseline, null), /* @__PURE__ */ React72.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React72.createElement(SnackbarProvider, null, /* @__PURE__ */ React72.createElement(
|
|
4975
6111
|
EmailEditorProvider,
|
|
4976
6112
|
{
|
|
4977
6113
|
initialTemplate: resolvedTemplate,
|
|
@@ -4980,7 +6116,7 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
4980
6116
|
onSave,
|
|
4981
6117
|
onChange
|
|
4982
6118
|
},
|
|
4983
|
-
/* @__PURE__ */
|
|
6119
|
+
/* @__PURE__ */ React72.createElement(
|
|
4984
6120
|
EmailEditorInternal,
|
|
4985
6121
|
{
|
|
4986
6122
|
ref,
|
|
@@ -5002,6 +6138,6 @@ var EmailEditor = forwardRef((props, ref) => {
|
|
|
5002
6138
|
EmailEditor.displayName = "EmailEditor";
|
|
5003
6139
|
EmailEditorInternal.displayName = "EmailEditorInternal";
|
|
5004
6140
|
|
|
5005
|
-
export { avatar_default as Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, button_default as Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, columns_container_default as ColumnsContainer, ColumnsContainerProps, ColumnsContainerPropsSchema, ColumnsContainerReader, container_default as Container, ContainerProps, ContainerPropsSchema, ContainerReader, divider_default as Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, EmailEditorProvider, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, heading_default as Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, html_default as Html, HtmlProps, HtmlPropsSchema, image_default as Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, spacer_default as Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, theme_default as theme, useEmailEditor };
|
|
6141
|
+
export { avatar_default as Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, button_default as Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, columns_container_default as ColumnsContainer, ColumnsContainerProps, ColumnsContainerPropsSchema, ColumnsContainerReader, container_default as Container, ContainerProps, ContainerPropsSchema, ContainerReader, divider_default as Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, EmailEditorProvider, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, heading_default as Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, html_default as Html, HtmlProps, HtmlPropsSchema, image_default as Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, signature_default as Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, spacer_default as Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, theme_default as theme, useEmailEditor };
|
|
5006
6142
|
//# sourceMappingURL=index.js.map
|
|
5007
6143
|
//# sourceMappingURL=index.js.map
|