easy-email-pro-theme 1.38.6 → 1.38.7

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.
Files changed (2) hide show
  1. package/lib/index.js +41 -17
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -8835,6 +8835,7 @@ const PreviewEmail = ({
8835
8835
  headerElement,
8836
8836
  footerElement
8837
8837
  }) => {
8838
+ const [html, setHtml] = useState("");
8838
8839
  const mjmlString = useMemo$1(() => {
8839
8840
  return EditorCore.toMJML({
8840
8841
  element: values2.content,
@@ -8853,15 +8854,21 @@ const PreviewEmail = ({
8853
8854
  headerElement,
8854
8855
  footerElement
8855
8856
  ]);
8856
- const html = useMemo$1(() => {
8857
- const skeletonHtml = mjml(mjmlString, {
8858
- fonts: {}
8859
- }).html;
8860
- const finalHtml = PluginManager.renderWithData(
8861
- skeletonHtml,
8862
- cloneDeep(mergetagsData || {})
8863
- );
8864
- return finalHtml;
8857
+ useEffect(() => {
8858
+ try {
8859
+ const skeletonHtml = mjml(mjmlString, {
8860
+ fonts: {}
8861
+ }).html;
8862
+ const finalHtml = PluginManager.renderWithData(
8863
+ skeletonHtml,
8864
+ cloneDeep(mergetagsData || {})
8865
+ );
8866
+ setHtml(finalHtml);
8867
+ } catch (error2) {
8868
+ setHtml(
8869
+ `<div style="color:red;margin:auto;max-width:600px;font-size:24px;">${String(error2)}</div>`
8870
+ );
8871
+ }
8865
8872
  }, [mergetagsData, mjmlString]);
8866
8873
  return useMemo$1(() => {
8867
8874
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(SharedComponents.MobilePreview, { html, isActive: !isDesktop }), /* @__PURE__ */ React__default.createElement(
@@ -26573,13 +26580,13 @@ function ColorPicker$1(props) {
26573
26580
  const isPageVarMatch = EditorCore.isPageDataVariable(value);
26574
26581
  const isTemplateVarMatch = PluginManager.isVariable(value);
26575
26582
  const mergeTagColor = useMemo$1(() => {
26576
- if (isPageVarMatch) {
26577
- return EditorCore.renderWithPageVariables(value, pageDataVariables);
26578
- }
26579
- if (isTemplateVarMatch) {
26580
- return PluginManager.renderWithData(value, mergetagsData);
26581
- }
26582
26583
  try {
26584
+ if (isPageVarMatch) {
26585
+ return EditorCore.renderWithPageVariables(value, pageDataVariables);
26586
+ }
26587
+ if (isTemplateVarMatch) {
26588
+ return PluginManager.renderWithData(value, mergetagsData);
26589
+ }
26583
26590
  if (Color$1(`#${value}`).hex())
26584
26591
  return `#${value}`;
26585
26592
  } catch (error2) {
@@ -35606,6 +35613,9 @@ const styles$1 = {
35606
35613
  selectImage,
35607
35614
  exportFreeImage
35608
35615
  };
35616
+ const URLFormatter = (v) => {
35617
+ return v.replace(/"/g, `'`);
35618
+ };
35609
35619
  function ImageUploader(props) {
35610
35620
  const { unsplash, handleUploadClick, mergetags } = useEditorProps();
35611
35621
  const { pageDataVariables, mergetagsData } = useEditorContext();
@@ -35624,6 +35634,16 @@ function ImageUploader(props) {
35624
35634
  const onClose = useCallback$1(() => {
35625
35635
  setPopupVisible(false);
35626
35636
  }, []);
35637
+ const errorMessage = useMemo$1(() => {
35638
+ if (!props.value)
35639
+ return "";
35640
+ if (props.value.includes(`"`)) {
35641
+ return t(
35642
+ `Double quotes cannot be used, please use single quotes instead`
35643
+ );
35644
+ }
35645
+ return "";
35646
+ }, [props.value]);
35627
35647
  const uploadHandlerRef = useRef(
35628
35648
  props.uploadHandler
35629
35649
  );
@@ -35681,7 +35701,9 @@ function ImageUploader(props) {
35681
35701
  });
35682
35702
  }
35683
35703
  }, [props.value]);
35684
- const onChange = props.onChange;
35704
+ const onChange = useEventCallback((v) => {
35705
+ return props.onChange(URLFormatter(v));
35706
+ });
35685
35707
  const onUpload = useCallback$1(() => {
35686
35708
  if (handleUploadClick) {
35687
35709
  handleUploadClick({
@@ -35872,7 +35894,9 @@ function ImageUploader(props) {
35872
35894
  Form.Item,
35873
35895
  {
35874
35896
  style: { marginTop: 16, marginBottom: 0 },
35875
- label: t("URL")
35897
+ label: t("URL"),
35898
+ help: errorMessage,
35899
+ validateStatus: errorMessage ? "error" : void 0
35876
35900
  },
35877
35901
  /* @__PURE__ */ React__default.createElement(Grid.Row, { style: { width: "100%" } }, formatMergetags.length > 0 && /* @__PURE__ */ React__default.createElement(
35878
35902
  SharedComponents.MergeTagComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.38.6",
3
+ "version": "1.38.7",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"