easy-email-pro-theme 1.51.2 → 1.51.4

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/lib/index.js CHANGED
@@ -62,8 +62,8 @@ import { NodeUtils, BlockManager, ElementType, EditorCore, t, ElementCategory, c
62
62
  import { cloneDeep, get, isEqual, set, omit as omit$2, merge as merge$1, debounce as debounce$2, isUndefined as isUndefined$1, uniqueId, isString as isString$1, isFunction as isFunction$4, isNumber as isNumber$1, upperFirst, sum, flatMap } from "lodash";
63
63
  import { Editor, Range, Node, Transforms, Path, Text as Text$2, createEditor } from "slate";
64
64
  import { nanoid } from "nanoid";
65
- import { Form, Input, Modal, Collapse, Space, Empty, Card, Grid, Button as Button$2, Drawer, Switch, Typography as Typography$1, Tabs, Radio, Divider as Divider$2, Alert, Popconfirm, Tooltip, Message, PageHeader, Spin, Layout as Layout$2, Popover, Select as Select$1, Slider, InputNumber, Tag, Link as Link$3, List as List$1, Skeleton, Trigger } from "@arco-design/web-react";
66
- import { IconPlus, IconDelete, IconEdit, IconLeft, IconCopy, IconUndo, IconRedo, IconMinus, IconEye, IconSubscribeAdd, IconClose, IconCheckCircleFill, IconDragArrow, IconPalette, IconLock, IconUnlock, IconImage, IconQuestionCircle, IconLink, IconCloud, IconDragDotVertical, IconSend, IconDown } from "@arco-design/web-react/icon";
65
+ import { Form, Input, Modal, Collapse, Space, Empty, Card, Grid, Button as Button$2, Drawer, Switch, Typography as Typography$1, Tabs, Radio, Tooltip, Divider as Divider$2, Alert, Popconfirm, Message, PageHeader, Spin, Layout as Layout$2, Popover, Select as Select$1, Slider, InputNumber, Tag, Link as Link$3, List as List$1, Skeleton, Trigger } from "@arco-design/web-react";
66
+ import { IconPlus, IconDelete, IconEdit, IconLeft, IconDownload, IconCopy, IconUndo, IconRedo, IconMinus, IconEye, IconSubscribeAdd, IconClose, IconCheckCircleFill, IconDragArrow, IconPalette, IconLock, IconUnlock, IconImage, IconQuestionCircle, IconLink, IconCloud, IconDragDotVertical, IconSend, IconDown } from "@arco-design/web-react/icon";
67
67
  import { unstable_batchedUpdates, createPortal } from "react-dom";
68
68
  import mjml from "mjml-browser";
69
69
  import { HistoryEditor } from "slate-history";
@@ -7807,7 +7807,8 @@ const ConfigurationPanel = ({
7807
7807
  const universalElementPath = useUniversalElementPath();
7808
7808
  const standaloneElementPath = useStandaloneElementPath();
7809
7809
  const lock = useLockState();
7810
- const { quantityLimitCheck, compact } = useEditorProps();
7810
+ const [generateImageLoading, setGenerateImageLoading] = useState(false);
7811
+ const { quantityLimitCheck, compact, onUpload, showGenerateBlockImage } = useEditorProps();
7811
7812
  const { copyBlock, deleteBlock, isChanged, resetSelectedNode } = useElementInteract();
7812
7813
  const onCopy = useEventCallback((path2) => {
7813
7814
  try {
@@ -7822,6 +7823,31 @@ const ConfigurationPanel = ({
7822
7823
  console.error(error2);
7823
7824
  }
7824
7825
  });
7826
+ const generateImage = useEventCallback(() => __async(void 0, null, function* () {
7827
+ if (!selectedNodePath)
7828
+ return;
7829
+ try {
7830
+ setGenerateImageLoading(true);
7831
+ const element2 = Node.get(editor, selectedNodePath);
7832
+ const html2canvas = (yield import("./html2canvas.esm-858519c4.js")).default;
7833
+ const container2 = ReactEditor.toDOMNode(editor, element2);
7834
+ const blob = yield new Promise((resolve) => {
7835
+ html2canvas(container2, { useCORS: true }).then((canvas) => {
7836
+ return canvas.toBlob(resolve, "png", 0.1);
7837
+ });
7838
+ });
7839
+ if (blob) {
7840
+ const blobUrl = yield onUpload == null ? void 0 : onUpload(blob);
7841
+ if (blobUrl) {
7842
+ window.open(blobUrl, "_blank");
7843
+ }
7844
+ }
7845
+ } catch (error2) {
7846
+ console.error(error2);
7847
+ } finally {
7848
+ setGenerateImageLoading(false);
7849
+ }
7850
+ }));
7825
7851
  let element = null;
7826
7852
  if (selectedNodePath) {
7827
7853
  try {
@@ -7878,7 +7904,27 @@ const ConfigurationPanel = ({
7878
7904
  },
7879
7905
  BlockManager.getBlockTitle(element)
7880
7906
  ),
7881
- !isSelectedUniversalElement && !isSelectedStandaloneElement && /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(
7907
+ /* @__PURE__ */ React__default.createElement(Space, null, showGenerateBlockImage && /* @__PURE__ */ React__default.createElement(
7908
+ Tooltip,
7909
+ {
7910
+ content: t("Export block image"),
7911
+ getPopupContainer: () => document.body,
7912
+ triggerProps: {
7913
+ style: {
7914
+ zIndex: 9999
7915
+ }
7916
+ }
7917
+ },
7918
+ /* @__PURE__ */ React__default.createElement(
7919
+ Button$2,
7920
+ {
7921
+ loading: generateImageLoading,
7922
+ size: "small",
7923
+ icon: /* @__PURE__ */ React__default.createElement(IconDownload, null),
7924
+ onClick: generateImage
7925
+ }
7926
+ )
7927
+ ), !isSelectedUniversalElement && !isSelectedStandaloneElement && /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(
7882
7928
  Button$2,
7883
7929
  {
7884
7930
  onClick: () => onCopy(selectedNodePath),
@@ -7892,7 +7938,7 @@ const ConfigurationPanel = ({
7892
7938
  size: "small",
7893
7939
  icon: /* @__PURE__ */ React__default.createElement(IconDelete, null)
7894
7940
  }
7895
- )),
7941
+ ))),
7896
7942
  /* @__PURE__ */ React__default.createElement("div", { style: { marginRight: 10 } })
7897
7943
  ), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: 0 } }), /* @__PURE__ */ React__default.createElement(
7898
7944
  SharedComponents.FullHeightOverlayScrollbars,
@@ -7938,17 +7984,20 @@ const ConfigurationPanel = ({
7938
7984
  element,
7939
7985
  selectedNodePath,
7940
7986
  universalElementPath,
7987
+ standaloneElementPath,
7941
7988
  universalElementEditing,
7989
+ standaloneElementEditing,
7942
7990
  compact,
7943
7991
  lock,
7944
7992
  onClose,
7993
+ showGenerateBlockImage,
7994
+ generateImageLoading,
7995
+ generateImage,
7945
7996
  height,
7946
7997
  isChanged,
7947
7998
  resetSelectedNode,
7948
7999
  onCopy,
7949
- deleteBlock,
7950
- standaloneElementEditing,
7951
- standaloneElementPath
8000
+ deleteBlock
7952
8001
  ]);
7953
8002
  };
7954
8003
  const index$9 = "";
@@ -14776,7 +14825,8 @@ const BgColor = () => {
14776
14825
  {
14777
14826
  match: Text$2.isText,
14778
14827
  split: true,
14779
- at: mergeNodeEntry ? mergeNodeEntry[1] : void 0
14828
+ at: mergeNodeEntry ? mergeNodeEntry[1] : void 0,
14829
+ voids: true
14780
14830
  }
14781
14831
  );
14782
14832
  } else {
@@ -14889,7 +14939,8 @@ const FontColor = () => {
14889
14939
  {
14890
14940
  match: Text$2.isText,
14891
14941
  split: true,
14892
- at: mergeNodeEntry ? mergeNodeEntry[1] : void 0
14942
+ at: mergeNodeEntry ? mergeNodeEntry[1] : void 0,
14943
+ voids: true
14893
14944
  }
14894
14945
  );
14895
14946
  } else {
@@ -16035,12 +16086,21 @@ const FontSize$2 = () => {
16035
16086
  const [fontSizeValue, setFontSizeValue] = useState();
16036
16087
  const { setFieldValue } = useEditorContext();
16037
16088
  const editor = useSlate();
16038
- const [nodeEntry] = Editor.nodes(editor, {
16089
+ let [nodeEntry] = Editor.nodes(editor, {
16039
16090
  match: (node) => {
16040
16091
  return Text$2.isText(node);
16041
16092
  },
16042
16093
  mode: "lowest"
16043
16094
  });
16095
+ if (!nodeEntry) {
16096
+ const [mergetagNodeEntry] = Editor.nodes(editor, {
16097
+ match: (node) => {
16098
+ return NodeUtils.isMergetagElement(node);
16099
+ },
16100
+ mode: "lowest"
16101
+ });
16102
+ nodeEntry = mergetagNodeEntry;
16103
+ }
16044
16104
  const textNode = nodeEntry == null ? void 0 : nodeEntry[0];
16045
16105
  useEffect(() => {
16046
16106
  let fontSizeValue2 = textNode == null ? void 0 : textNode.fontSize;
@@ -16089,7 +16149,8 @@ const FontSize$2 = () => {
16089
16149
  {
16090
16150
  match: Text$2.isText,
16091
16151
  split: true,
16092
- at: mergeNodeEntry ? mergeNodeEntry[1] : void 0
16152
+ at: mergeNodeEntry ? mergeNodeEntry[1] : void 0,
16153
+ voids: true
16093
16154
  }
16094
16155
  );
16095
16156
  } else {
@@ -16123,12 +16184,21 @@ const FontFamily$2 = () => {
16123
16184
  const editor = useSlate();
16124
16185
  const { setFieldValue } = useEditorContext();
16125
16186
  const [fontFamilyValue, setFontFamilyValue] = useState();
16126
- const [nodeEntry] = Editor.nodes(editor, {
16187
+ let [nodeEntry] = Editor.nodes(editor, {
16127
16188
  match: (node) => {
16128
16189
  return Text$2.isText(node);
16129
16190
  },
16130
16191
  mode: "lowest"
16131
16192
  });
16193
+ if (!nodeEntry) {
16194
+ const [mergetagNodeEntry] = Editor.nodes(editor, {
16195
+ match: (node) => {
16196
+ return NodeUtils.isMergetagElement(node);
16197
+ },
16198
+ mode: "lowest"
16199
+ });
16200
+ nodeEntry = mergetagNodeEntry;
16201
+ }
16132
16202
  const textNode = nodeEntry == null ? void 0 : nodeEntry[0];
16133
16203
  useEffect(() => {
16134
16204
  var _a;
@@ -16178,7 +16248,8 @@ const FontFamily$2 = () => {
16178
16248
  {
16179
16249
  match: Text$2.isText,
16180
16250
  split: true,
16181
- at: mergeNodeEntry ? mergeNodeEntry[1] : void 0
16251
+ at: mergeNodeEntry ? mergeNodeEntry[1] : void 0,
16252
+ voids: true
16182
16253
  }
16183
16254
  );
16184
16255
  } else {
@@ -147,6 +147,7 @@ export interface PluginsCustomEditorTypes {
147
147
  showSidebar?: boolean;
148
148
  showLogic?: boolean;
149
149
  showLayer?: boolean;
150
+ showGenerateBlockImage?: boolean;
150
151
  showTextHTMLMode?: boolean;
151
152
  showTextDirectionMode?: boolean;
152
153
  showDragMoveIcon?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.51.2",
3
+ "version": "1.51.4",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"