easy-email-pro-theme 1.53.0 → 1.53.1

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
@@ -8127,7 +8127,7 @@ const Controller = () => {
8127
8127
  position: "fixed",
8128
8128
  bottom: offset.bottom,
8129
8129
  left: offset.left,
8130
- zIndex: 11,
8130
+ zIndex: 1,
8131
8131
  cursor: "grab"
8132
8132
  }
8133
8133
  },
@@ -14481,12 +14481,14 @@ const getElementPageLayout = (params) => {
14481
14481
  relativedElementVisible
14482
14482
  };
14483
14483
  };
14484
+ const EDITOR_CONTAINER = "EditorContainer";
14484
14485
  const HoveringToolbar = () => {
14485
14486
  const ref = useRef(null);
14486
14487
  const editor = useSlate();
14487
14488
  const { hoveringToolbar } = useEditorProps();
14488
14489
  const { selectedNode } = useSelectedNode();
14489
14490
  const [isFocus, setIsFocus] = useState(false);
14491
+ const { lock } = useEditorState();
14490
14492
  const { selection } = editor;
14491
14493
  const nodePath = selectedNode && (selection == null ? void 0 : selection.anchor.path) ? selection.anchor.path : null;
14492
14494
  const isTable2 = selectedNode && NodeUtils.isTable2Element(selectedNode);
@@ -14742,23 +14744,46 @@ const HoveringToolbar = () => {
14742
14744
  if (hoveringToolbar == null ? void 0 : hoveringToolbar.fixed) {
14743
14745
  return /* @__PURE__ */ React__default.createElement("div", null, content);
14744
14746
  }
14747
+ const editorContainer = document.getElementById(EDITOR_CONTAINER);
14745
14748
  return createPortal(
14746
- /* @__PURE__ */ React__default.createElement("div", { style: { position: "fixed", top: 0, left: 0, zIndex: 9999 } }, /* @__PURE__ */ React__default.createElement(
14749
+ /* @__PURE__ */ React__default.createElement(
14747
14750
  "div",
14748
14751
  {
14749
- ref,
14750
- key: String(isNotSelect),
14751
- id: "HoveringToolbar",
14752
- className: "HoveringToolbar",
14753
- "data-follow": (hoveringToolbar == null ? void 0 : hoveringToolbar.follow) || "selection"
14752
+ style: {
14753
+ position: "fixed",
14754
+ top: 0,
14755
+ left: 0,
14756
+ zIndex: 9999
14757
+ },
14758
+ onPointerDownCapture: (e) => {
14759
+ e.preventDefault();
14760
+ e.stopPropagation();
14761
+ }
14754
14762
  },
14755
- content,
14756
- /* @__PURE__ */ React__default.createElement("style", null, `#HoveringToolbar {
14763
+ /* @__PURE__ */ React__default.createElement(
14764
+ "div",
14765
+ {
14766
+ key: String(isNotSelect),
14767
+ id: "HoveringToolbar",
14768
+ ref,
14769
+ "data-follow": (hoveringToolbar == null ? void 0 : hoveringToolbar.follow) || "selection",
14770
+ className: "HoveringToolbar"
14771
+ },
14772
+ /* @__PURE__ */ React__default.createElement(
14773
+ "div",
14774
+ {
14775
+ className: "HoveringToolbar-list",
14776
+ style: { visibility: lock ? "hidden" : "visible" }
14777
+ },
14778
+ content
14779
+ ),
14780
+ /* @__PURE__ */ React__default.createElement("style", null, `#HoveringToolbar {
14757
14781
  --hovering-bar-icon-size: ${(hoveringToolbar == null ? void 0 : hoveringToolbar.iconSize) || 12}px;
14758
14782
 
14759
14783
  }`)
14760
- )),
14761
- document.body
14784
+ )
14785
+ ),
14786
+ editorContainer || document.body
14762
14787
  );
14763
14788
  };
14764
14789
  function ColorPickerContent(props) {
@@ -16454,9 +16479,12 @@ const Image$5 = () => {
16454
16479
  const editor = useSlate();
16455
16480
  const ref = useRef(null);
16456
16481
  const { onUpload } = useEditorProps();
16482
+ const { lock } = useEditorState();
16457
16483
  const [from] = Form.useForm();
16458
16484
  const onSubmit = (values) => {
16459
16485
  var _a;
16486
+ if (lock)
16487
+ return;
16460
16488
  let style = `max-width:100%;display:inline-block;`;
16461
16489
  if (values.width) {
16462
16490
  style += `width:${values.width};`;
@@ -16494,7 +16522,7 @@ const Image$5 = () => {
16494
16522
  popupStyle: { padding: "0px" }
16495
16523
  },
16496
16524
  getPopupContainer: (node) => {
16497
- return Array.from(document.querySelectorAll(".RichTextBar")).find(
16525
+ return Array.from(document.querySelectorAll("#HoveringToolbar")).find(
16498
16526
  (item2) => item2.contains(node)
16499
16527
  );
16500
16528
  },
@@ -16505,13 +16533,38 @@ const Image$5 = () => {
16505
16533
  bodyStyle: { padding: "0px" },
16506
16534
  title: /* @__PURE__ */ React__default.createElement("div", { style: { textAlign: "left" } }, t(`Insert image`))
16507
16535
  },
16508
- /* @__PURE__ */ React__default.createElement(Form, { onSubmit, form: from }, /* @__PURE__ */ React__default.createElement("div", { style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(
16536
+ lock && /* @__PURE__ */ React__default.createElement(
16537
+ Alert,
16538
+ {
16539
+ type: "warning",
16540
+ content: t(
16541
+ `This component is locked by the image drawer. Please complete your actions there first.`
16542
+ )
16543
+ }
16544
+ ),
16545
+ /* @__PURE__ */ React__default.createElement("div", { style: { position: "relative" } }, lock && /* @__PURE__ */ React__default.createElement(
16546
+ "div",
16547
+ {
16548
+ style: {
16549
+ position: "absolute",
16550
+ top: 0,
16551
+ left: 0,
16552
+ right: 0,
16553
+ bottom: 0,
16554
+ backgroundColor: "rgba(255, 255, 255, 0.3)",
16555
+ zIndex: 10,
16556
+ cursor: "not-allowed"
16557
+ }
16558
+ }
16559
+ ), /* @__PURE__ */ React__default.createElement(Form, { onSubmit, form: from }, /* @__PURE__ */ React__default.createElement("div", { style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(
16509
16560
  AttributeField.ImageUploaderField,
16510
16561
  {
16511
16562
  path: null,
16512
16563
  name: "src",
16513
16564
  label: null,
16565
+ enablePreview: false,
16514
16566
  uploadHandler: onUpload,
16567
+ pinToParent: true,
16515
16568
  formItem: {
16516
16569
  wrapperCol: {
16517
16570
  span: 24
@@ -16555,10 +16608,10 @@ const Image$5 = () => {
16555
16608
  }
16556
16609
  }
16557
16610
  }
16558
- )))), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: "0px" } }), /* @__PURE__ */ React__default.createElement(Grid.Row, { justify: "end", style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(Button$2, { type: "primary", htmlType: "submit" }, t(`Apply`)), /* @__PURE__ */ React__default.createElement(Button$2, { onClick: () => {
16611
+ )))), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: "0px" } }), /* @__PURE__ */ React__default.createElement(Grid.Row, { justify: "end", style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(Button$2, { type: "primary", htmlType: "submit", disabled: lock }, t(`Apply`)), /* @__PURE__ */ React__default.createElement(Button$2, { onClick: () => {
16559
16612
  var _a;
16560
16613
  return (_a = ref.current) == null ? void 0 : _a.click();
16561
- } }, t(`Cancel`)))))
16614
+ } }, t(`Cancel`))))))
16562
16615
  )
16563
16616
  },
16564
16617
  /* @__PURE__ */ React__default.createElement("span", { ref, className: classnames$1("formatButton") }, /* @__PURE__ */ React__default.createElement("span", { className: classnames$1(" iconfont icon-img") }))
@@ -27489,7 +27542,9 @@ function ImageUploader(props) {
27489
27542
  const [isUploading, setIsUploading] = useState(false);
27490
27543
  const [preview, setPreview] = useState(false);
27491
27544
  const [unsplashVisible, setUnsplashVisible] = useState(false);
27545
+ const popupContainerRef = useRef(null);
27492
27546
  const [popupVisible, setPopupVisible] = useState(false);
27547
+ const pinToParent = props.pinToParent;
27493
27548
  const onChangeMergeTag = useCallback(
27494
27549
  (mergetag) => {
27495
27550
  props.onChange(PluginManager.generateVariable(mergetag));
@@ -27659,17 +27714,11 @@ function ImageUploader(props) {
27659
27714
  });
27660
27715
  const onCloseUnsplash = useEventCallback(() => __async(this, null, function* () {
27661
27716
  if (dirty) {
27662
- yield onSave();
27717
+ props.onChange(initialVal.current);
27663
27718
  }
27664
27719
  setUnsplashVisible(false);
27665
27720
  setLock(false);
27666
27721
  }));
27667
- useEffect(() => {
27668
- if (!unsplashVisible)
27669
- return;
27670
- const isLock = dirty;
27671
- setLock(isLock);
27672
- }, [dirty, setLock, unsplashVisible]);
27673
27722
  const formatMergetags = useMemo(() => {
27674
27723
  return getMergeTagsByType(mergetags || [], "image");
27675
27724
  }, [mergetags]);
@@ -27707,20 +27756,24 @@ function ImageUploader(props) {
27707
27756
  "div",
27708
27757
  {
27709
27758
  className: styles$2.exportFreeImage,
27710
- onClick: () => setUnsplashVisible(true)
27759
+ onClick: () => {
27760
+ setUnsplashVisible(true);
27761
+ setLock(true);
27762
+ }
27711
27763
  },
27712
27764
  t("Export free images")
27713
27765
  )) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { style: { fontSize: 16 } }, t("Attach your image here.")), /* @__PURE__ */ React__default.createElement("div", { style: { color: "#606A72", fontSize: 14 } }, t("Accepts .jpg, .jpeg, .png, and .gif file types.")))
27714
27766
  ));
27715
27767
  }
27716
27768
  return /* @__PURE__ */ React__default.createElement("img", { src: image2, style: { maxWidth: "100%", maxHeight: "100%" } });
27717
- }, [image2, isUploading, onUpload, props.value, unsplashClientId]);
27769
+ }, [image2, isUploading, onUpload, props.value, setLock, unsplashClientId]);
27718
27770
  if (!props.uploadHandler) {
27719
27771
  return /* @__PURE__ */ React__default.createElement(Input, { value: props.value, onChange });
27720
27772
  }
27721
27773
  return /* @__PURE__ */ React__default.createElement(
27722
27774
  "div",
27723
27775
  {
27776
+ ref: popupContainerRef,
27724
27777
  onClick: (e) => {
27725
27778
  e.stopPropagation();
27726
27779
  e.preventDefault();
@@ -27763,7 +27816,10 @@ function ImageUploader(props) {
27763
27816
  Select$1.Option,
27764
27817
  {
27765
27818
  value: "2",
27766
- onClick: () => setUnsplashVisible(true)
27819
+ onClick: () => {
27820
+ setUnsplashVisible(true);
27821
+ setLock(true);
27822
+ }
27767
27823
  },
27768
27824
  t("Export free images")
27769
27825
  )
@@ -27789,6 +27845,7 @@ function ImageUploader(props) {
27789
27845
  popupVisible,
27790
27846
  onVisibleChange: setPopupVisible,
27791
27847
  onChange: onChangeMergeTag,
27848
+ getPopupContainer: pinToParent ? () => popupContainerRef.current || document.body : void 0,
27792
27849
  onClose,
27793
27850
  value: "",
27794
27851
  triggerElement: /* @__PURE__ */ React__default.createElement(
@@ -27810,14 +27867,6 @@ function ImageUploader(props) {
27810
27867
  allowClear: true
27811
27868
  }
27812
27869
  ))
27813
- ), /* @__PURE__ */ React__default.createElement(
27814
- Modal,
27815
- {
27816
- visible: preview,
27817
- footer: null,
27818
- onCancel: () => setPreview(false)
27819
- },
27820
- /* @__PURE__ */ React__default.createElement("img", { alt: "Preview", style: { width: "100%" }, src: image2 })
27821
27870
  )),
27822
27871
  /* @__PURE__ */ React__default.createElement(
27823
27872
  Drawer,
@@ -27883,6 +27932,20 @@ function ImageUploader(props) {
27883
27932
  presetList: unsplash == null ? void 0 : unsplash.presetList
27884
27933
  }
27885
27934
  )
27935
+ ),
27936
+ /* @__PURE__ */ React__default.createElement(
27937
+ Modal,
27938
+ {
27939
+ wrapClassName: "ImageUploaderField-preview",
27940
+ visible: preview,
27941
+ footer: null,
27942
+ onCancel: () => setPreview(false),
27943
+ getPopupContainer: () => {
27944
+ return document.body;
27945
+ },
27946
+ style: { zIndex: 9999 }
27947
+ },
27948
+ /* @__PURE__ */ React__default.createElement("img", { alt: "Preview", style: { width: "100%" }, src: image2 })
27886
27949
  )
27887
27950
  );
27888
27951
  }
@@ -38808,6 +38871,7 @@ const ContextMenu = ({
38808
38871
  deleteSelectedColumn,
38809
38872
  mergeCeils
38810
38873
  } = useTableInteract();
38874
+ const ele = document.getElementById("HoveringToolbar");
38811
38875
  return createPortal(
38812
38876
  /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(
38813
38877
  "div",
@@ -38883,7 +38947,7 @@ const ContextMenu = ({
38883
38947
  /* @__PURE__ */ React__default.createElement("div", { className: "easy-email-pro-table-operation-menu-text" }, "Delete selected rows")
38884
38948
  )
38885
38949
  ), /* @__PURE__ */ React__default.createElement("style", null, styleText$b)),
38886
- document.body
38950
+ ele || document.body
38887
38951
  );
38888
38952
  };
38889
38953
  const ERROR_LIMIT = 2;
@@ -38907,12 +38971,32 @@ const TableTools = (props) => {
38907
38971
  return;
38908
38972
  const handleContextmenu = (ev) => {
38909
38973
  ev.preventDefault();
38910
- setShowContextMenu(true);
38911
38974
  const iframeRect = iframe.getBoundingClientRect();
38975
+ const initialLeft = ev.clientX + iframeRect.left;
38976
+ const initialTop = ev.clientY + iframeRect.top;
38977
+ const MENU_HEIGHT = 280;
38978
+ const MENU_WIDTH = 220;
38979
+ const viewportHeight = window.innerHeight;
38980
+ const viewportWidth = window.innerWidth;
38981
+ let adjustedLeft = initialLeft;
38982
+ let adjustedTop = initialTop;
38983
+ if (initialTop + MENU_HEIGHT > viewportHeight) {
38984
+ adjustedTop = initialTop - MENU_HEIGHT;
38985
+ if (adjustedTop < 0) {
38986
+ adjustedTop = 8;
38987
+ }
38988
+ }
38989
+ if (initialLeft + MENU_WIDTH > viewportWidth) {
38990
+ adjustedLeft = viewportWidth - MENU_WIDTH - 8;
38991
+ }
38992
+ if (adjustedLeft < 0) {
38993
+ adjustedLeft = 8;
38994
+ }
38912
38995
  setPosition({
38913
- left: ev.clientX + iframeRect.left,
38914
- top: ev.clientY + iframeRect.top
38996
+ left: adjustedLeft + 20,
38997
+ top: adjustedTop
38915
38998
  });
38999
+ setShowContextMenu(true);
38916
39000
  };
38917
39001
  props.nodeElement.addEventListener("contextmenu", handleContextmenu);
38918
39002
  return () => {
@@ -39383,6 +39467,35 @@ const getIsLargeScreen = () => {
39383
39467
  const isLargeScreen = windowSize >= 1600;
39384
39468
  return isLargeScreen;
39385
39469
  };
39470
+ const EditorContainer = ({
39471
+ children,
39472
+ style
39473
+ }) => {
39474
+ const { lock } = useEditorState();
39475
+ return /* @__PURE__ */ React__default.createElement("div", { style: __spreadProps(__spreadValues({}, style), { position: "relative" }), id: EDITOR_CONTAINER }, lock && /* @__PURE__ */ React__default.createElement(
39476
+ "div",
39477
+ {
39478
+ style: {
39479
+ position: "absolute",
39480
+ top: 0,
39481
+ left: 0,
39482
+ right: 0,
39483
+ bottom: 0,
39484
+ backgroundColor: "rgba(255, 255, 255, 0.3)",
39485
+ zIndex: 10,
39486
+ cursor: "not-allowed"
39487
+ },
39488
+ onPointerDown: (e) => {
39489
+ e.preventDefault();
39490
+ e.stopPropagation();
39491
+ },
39492
+ onClick: (e) => {
39493
+ e.preventDefault();
39494
+ e.stopPropagation();
39495
+ }
39496
+ }
39497
+ ), children);
39498
+ };
39386
39499
  const useCreateConfig$1 = (_k) => {
39387
39500
  var _l = _k, {
39388
39501
  interactiveStyle,
@@ -39513,15 +39626,20 @@ const Layout$1 = ({ children, footer, header, tabLeft, tabRight }) => {
39513
39626
  },
39514
39627
  /* @__PURE__ */ React__default.createElement(SharedComponents.BlockSideBar, { height })
39515
39628
  ),
39516
- /* @__PURE__ */ React__default.createElement("div", { style: { height, minWidth: 800, flex: 1 } }, /* @__PURE__ */ React__default.createElement(
39517
- SharedComponents.EditorTabs,
39629
+ /* @__PURE__ */ React__default.createElement(
39630
+ EditorContainer,
39518
39631
  {
39519
- header,
39520
- footer,
39521
- left: tabLeft,
39522
- right: tabRight
39632
+ style: { height, minWidth: 800, flex: 1 }
39523
39633
  },
39524
- /* @__PURE__ */ React__default.createElement(EmailEditor, null, /* @__PURE__ */ React__default.createElement("style", { id: "Retro-CSS" }, styleText$h, RetroStyleText, `
39634
+ /* @__PURE__ */ React__default.createElement(
39635
+ SharedComponents.EditorTabs,
39636
+ {
39637
+ header,
39638
+ footer,
39639
+ left: tabLeft,
39640
+ right: tabRight
39641
+ },
39642
+ /* @__PURE__ */ React__default.createElement(EmailEditor, null, /* @__PURE__ */ React__default.createElement("style", { id: "Retro-CSS" }, styleText$h, RetroStyleText, `
39525
39643
  body {
39526
39644
  --page-width: ${pageDataWidth}px;
39527
39645
  }
@@ -39533,7 +39651,8 @@ const Layout$1 = ({ children, footer, header, tabLeft, tabRight }) => {
39533
39651
  }
39534
39652
 
39535
39653
  `), children)
39536
- )),
39654
+ )
39655
+ ),
39537
39656
  showSidebar && compact && /* @__PURE__ */ React__default.createElement(
39538
39657
  Layout$2.Sider,
39539
39658
  {
package/lib/style.css CHANGED
@@ -1069,6 +1069,9 @@ THEMES:
1069
1069
  z-index: 1;
1070
1070
  top: -10000px;
1071
1071
  left: -10000px;
1072
+ }
1073
+
1074
+ .HoveringToolbar-list {
1072
1075
  padding: 3px;
1073
1076
  display: flex;
1074
1077
  align-items: center;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare const EditorContainer: ({ children, style, }: {
3
+ children: React.ReactNode;
4
+ style?: React.CSSProperties | undefined;
5
+ }) => React.JSX.Element;
@@ -20,6 +20,7 @@ export interface ImageUploaderProps {
20
20
  enablePreview?: boolean;
21
21
  onlyPreview?: boolean;
22
22
  colSpan?: number;
23
+ pinToParent?: boolean;
23
24
  }
24
25
  declare function ImageUploader(props: ImageUploaderProps): React.JSX.Element;
25
26
  export declare const ImageUploaderField: (props: import("../enhancer").EnhancerProps & Omit<ImageUploaderProps, "onChange" | "value">) => React.JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const EDITOR_CONTAINER = "EditorContainer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.53.0",
3
+ "version": "1.53.1",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"