easy-email-extensions 4.12.0 → 4.12.2

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.
@@ -2,5 +2,6 @@ import React from 'react';
2
2
  export interface AttributesPanelWrapper {
3
3
  style?: React.CSSProperties;
4
4
  extra?: React.ReactNode;
5
+ children: React.ReactNode | React.ReactElement;
5
6
  }
6
7
  export declare const AttributesPanelWrapper: React.FC<AttributesPanelWrapper>;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface CollapseWrapperProps {
3
3
  defaultActiveKey: string[];
4
+ children: React.ReactNode | React.ReactElement;
4
5
  }
5
6
  export declare const CollapseWrapper: React.FC<CollapseWrapperProps>;
@@ -3,4 +3,6 @@ export declare const PresetColorsContext: React.Context<{
3
3
  colors: string[];
4
4
  addCurrentColor: (color: string) => void;
5
5
  }>;
6
- export declare const PresetColorsProvider: React.FC<{}>;
6
+ export declare const PresetColorsProvider: React.FC<{
7
+ children: React.ReactNode | React.ReactElement;
8
+ }>;
@@ -3,4 +3,6 @@ export declare const SelectionRangeContext: React.Context<{
3
3
  selectionRange: Range | null;
4
4
  setSelectionRange: React.Dispatch<React.SetStateAction<Range | null>>;
5
5
  }>;
6
- export declare const SelectionRangeProvider: React.FC<{}>;
6
+ export declare const SelectionRangeProvider: React.FC<{
7
+ children: React.ReactNode | React.ReactElement;
8
+ }>;
@@ -1,7 +1,8 @@
1
1
  export interface ConfigurationPanelProps {
2
2
  showSourceCode: boolean;
3
+ mjmlReadOnly: boolean;
3
4
  height: string;
4
5
  onBack?: () => void;
5
6
  compact?: boolean;
6
7
  }
7
- export declare function ConfigurationPanel({ showSourceCode, height, onBack, compact, }: ConfigurationPanelProps): JSX.Element | null;
8
+ export declare function ConfigurationPanel({ showSourceCode, height, onBack, compact, mjmlReadOnly, }: ConfigurationPanelProps): JSX.Element | null;
@@ -1,5 +1,6 @@
1
- export declare function ConfigurationDrawer({ height, compact, showSourceCode, }: {
1
+ export declare function ConfigurationDrawer({ height, compact, showSourceCode, mjmlReadOnly, }: {
2
2
  height: string;
3
3
  compact: boolean;
4
4
  showSourceCode: boolean;
5
+ mjmlReadOnly: boolean;
5
6
  }): JSX.Element;
@@ -1,3 +1,4 @@
1
- export declare function EditPanel({ showSourceCode }: {
1
+ export declare function EditPanel({ showSourceCode, mjmlReadOnly, }: {
2
2
  showSourceCode: boolean;
3
+ mjmlReadOnly: boolean;
3
4
  }): JSX.Element;
@@ -3,4 +3,5 @@ import { BlockType } from 'easy-email-core';
3
3
  export declare const BlockMaskWrapper: React.FC<{
4
4
  type: BlockType | string;
5
5
  payload: any;
6
+ children: React.ReactNode | React.ReactElement;
6
7
  }>;
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export declare const BlocksPanel: React.FC;
2
+ export declare const BlocksPanel: React.FC<{
3
+ children: React.ReactNode | React.ReactElement;
4
+ }>;
@@ -2,5 +2,7 @@ import React from 'react';
2
2
  import { BlockLayerProps } from '../BlockLayer';
3
3
  export declare const SimpleLayout: React.FC<{
4
4
  showSourceCode?: boolean;
5
+ mjmlReadOnly?: boolean;
5
6
  defaultShowLayer?: boolean;
7
+ children: React.ReactNode | React.ReactElement;
6
8
  } & BlockLayerProps>;
@@ -1 +1,3 @@
1
- export declare function SourceCodePanel(): JSX.Element | null;
1
+ export declare function SourceCodePanel({ mjmlReadOnly }: {
2
+ mjmlReadOnly: boolean;
3
+ }): JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import 'overlayscrollbars/css/OverlayScrollbars.css';
3
3
  export declare const FullHeightOverlayScrollbars: React.FC<{
4
+ children: React.ReactNode | React.ReactElement;
4
5
  height: string | number;
5
6
  }>;
@@ -1,6 +1,7 @@
1
1
  import { BlockLayerProps } from '../../BlockLayer';
2
2
  import React from 'react';
3
3
  export interface ExtensionProps extends BlockLayerProps {
4
+ children?: React.ReactNode | React.ReactElement;
4
5
  categories: Array<{
5
6
  label: string;
6
7
  active?: boolean;
@@ -32,6 +33,7 @@ export interface ExtensionProps extends BlockLayerProps {
32
33
  displayType: 'custom';
33
34
  }>;
34
35
  showSourceCode?: boolean;
36
+ mjmlReadOnly?: boolean;
35
37
  compact?: boolean;
36
38
  }
37
39
  export declare const ExtensionContext: React.Context<ExtensionProps>;
package/lib/index2.js CHANGED
@@ -33061,6 +33061,13 @@ function ColorPickerContent(props) {
33061
33061
  const presetColorList = useMemo(() => {
33062
33062
  return [...presetColors.filter((item2) => item2 !== transparentColor$1).slice(-14)];
33063
33063
  }, [presetColors]);
33064
+ let adapterColor = color2;
33065
+ try {
33066
+ if (Color$2(color2).hex()) {
33067
+ adapterColor = Color$2(color2).hex();
33068
+ }
33069
+ } catch (error2) {
33070
+ }
33064
33071
  return /* @__PURE__ */ React__default.createElement("div", {
33065
33072
  className: styles$7.colorPicker,
33066
33073
  style: { width: 202, paddingTop: 12, paddingBottom: 12 }
@@ -33113,7 +33120,7 @@ function ColorPickerContent(props) {
33113
33120
  opacity: 0
33114
33121
  },
33115
33122
  type: "color",
33116
- value: color2 ? Color$2(color2).hex() : color2,
33123
+ value: adapterColor,
33117
33124
  onChange: (e) => onChange(e.target.value)
33118
33125
  }))), /* @__PURE__ */ React__default.createElement("style", null, `
33119
33126
  .form-alpha-picker {
@@ -36297,13 +36304,13 @@ function AttributePanel() {
36297
36304
  style: { position: "absolute" }
36298
36305
  }, /* @__PURE__ */ React__default.createElement(RichTextField, {
36299
36306
  idx: focusIdx2
36300
- })), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
36307
+ })), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
36301
36308
  .email-block [contentEditable="true"],
36302
36309
  .email-block [contentEditable="true"] * {
36303
36310
  outline: none;
36304
36311
  cursor: text;
36305
36312
  }
36306
- `), shadowRoot)));
36313
+ `), shadowRoot))));
36307
36314
  }
36308
36315
  function MergeTags(props) {
36309
36316
  const { execCommand } = props;
@@ -39788,7 +39795,7 @@ const BlocksPanel = (props) => {
39788
39795
  style: { position: "relative" }
39789
39796
  }, /* @__PURE__ */ React__default.createElement("div", {
39790
39797
  onClick: toggleVisible
39791
- }, props.children), ele && visible && createPortal(/* @__PURE__ */ React__default.createElement("div", {
39798
+ }, props.children), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, ele && visible && createPortal(/* @__PURE__ */ React__default.createElement("div", {
39792
39799
  className: styles$6.BlocksPanel,
39793
39800
  style: {
39794
39801
  pointerEvents: isDragging ? "none" : void 0,
@@ -39828,7 +39835,7 @@ const BlocksPanel = (props) => {
39828
39835
  }, category.title)
39829
39836
  }, /* @__PURE__ */ React__default.createElement(BlockPanelItem, {
39830
39837
  category
39831
- })))))), ele)), [filterCategories, ele, isDragging, props.children, toggleVisible, visible]);
39838
+ })))))), ele))), [filterCategories, ele, isDragging, props.children, toggleVisible, visible]);
39832
39839
  };
39833
39840
  const BlockPanelItem = React__default.memo((props) => {
39834
39841
  return /* @__PURE__ */ React__default.createElement(Tabs$1, {
@@ -40038,7 +40045,7 @@ function MjmlToJson(data) {
40038
40045
  headAttributes,
40039
40046
  headStyles,
40040
40047
  fonts,
40041
- breakpoint: breakpoint == null ? void 0 : breakpoint.attributes.breakpoint
40048
+ breakpoint: breakpoint == null ? void 0 : breakpoint.attributes.width
40042
40049
  }, metaData)
40043
40050
  }
40044
40051
  });
@@ -40134,7 +40141,7 @@ function formatPadding(attributes, attributeName) {
40134
40141
  attributes[attributeName] = newPadding;
40135
40142
  }
40136
40143
  }
40137
- function SourceCodePanel() {
40144
+ function SourceCodePanel({ mjmlReadOnly }) {
40138
40145
  const { setValueByIdx, focusBlock, values } = useBlock();
40139
40146
  const { focusIdx } = useFocusIdx();
40140
40147
  const [mjmlText, setMjmlText] = useState("");
@@ -40209,7 +40216,8 @@ function SourceCodePanel() {
40209
40216
  value: mjmlText,
40210
40217
  autoSize: { maxRows: 25 },
40211
40218
  onChange: onChangeMjmlText,
40212
- onBlur: onMjmlChange
40219
+ onBlur: onMjmlChange,
40220
+ readOnly: mjmlReadOnly
40213
40221
  })));
40214
40222
  }
40215
40223
  function Toolbar() {
@@ -40949,7 +40957,7 @@ function MergeTagBadgePrompt() {
40949
40957
  }
40950
40958
  const SimpleLayout = (props) => {
40951
40959
  const { height: containerHeight } = useEditorProps();
40952
- const { showSourceCode = true, defaultShowLayer = true } = props;
40960
+ const { showSourceCode = true, defaultShowLayer = true, mjmlReadOnly: mjmlReadOnly2 = true } = props;
40953
40961
  const [collapsed, setCollapsed] = useState(!defaultShowLayer);
40954
40962
  return /* @__PURE__ */ React__default.createElement(ConfigProvider, {
40955
40963
  locale: enUS
@@ -41031,7 +41039,9 @@ const SimpleLayout = (props) => {
41031
41039
  title: /* @__PURE__ */ React__default.createElement("div", {
41032
41040
  style: { height: 31, lineHeight: "31px" }
41033
41041
  }, t("Source code"))
41034
- }, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null), /* @__PURE__ */ React__default.createElement(MergeTagBadgePrompt, null)));
41042
+ }, /* @__PURE__ */ React__default.createElement(SourceCodePanel, {
41043
+ mjmlReadOnly: mjmlReadOnly2
41044
+ }))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null), /* @__PURE__ */ React__default.createElement(MergeTagBadgePrompt, null)));
41035
41045
  };
41036
41046
  const StandardLayout$1 = "_StandardLayout_xv0bc_1";
41037
41047
  var styles$3 = {
@@ -46088,7 +46098,8 @@ function ConfigurationPanel({
46088
46098
  showSourceCode,
46089
46099
  height,
46090
46100
  onBack,
46091
- compact
46101
+ compact,
46102
+ mjmlReadOnly: mjmlReadOnly2
46092
46103
  }) {
46093
46104
  const [inited, setInited] = useState(false);
46094
46105
  useEffect(() => {
@@ -46133,12 +46144,15 @@ function ConfigurationPanel({
46133
46144
  }, t("Source code"))
46134
46145
  }, /* @__PURE__ */ React__default.createElement(FullHeightOverlayScrollbars, {
46135
46146
  height: `calc(${height} - 60px)`
46136
- }, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null)))) : /* @__PURE__ */ React__default.createElement(AttributePanel, null));
46147
+ }, /* @__PURE__ */ React__default.createElement(SourceCodePanel, {
46148
+ mjmlReadOnly: mjmlReadOnly2
46149
+ })))) : /* @__PURE__ */ React__default.createElement(AttributePanel, null));
46137
46150
  }
46138
46151
  function ConfigurationDrawer({
46139
46152
  height,
46140
46153
  compact,
46141
- showSourceCode
46154
+ showSourceCode,
46155
+ mjmlReadOnly: mjmlReadOnly2
46142
46156
  }) {
46143
46157
  const refWrapper = useRef(null);
46144
46158
  const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
@@ -46173,12 +46187,16 @@ function ConfigurationDrawer({
46173
46187
  compact,
46174
46188
  showSourceCode,
46175
46189
  height,
46176
- onBack: onClose
46190
+ onBack: onClose,
46191
+ mjmlReadOnly: mjmlReadOnly2
46177
46192
  })));
46178
46193
  }, [visible, onClose, compact, showSourceCode, height]);
46179
46194
  }
46180
46195
  const TabPane = Tabs$1.TabPane;
46181
- function EditPanel({ showSourceCode }) {
46196
+ function EditPanel({
46197
+ showSourceCode,
46198
+ mjmlReadOnly: mjmlReadOnly2
46199
+ }) {
46182
46200
  const { height } = useEditorProps();
46183
46201
  const { compact = true } = useExtensionProps();
46184
46202
  return /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
@@ -46210,7 +46228,8 @@ function EditPanel({ showSourceCode }) {
46210
46228
  }, /* @__PURE__ */ React__default.createElement(BlockLayer, null))))), !compact && /* @__PURE__ */ React__default.createElement(ConfigurationDrawer, {
46211
46229
  height,
46212
46230
  showSourceCode,
46213
- compact: Boolean(compact)
46231
+ compact: Boolean(compact),
46232
+ mjmlReadOnly: mjmlReadOnly2
46214
46233
  }));
46215
46234
  }
46216
46235
  const defaultCategories = [
@@ -46280,14 +46299,19 @@ const defaultCategories = [
46280
46299
  get title() {
46281
46300
  return t("4 columns");
46282
46301
  },
46283
- payload: [[["25%", "25%", "25%", "25%"]]]
46302
+ payload: [["25%", "25%", "25%", "25%"]]
46284
46303
  }
46285
46304
  ]
46286
46305
  }
46287
46306
  ];
46288
46307
  const StandardLayout = (props) => {
46289
46308
  const { height: containerHeight } = useEditorProps();
46290
- const { showSourceCode = true, compact = true, categories = defaultCategories } = props;
46309
+ const {
46310
+ showSourceCode = true,
46311
+ compact = true,
46312
+ categories = defaultCategories,
46313
+ mjmlReadOnly: mjmlReadOnly2 = true
46314
+ } = props;
46291
46315
  const { setFocusIdx } = useFocusIdx();
46292
46316
  useEffect(() => {
46293
46317
  if (!compact) {
@@ -46313,11 +46337,13 @@ const StandardLayout = (props) => {
46313
46337
  overflow: "hidden"
46314
46338
  }
46315
46339
  }, compact && /* @__PURE__ */ React__default.createElement(EditPanel, {
46316
- showSourceCode
46340
+ showSourceCode,
46341
+ mjmlReadOnly: mjmlReadOnly2
46317
46342
  }), /* @__PURE__ */ React__default.createElement(Layout$1, {
46318
46343
  style: { height: containerHeight, flex: 1 }
46319
46344
  }, props.children), !compact && /* @__PURE__ */ React__default.createElement(EditPanel, {
46320
- showSourceCode
46345
+ showSourceCode,
46346
+ mjmlReadOnly: mjmlReadOnly2
46321
46347
  }), compact ? /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
46322
46348
  style: {
46323
46349
  height: containerHeight,
@@ -46328,7 +46354,8 @@ const StandardLayout = (props) => {
46328
46354
  }, /* @__PURE__ */ React__default.createElement(ConfigurationPanel, {
46329
46355
  compact,
46330
46356
  height: containerHeight,
46331
- showSourceCode
46357
+ showSourceCode,
46358
+ mjmlReadOnly: mjmlReadOnly2
46332
46359
  })) : /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
46333
46360
  style: { width: 0, overflow: "hidden" }
46334
46361
  }))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null), /* @__PURE__ */ React__default.createElement(MergeTagBadgePrompt, null)));