easy-email-pro-theme 1.38.4 → 1.38.6

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 +60 -34
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1497,7 +1497,7 @@ const useElementDefault = ({
1497
1497
  };
1498
1498
  const useElementInteract = () => {
1499
1499
  const editor = useSlate();
1500
- const { setSelectedNodePath, setHoverNodePath, selectedNodePath } = useEditorState();
1500
+ const { setSelectedNodePath, setHoverNodePath, selectedNodePath, lock } = useEditorState();
1501
1501
  const { selectedNode } = useSelectedNode();
1502
1502
  const { emptyPageElement } = useEditorProps();
1503
1503
  const lastSelectedNode = useRef(null);
@@ -1511,6 +1511,8 @@ const useElementInteract = () => {
1511
1511
  }
1512
1512
  const copyBlock = useCallback$1(
1513
1513
  (path2) => {
1514
+ if (lock)
1515
+ return;
1514
1516
  const block = Node$1.get(editor, path2);
1515
1517
  const next = Path.next(path2);
1516
1518
  Transforms.insertNodes(editor, cloneDeep(block), {
@@ -1521,10 +1523,12 @@ const useElementInteract = () => {
1521
1523
  } catch (error2) {
1522
1524
  }
1523
1525
  },
1524
- [editor, setSelectedNodePath]
1526
+ [editor, lock, setSelectedNodePath]
1525
1527
  );
1526
1528
  const moveUp3 = useCallback$1(
1527
1529
  (path2) => {
1530
+ if (lock)
1531
+ return;
1528
1532
  try {
1529
1533
  const previous = Path.previous(path2);
1530
1534
  if (!Node$1.get(editor, previous))
@@ -1538,10 +1542,12 @@ const useElementInteract = () => {
1538
1542
  } catch (error2) {
1539
1543
  }
1540
1544
  },
1541
- [editor, setSelectedNodePath]
1545
+ [editor, lock, setSelectedNodePath]
1542
1546
  );
1543
1547
  const moveDown3 = useCallback$1(
1544
1548
  (path2) => {
1549
+ if (lock)
1550
+ return;
1545
1551
  try {
1546
1552
  const next = Path.next(path2);
1547
1553
  if (!Node$1.get(editor, next))
@@ -1555,10 +1561,12 @@ const useElementInteract = () => {
1555
1561
  } catch (error2) {
1556
1562
  }
1557
1563
  },
1558
- [editor, setSelectedNodePath]
1564
+ [editor, lock, setSelectedNodePath]
1559
1565
  );
1560
1566
  const deleteBlock = useCallback$1(
1561
1567
  (path2) => {
1568
+ if (lock)
1569
+ return;
1562
1570
  try {
1563
1571
  const [entry] = Editor.nodes(editor, {
1564
1572
  match(node, currentPath) {
@@ -1582,10 +1590,12 @@ const useElementInteract = () => {
1582
1590
  console.log(error2);
1583
1591
  }
1584
1592
  },
1585
- [editor, setHoverNodePath, setSelectedNodePath]
1593
+ [editor, lock, setHoverNodePath, setSelectedNodePath]
1586
1594
  );
1587
1595
  const clearCanvas = useCallback$1(() => {
1588
1596
  Editor.withoutNormalizing(editor, () => {
1597
+ if (lock)
1598
+ return;
1589
1599
  const pageElement = editor.children[0];
1590
1600
  const newPageElement = BlockManager.getBlockByType(
1591
1601
  ElementType.PAGE
@@ -1617,7 +1627,7 @@ const useElementInteract = () => {
1617
1627
  });
1618
1628
  setSelectedNodePath(null);
1619
1629
  Transforms.deselect(editor);
1620
- }, [editor, emptyPageElement, setSelectedNodePath]);
1630
+ }, [editor, emptyPageElement, lock, setSelectedNodePath]);
1621
1631
  const resetSelectedNode = useEventCallback(() => {
1622
1632
  if (!selectedNodePath || !lastSelectedNode.current)
1623
1633
  return;
@@ -2056,7 +2066,11 @@ const ElementPlaceholder$1 = ({ element, nodeElement, isSelected, isHover, path:
2056
2066
  renderContent = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderContent, /* @__PURE__ */ React__default.createElement("div", { className: "wrapper-category-hover" }));
2057
2067
  }
2058
2068
  }
2059
- const parentElement = Node$1.get(editor, Path.parent(path2));
2069
+ let parentElement = void 0;
2070
+ try {
2071
+ parentElement = Node$1.get(editor, Path.parent(path2));
2072
+ } catch (error2) {
2073
+ }
2060
2074
  if (isUnsetElement && parentElement && NodeUtils.isContentElement(parentElement)) {
2061
2075
  isContentElement = true;
2062
2076
  }
@@ -7551,23 +7565,27 @@ const BlockLayer = () => {
7551
7565
  );
7552
7566
  const onSelect = useCallback$1(
7553
7567
  (item2) => {
7554
- const currentPath = ReactEditor.findPath(editor, item2.data);
7555
- const element = Node$1.get(editor, currentPath);
7556
- if (!NodeUtils.isBlockElement(element) || NodeUtils.isUnsetElement(element)) {
7557
- return;
7558
- }
7559
- setSelectedNodePath(currentPath);
7560
- if (scrollWhenSelect) {
7561
- setTimeout(() => {
7562
- const node = ReactEditor.toDOMNode(editor, item2.data);
7563
- if (node) {
7564
- node.scrollIntoView({
7565
- block: "center",
7566
- behavior: "smooth",
7567
- inline: "center"
7568
- });
7569
- }
7570
- }, 200);
7568
+ try {
7569
+ const currentPath = ReactEditor.findPath(editor, item2.data);
7570
+ const element = Node$1.get(editor, currentPath);
7571
+ if (!NodeUtils.isBlockElement(element) || NodeUtils.isUnsetElement(element)) {
7572
+ return;
7573
+ }
7574
+ setSelectedNodePath(currentPath);
7575
+ if (scrollWhenSelect) {
7576
+ setTimeout(() => {
7577
+ const node = ReactEditor.toDOMNode(editor, item2.data);
7578
+ if (node) {
7579
+ node.scrollIntoView({
7580
+ block: "center",
7581
+ behavior: "smooth",
7582
+ inline: "center"
7583
+ });
7584
+ }
7585
+ }, 200);
7586
+ }
7587
+ } catch (error2) {
7588
+ console.log(error2);
7571
7589
  }
7572
7590
  },
7573
7591
  [editor, scrollWhenSelect, setSelectedNodePath]
@@ -7921,13 +7939,17 @@ const ConfigurationPanel = ({
7921
7939
  const { quantityLimitCheck, compact } = useEditorProps();
7922
7940
  const { copyBlock, deleteBlock, isChanged, resetSelectedNode } = useElementInteract();
7923
7941
  const onCopy = useEventCallback((path2) => {
7924
- if (quantityLimitCheck && !quantityLimitCheck({
7925
- element: Node$1.get(editor, path2),
7926
- pageData: editor.children[0]
7927
- })) {
7928
- return;
7942
+ try {
7943
+ if (quantityLimitCheck && !quantityLimitCheck({
7944
+ element: Node$1.get(editor, path2),
7945
+ pageData: editor.children[0]
7946
+ })) {
7947
+ return;
7948
+ }
7949
+ copyBlock(path2);
7950
+ } catch (error2) {
7951
+ console.error(error2);
7929
7952
  }
7930
- copyBlock(path2);
7931
7953
  });
7932
7954
  let element = null;
7933
7955
  if (selectedNodePath) {
@@ -35638,7 +35660,7 @@ function ImageUploader(props) {
35638
35660
  return props.value;
35639
35661
  }, [mergetagsData, pageDataVariables, props.value]);
35640
35662
  useEffect(() => {
35641
- if (props.value && isValidHttpUrl(props.value)) {
35663
+ if (props.value && (props.value.startsWith("http") || props.value.startsWith("blob"))) {
35642
35664
  Promise.all([
35643
35665
  fetch(props.value).then((r) => r.arrayBuffer()).then((buffer) => +(buffer.byteLength / 1024).toFixed(2)).catch(() => 0),
35644
35666
  previewLoadImage(props.value)
@@ -35743,15 +35765,19 @@ function ImageUploader(props) {
35743
35765
  initialVal.current = cbUrl;
35744
35766
  setIsUploading(false);
35745
35767
  setUnsplashVisible(false);
35768
+ setLock(false);
35746
35769
  });
35747
- const onCloseUnsplash = () => __async(this, null, function* () {
35770
+ const onCloseUnsplash = useEventCallback(() => __async(this, null, function* () {
35748
35771
  if (dirty) {
35749
35772
  yield onSave();
35750
35773
  }
35751
35774
  setUnsplashVisible(false);
35752
- });
35775
+ setLock(false);
35776
+ }));
35753
35777
  useEffect(() => {
35754
- const isLock = unsplashVisible && dirty;
35778
+ if (!unsplashVisible)
35779
+ return;
35780
+ const isLock = dirty;
35755
35781
  setLock(isLock);
35756
35782
  }, [dirty, setLock, unsplashVisible]);
35757
35783
  const formatMergetags = useMemo$1(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.38.4",
3
+ "version": "1.38.6",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"