easy-email-extensions 3.0.9 → 3.0.10

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 (143) hide show
  1. package/lib/AttributePanel/AttributePanel.d.ts +3 -3
  2. package/lib/AttributePanel/components/UI/Help/index.d.ts +7 -7
  3. package/lib/AttributePanel/components/UI/HtmlEditor.d.ts +5 -5
  4. package/lib/AttributePanel/components/attributes/Align.d.ts +1 -1
  5. package/lib/AttributePanel/components/attributes/AttributesPanelWrapper/index.d.ts +6 -6
  6. package/lib/AttributePanel/components/attributes/Background.d.ts +1 -1
  7. package/lib/AttributePanel/components/attributes/BackgroundColor.d.ts +3 -3
  8. package/lib/AttributePanel/components/attributes/Border.d.ts +1 -1
  9. package/lib/AttributePanel/components/attributes/BorderColor.d.ts +1 -1
  10. package/lib/AttributePanel/components/attributes/BorderStyle.d.ts +5 -5
  11. package/lib/AttributePanel/components/attributes/BorderWidth.d.ts +1 -1
  12. package/lib/AttributePanel/components/attributes/Color.d.ts +4 -4
  13. package/lib/AttributePanel/components/attributes/ContainerBackgroundColor.d.ts +3 -3
  14. package/lib/AttributePanel/components/attributes/Decoration.d.ts +1 -1
  15. package/lib/AttributePanel/components/attributes/Direction.d.ts +1 -1
  16. package/lib/AttributePanel/components/attributes/FontFamily.d.ts +1 -1
  17. package/lib/AttributePanel/components/attributes/FontSize.d.ts +1 -1
  18. package/lib/AttributePanel/components/attributes/FontStyle.d.ts +3 -3
  19. package/lib/AttributePanel/components/attributes/FontWeight.d.ts +1 -1
  20. package/lib/AttributePanel/components/attributes/Height.d.ts +3 -3
  21. package/lib/AttributePanel/components/attributes/LetterSpacing.d.ts +1 -1
  22. package/lib/AttributePanel/components/attributes/LineHeight.d.ts +1 -1
  23. package/lib/AttributePanel/components/attributes/Link.d.ts +1 -1
  24. package/lib/AttributePanel/components/attributes/Margin.d.ts +1 -1
  25. package/lib/AttributePanel/components/attributes/MergeTags.d.ts +6 -6
  26. package/lib/AttributePanel/components/attributes/NavbarLinkPadding.d.ts +3 -3
  27. package/lib/AttributePanel/components/attributes/Padding.d.ts +5 -5
  28. package/lib/AttributePanel/components/attributes/TextAlign.d.ts +1 -1
  29. package/lib/AttributePanel/components/attributes/TextDecoration.d.ts +1 -1
  30. package/lib/AttributePanel/components/attributes/TextTransform.d.ts +1 -1
  31. package/lib/AttributePanel/components/attributes/VerticalAlign.d.ts +3 -3
  32. package/lib/AttributePanel/components/attributes/Width.d.ts +3 -3
  33. package/lib/AttributePanel/components/attributes/index.d.ts +29 -29
  34. package/lib/AttributePanel/components/blocks/Accordion/index.d.ts +1 -1
  35. package/lib/AttributePanel/components/blocks/AccordionElement/index.d.ts +1 -1
  36. package/lib/AttributePanel/components/blocks/AccordionText/index.d.ts +1 -1
  37. package/lib/AttributePanel/components/blocks/AccordionTitle/index.d.ts +1 -1
  38. package/lib/AttributePanel/components/blocks/Button/index.d.ts +1 -1
  39. package/lib/AttributePanel/components/blocks/Carousel/index.d.ts +1 -1
  40. package/lib/AttributePanel/components/blocks/Column/index.d.ts +1 -1
  41. package/lib/AttributePanel/components/blocks/Divider/index.d.ts +1 -1
  42. package/lib/AttributePanel/components/blocks/Group/index.d.ts +1 -1
  43. package/lib/AttributePanel/components/blocks/Hero/index.d.ts +1 -1
  44. package/lib/AttributePanel/components/blocks/Image/index.d.ts +1 -1
  45. package/lib/AttributePanel/components/blocks/Navbar/index.d.ts +1 -1
  46. package/lib/AttributePanel/components/blocks/Page/index.d.ts +1 -1
  47. package/lib/AttributePanel/components/blocks/Raw/index.d.ts +1 -1
  48. package/lib/AttributePanel/components/blocks/Section/index.d.ts +1 -1
  49. package/lib/AttributePanel/components/blocks/Social/index.d.ts +1 -1
  50. package/lib/AttributePanel/components/blocks/Spacer/index.d.ts +1 -1
  51. package/lib/AttributePanel/components/blocks/Table/index.d.ts +1 -1
  52. package/lib/AttributePanel/components/blocks/Text/index.d.ts +1 -1
  53. package/lib/AttributePanel/components/blocks/Wrapper/index.d.ts +1 -1
  54. package/lib/AttributePanel/components/blocks/index.d.ts +42 -42
  55. package/lib/AttributePanel/components/provider/PresetColorsProvider/index.d.ts +6 -6
  56. package/lib/AttributePanel/components/provider/SelectionRangeProvider/index.d.ts +6 -6
  57. package/lib/AttributePanel/hooks/useSelectionRange.d.ts +6 -6
  58. package/lib/AttributePanel/index.d.ts +3 -3
  59. package/lib/AttributePanel/utils/BlockAttributeConfigurationManager.d.ts +10 -10
  60. package/lib/AttributePanel/utils/InputNumberAdapter.d.ts +2 -2
  61. package/lib/AttributePanel/utils/PromiseEach.d.ts +1 -1
  62. package/lib/AttributePanel/utils/Uploader.d.ts +35 -35
  63. package/lib/AttributePanel/utils/awaitForElement.d.ts +4 -4
  64. package/lib/AttributePanel/utils/classnames.d.ts +1 -1
  65. package/lib/AttributePanel/utils/getImg.d.ts +8 -8
  66. package/lib/AttributePanel/utils/onDrag.d.ts +10 -10
  67. package/lib/AttributePanel/utils/previewLoadImage.d.ts +1 -1
  68. package/lib/BlockLayer/components/BlockTree/components/BlockTreeItem/index.d.ts +23 -23
  69. package/lib/BlockLayer/components/BlockTree/components/TreeCollapse.d.ts +6 -6
  70. package/lib/BlockLayer/components/BlockTree/index.d.ts +29 -29
  71. package/lib/BlockLayer/components/ContextMenu/index.d.ts +14 -14
  72. package/lib/BlockLayer/components/EyeIcon/index.d.ts +7 -7
  73. package/lib/BlockLayer/index.d.ts +7 -7
  74. package/lib/InteractivePrompt/components/FocusTooltip.d.ts +1 -1
  75. package/lib/InteractivePrompt/components/HoverTooltip.d.ts +1 -1
  76. package/lib/InteractivePrompt/components/Toolbar.d.ts +5 -5
  77. package/lib/InteractivePrompt/index.d.ts +1 -1
  78. package/lib/InteractivePrompt/utils/awaitForElement.d.ts +4 -4
  79. package/lib/ShortcutToolbar/ShortcutToolbar.d.ts +1 -1
  80. package/lib/ShortcutToolbar/components/BlockMaskWrapper/index.d.ts +6 -6
  81. package/lib/ShortcutToolbar/components/BlocksPanel/index.d.ts +2 -2
  82. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/AccordionBlockItem/index.d.ts +1 -1
  83. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/ButtonBlockItem/index.d.ts +1 -1
  84. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/CarouselBlockItem/index.d.ts +1 -1
  85. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/ColumnBlockItem/index.d.ts +1 -1
  86. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/DividerBlockItem/index.d.ts +1 -1
  87. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/GroupBlockItem/index.d.ts +1 -1
  88. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/HeroBlockItem/index.d.ts +1 -1
  89. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/ImageBlockItem/index.d.ts +1 -1
  90. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/NavbarBlockItem/index.d.ts +1 -1
  91. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/RawBlockItem/index.d.ts +1 -1
  92. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/SectionBlockItem/index.d.ts +1 -1
  93. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/SocialBlockItem/index.d.ts +1 -1
  94. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/SpacerBlockItem/index.d.ts +1 -1
  95. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/TextBlockItem/index.d.ts +1 -1
  96. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/WrapperBlockItem/index.d.ts +1 -1
  97. package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/index.d.ts +18 -18
  98. package/lib/ShortcutToolbar/components/Picture/index.d.ts +7 -7
  99. package/lib/ShortcutToolbar/index.d.ts +4 -4
  100. package/lib/ShortcutToolbar/utils/BlockMarketManager.d.ts +32 -32
  101. package/lib/ShortcutToolbar/utils/getImg.d.ts +68 -68
  102. package/lib/SimpleLayout/SimpleLayout.d.ts +2 -2
  103. package/lib/SimpleLayout/index.d.ts +1 -1
  104. package/lib/SourceCodePanel/index.d.ts +1 -1
  105. package/lib/components/AddToCollection/index.d.ts +5 -5
  106. package/lib/components/Form/AddFont.d.ts +1 -1
  107. package/lib/components/Form/AutoComplete.d.ts +11 -11
  108. package/lib/components/Form/CheckBoxGroup.d.ts +14 -14
  109. package/lib/components/Form/CodemirrorEditor/index.d.ts +8 -8
  110. package/lib/components/Form/ColorPicker.d.ts +10 -10
  111. package/lib/components/Form/EditTab.d.ts +10 -10
  112. package/lib/components/Form/ImageUploader/index.d.ts +8 -8
  113. package/lib/components/Form/InlineTextField/index.d.ts +7 -7
  114. package/lib/components/Form/Input.d.ts +7 -7
  115. package/lib/components/Form/RadioGroup.d.ts +13 -13
  116. package/lib/components/Form/RichTextField/index.d.ts +3 -3
  117. package/lib/components/Form/RichTextToolBar/RichTextToolBar.d.ts +1 -0
  118. package/lib/components/Form/{RichTextField → RichTextToolBar}/components/FontFamily/index.d.ts +3 -3
  119. package/lib/components/Form/{RichTextField → RichTextToolBar}/components/FontSizeList/index.d.ts +3 -3
  120. package/lib/components/Form/{RichTextField → RichTextToolBar}/components/Heading/index.d.ts +3 -3
  121. package/lib/components/Form/{RichTextField → RichTextToolBar}/components/Link/index.d.ts +12 -12
  122. package/lib/components/Form/{RichTextField/components/TextToolbar → RichTextToolBar/components/MergeTags}/MergeTags.d.ts +6 -6
  123. package/lib/components/Form/RichTextToolBar/components/MergeTags/index.d.ts +1 -0
  124. package/lib/components/Form/{RichTextField → RichTextToolBar}/components/ToolItem/index.d.ts +7 -7
  125. package/lib/components/Form/RichTextToolBar/components/Tools/Tools.d.ts +5 -0
  126. package/lib/components/Form/RichTextToolBar/components/Tools/index.d.ts +1 -0
  127. package/lib/components/Form/RichTextToolBar/index.d.ts +1 -0
  128. package/lib/components/Form/Select.d.ts +11 -11
  129. package/lib/components/Form/UploadField.d.ts +8 -8
  130. package/lib/components/Form/enhancer.d.ts +20 -20
  131. package/lib/components/Form/index.d.ts +29 -29
  132. package/lib/components/RenderCount/index.d.ts +1 -1
  133. package/lib/components/ShadowDom/index.d.ts +2 -2
  134. package/lib/hooks/useAddToCollection.d.ts +6 -6
  135. package/lib/index.d.ts +8 -8
  136. package/lib/index2.js +202 -187
  137. package/lib/index2.js.map +1 -1
  138. package/lib/index3.js.map +1 -1
  139. package/lib/utils/awaitForElement.d.ts +4 -4
  140. package/lib/utils/classnames.d.ts +1 -1
  141. package/package.json +13 -3
  142. package/readme.md +138 -138
  143. package/lib/components/Form/RichTextField/components/TextToolbar/index.d.ts +0 -5
package/lib/index2.js CHANGED
@@ -55,7 +55,7 @@ var __async = (__this, __arguments, generator) => {
55
55
  };
56
56
  import * as React from "react";
57
57
  import React__default, { useCallback, useState, useRef, useEffect, useMemo, Children, isValidElement, cloneElement, createContext, useContext, Component, memo, forwardRef, useLayoutEffect, createRef, useImperativeHandle, PureComponent, useReducer, createElement, Suspense } from "react";
58
- import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getShadowRoot, FIXED_CONTAINER_ID, getEditContent, getEditorRoot, useEditorProps, useFocusIdx, useActiveTab, scrollBlockEleIntoView, useEditorContext, useHoverIdx, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, ActiveTabKeys } from "easy-email-editor";
58
+ import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getShadowRoot, FIXED_CONTAINER_ID, getEditContent, getEditorRoot, useEditorProps, useEditorContext, useFocusIdx, scrollBlockEleIntoView, useHoverIdx, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, useActiveTab, ActiveTabKeys } from "easy-email-editor";
59
59
  import { BasicType, ImageManager, getIndexByIdx, getSiblingIdx, BlockManager, getPageIdx, getChildIdx, createBlockDataByType, getParentByIdx, getValueByIdx, MjmlToJson, JsonToMjml, getParentIdx, getNodeTypeFromClassName } from "easy-email-core";
60
60
  import { ReactSortable } from "react-sortablejs";
61
61
  import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
@@ -38754,56 +38754,37 @@ function AutoComplete(props) {
38754
38754
  data: options2
38755
38755
  }));
38756
38756
  }
38757
- const isMouseEvent = (event2) => !!(event2.type.indexOf("mouse") !== -1);
38758
- const onDrag = ({
38759
- event: event2,
38760
- onMove,
38761
- onEnd
38762
- }) => {
38763
- event2.preventDefault();
38764
- event2.stopPropagation();
38765
- let initX = 0;
38766
- let initY = 0;
38767
- if (isMouseEvent(event2)) {
38768
- initX = event2.clientX;
38769
- initY = event2.clientY;
38770
- } else {
38771
- initX = event2.touches[0].clientX;
38772
- initY = event2.touches[0].clientY;
38773
- }
38774
- const onDragMove = lodash.exports.debounce((mEvt) => {
38775
- let movX = 0;
38776
- let movY = 0;
38777
- if (isMouseEvent(mEvt)) {
38778
- movX = mEvt.clientX;
38779
- movY = mEvt.clientY;
38780
- } else {
38781
- movX = mEvt.touches[0].clientX;
38782
- movY = mEvt.touches[0].clientY;
38757
+ function awaitForElement(idx) {
38758
+ let promiseObj = {
38759
+ cancel: () => {
38760
+ },
38761
+ promise: Promise.resolve()
38762
+ };
38763
+ promiseObj.promise = new Promise((resolve) => {
38764
+ const ele = getBlockNodeByIdx(idx);
38765
+ if (ele) {
38766
+ resolve(ele);
38767
+ return;
38783
38768
  }
38784
- const diffX = movX - initX;
38785
- const diffY = movY - initY;
38786
- onMove(diffX, diffY);
38769
+ const timer = setInterval(() => {
38770
+ const ele2 = getBlockNodeByIdx(idx);
38771
+ if (ele2) {
38772
+ resolve(ele2);
38773
+ clearInterval(timer);
38774
+ }
38775
+ }, 50);
38776
+ promiseObj.cancel = () => {
38777
+ clearInterval(timer);
38778
+ };
38787
38779
  });
38788
- const onDragEnd = () => {
38789
- onEnd && onEnd();
38790
- document.removeEventListener("touchmove", onDragMove);
38791
- document.removeEventListener("touchend", onDragEnd);
38792
- document.removeEventListener("mousemove", onDragMove);
38793
- document.removeEventListener("mousemove", onDragEnd);
38794
- };
38795
- document.addEventListener("touchmove", onDragMove);
38796
- document.addEventListener("touchend", onDragEnd);
38797
- document.addEventListener("mousemove", onDragMove);
38798
- document.addEventListener("mouseup", onDragEnd);
38799
- };
38780
+ return promiseObj;
38781
+ }
38800
38782
  const ToolItem$1 = (props) => {
38801
- return /* @__PURE__ */ React__default.createElement(Button$4, {
38783
+ return /* @__PURE__ */ React__default.createElement("button", {
38784
+ className: "easy-email-extensions-emailToolItem",
38802
38785
  title: props.title,
38803
- size: "mini",
38804
- icon: props.icon,
38805
38786
  onClick: props.onClick
38806
- });
38787
+ }, props.icon);
38807
38788
  };
38808
38789
  function getAnchorElement(node, matchLength) {
38809
38790
  var _a, _b;
@@ -38836,7 +38817,7 @@ function Link$1(props) {
38836
38817
  const initialValues = useMemo(() => {
38837
38818
  let link = "";
38838
38819
  let blank = true;
38839
- let underline = false;
38820
+ let underline = true;
38840
38821
  let linkNode = getLinkNode(props.currentRange);
38841
38822
  if (linkNode) {
38842
38823
  link = linkNode.href;
@@ -38888,9 +38869,8 @@ function Link$1(props) {
38888
38869
  uncheckedText: "on",
38889
38870
  inline: true
38890
38871
  }))))
38891
- }), /* @__PURE__ */ React__default.createElement(Button$4, {
38872
+ }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
38892
38873
  title: "Link",
38893
- size: "mini",
38894
38874
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
38895
38875
  iconName: "icon-link"
38896
38876
  })
@@ -38928,7 +38908,14 @@ function FontSizeList(props) {
38928
38908
  label: "48px"
38929
38909
  }
38930
38910
  ];
38931
- return /* @__PURE__ */ React__default.createElement(Menu$1, {
38911
+ return /* @__PURE__ */ React__default.createElement("div", {
38912
+ style: {
38913
+ maxWidth: 150,
38914
+ maxHeight: 350,
38915
+ overflowY: "auto",
38916
+ overflowX: "hidden"
38917
+ }
38918
+ }, /* @__PURE__ */ React__default.createElement(Menu$1, {
38932
38919
  onClickMenuItem: (item2) => {
38933
38920
  props.onChange(item2);
38934
38921
  },
@@ -38937,13 +38924,13 @@ function FontSizeList(props) {
38937
38924
  }, list2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
38938
38925
  style: { lineHeight: "30px", height: 30 },
38939
38926
  key: item2.value
38940
- }, item2.label)));
38927
+ }, item2.label))));
38941
38928
  }
38942
38929
  function FontFamily$1(props) {
38943
38930
  const { fontList: fontList2 = [] } = useEditorProps();
38944
38931
  return /* @__PURE__ */ React__default.createElement("div", {
38945
38932
  style: {
38946
- width: 100,
38933
+ maxWidth: 150,
38947
38934
  maxHeight: 350,
38948
38935
  overflowY: "auto",
38949
38936
  overflowX: "hidden"
@@ -38953,7 +38940,7 @@ function FontFamily$1(props) {
38953
38940
  props.onChange(item2);
38954
38941
  },
38955
38942
  selectedKeys: [],
38956
- style: { border: "none" }
38943
+ style: { border: "none", padding: 0 }
38957
38944
  }, fontList2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
38958
38945
  style: { lineHeight: "30px", height: 30 },
38959
38946
  key: item2.value
@@ -38999,7 +38986,8 @@ const MergeTags$1 = React__default.memo((props) => {
38999
38986
  onSelect: (vals) => onSelect(vals[0])
39000
38987
  }));
39001
38988
  });
39002
- function TextToolbar(props) {
38989
+ var styleText$1 = ".easy-email-extensions-Tools-Popover .arco-popover-content{padding:0}.easy-email-extensions-Tools-Popover .arco-popover-content-inner *::-webkit-scrollbar{-webkit-appearance:none;width:5px}.easy-email-extensions-Tools-Popover .arco-popover-content-inner *::-webkit-scrollbar-thumb{border-radius:5px;background-color:#00000080;box-shadow:0 0 1px #ffffff80;-webkit-box-shadow:0 0 1px rgba(255,255,255,.5)}\n";
38990
+ function Tools(props) {
39003
38991
  const { container: container2 } = props;
39004
38992
  const { mergeTags } = useEditorProps();
39005
38993
  const [selectionRange, setSelectionRange] = useState(null);
@@ -39065,47 +39053,60 @@ function TextToolbar(props) {
39065
39053
  };
39066
39054
  const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
39067
39055
  return /* @__PURE__ */ React__default.createElement("div", {
39068
- id: "TextToolbar",
39056
+ id: "Tools",
39069
39057
  style: { display: "flex", flexWrap: "nowrap" }
39070
- }, /* @__PURE__ */ React__default.createElement(Stack$6, {
39071
- vertical: true,
39072
- spacing: "extraTight"
39073
- }, /* @__PURE__ */ React__default.createElement(Stack$6, {
39074
- spacing: "extraTight"
39075
- }, /* @__PURE__ */ React__default.createElement(Tooltip$1, {
39076
- color: "#fff",
39077
- content: /* @__PURE__ */ React__default.createElement(FontFamily$1, {
39058
+ }, /* @__PURE__ */ React__default.createElement("div", {
39059
+ style: {
39060
+ display: "flex",
39061
+ alignItems: "center"
39062
+ }
39063
+ }, /* @__PURE__ */ React__default.createElement("div", {
39064
+ className: "easy-email-extensions-divider"
39065
+ }), /* @__PURE__ */ React__default.createElement(Popover$1, {
39066
+ className: "easy-email-extensions-Tools-Popover",
39067
+ trigger: "click",
39068
+ content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontFamily$1, {
39078
39069
  onChange: (val) => execCommand("fontName", val)
39079
- }),
39070
+ })),
39080
39071
  getPopupContainer: getPopoverMountNode
39081
- }, /* @__PURE__ */ React__default.createElement(Button$4, {
39082
- size: "mini",
39072
+ }, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39073
+ title: "font family",
39083
39074
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39084
39075
  iconName: "icon-font-family"
39085
39076
  })
39086
- })), /* @__PURE__ */ React__default.createElement(Tooltip$1, {
39077
+ })), /* @__PURE__ */ React__default.createElement("div", {
39078
+ className: "easy-email-extensions-divider"
39079
+ }), /* @__PURE__ */ React__default.createElement(Popover$1, {
39080
+ className: "easy-email-extensions-Tools-Popover",
39087
39081
  color: "#fff",
39088
- content: /* @__PURE__ */ React__default.createElement(FontSizeList, {
39082
+ trigger: "click",
39083
+ content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontSizeList, {
39089
39084
  onChange: (val) => execCommand("fontSize", val)
39090
- }),
39085
+ })),
39091
39086
  getPopupContainer: getPopoverMountNode
39092
- }, /* @__PURE__ */ React__default.createElement(Button$4, {
39093
- size: "mini",
39087
+ }, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39088
+ title: "line-height",
39094
39089
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39095
39090
  iconName: "icon-line-height"
39096
39091
  })
39097
- })), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39092
+ })), /* @__PURE__ */ React__default.createElement("div", {
39093
+ className: "easy-email-extensions-divider"
39094
+ }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39098
39095
  onClick: () => execCommand("bold"),
39099
39096
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39100
39097
  iconName: "icon-bold"
39101
39098
  }),
39102
39099
  title: "Bold"
39100
+ }), /* @__PURE__ */ React__default.createElement("div", {
39101
+ className: "easy-email-extensions-divider"
39103
39102
  }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39104
39103
  onClick: () => execCommand("italic"),
39105
39104
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39106
39105
  iconName: "icon-italic"
39107
39106
  }),
39108
39107
  title: "Italic"
39108
+ }), /* @__PURE__ */ React__default.createElement("div", {
39109
+ className: "easy-email-extensions-divider"
39109
39110
  }), /* @__PURE__ */ React__default.createElement(ColorPicker, {
39110
39111
  label: "",
39111
39112
  position: "tl",
@@ -39117,7 +39118,9 @@ function TextToolbar(props) {
39117
39118
  iconName: "icon-font-color"
39118
39119
  }),
39119
39120
  title: "Text color"
39120
- })), /* @__PURE__ */ React__default.createElement(ColorPicker, {
39121
+ })), /* @__PURE__ */ React__default.createElement("div", {
39122
+ className: "easy-email-extensions-divider"
39123
+ }), /* @__PURE__ */ React__default.createElement(ColorPicker, {
39121
39124
  label: "",
39122
39125
  showInput: false,
39123
39126
  position: "tl",
@@ -39128,10 +39131,14 @@ function TextToolbar(props) {
39128
39131
  iconName: "icon-bg-colors"
39129
39132
  }),
39130
39133
  title: "Background color"
39131
- })), /* @__PURE__ */ React__default.createElement(Link$1, {
39134
+ })), /* @__PURE__ */ React__default.createElement("div", {
39135
+ className: "easy-email-extensions-divider"
39136
+ }), /* @__PURE__ */ React__default.createElement(Link$1, {
39132
39137
  currentRange: selectionRange,
39133
39138
  onChange: (values2) => execCommand("createLink", values2),
39134
39139
  getPopupContainer: getPopoverMountNode
39140
+ }), /* @__PURE__ */ React__default.createElement("div", {
39141
+ className: "easy-email-extensions-divider"
39135
39142
  }), mergeTags && /* @__PURE__ */ React__default.createElement(Tooltip$1, {
39136
39143
  color: "#fff",
39137
39144
  position: "bottom",
@@ -39140,21 +39147,14 @@ function TextToolbar(props) {
39140
39147
  onChange: (val) => execCommand("insertHTML", val)
39141
39148
  }),
39142
39149
  getPopupContainer: getPopoverMountNode
39143
- }, /* @__PURE__ */ React__default.createElement(Button$4, {
39144
- size: "mini",
39150
+ }, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39145
39151
  title: "Merge tag",
39146
39152
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39147
39153
  iconName: "icon-merge-tags"
39148
39154
  })
39149
- })), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39150
- onClick: () => execCommand("removeFormat"),
39151
- icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39152
- iconName: "icon-close"
39153
- }),
39154
- title: "Remove format"
39155
- })), /* @__PURE__ */ React__default.createElement(Stack$6, {
39156
- spacing: "extraTight"
39157
- }, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39155
+ })), /* @__PURE__ */ React__default.createElement("div", {
39156
+ className: "easy-email-extensions-divider"
39157
+ }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39158
39158
  onClick: () => execCommand("justifyLeft"),
39159
39159
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39160
39160
  iconName: "icon-align-left"
@@ -39172,6 +39172,8 @@ function TextToolbar(props) {
39172
39172
  iconName: "icon-align-right"
39173
39173
  }),
39174
39174
  title: "Align right"
39175
+ }), /* @__PURE__ */ React__default.createElement("div", {
39176
+ className: "easy-email-extensions-divider"
39175
39177
  }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39176
39178
  onClick: () => execCommand("insertOrderedList"),
39177
39179
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
@@ -39184,6 +39186,8 @@ function TextToolbar(props) {
39184
39186
  iconName: "icon-list-ul"
39185
39187
  }),
39186
39188
  title: "Unorderlist"
39189
+ }), /* @__PURE__ */ React__default.createElement("div", {
39190
+ className: "easy-email-extensions-divider"
39187
39191
  }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39188
39192
  onClick: () => execCommand("strikeThrough"),
39189
39193
  icon: /* @__PURE__ */ React__default.createElement(IconFont, {
@@ -39202,77 +39206,109 @@ function TextToolbar(props) {
39202
39206
  iconName: "icon-line"
39203
39207
  }),
39204
39208
  title: "Line"
39205
- }))));
39209
+ }), /* @__PURE__ */ React__default.createElement("div", {
39210
+ className: "easy-email-extensions-divider"
39211
+ }), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
39212
+ onClick: () => execCommand("removeFormat"),
39213
+ icon: /* @__PURE__ */ React__default.createElement(IconFont, {
39214
+ iconName: "icon-close"
39215
+ }),
39216
+ title: "Remove format"
39217
+ }), /* @__PURE__ */ React__default.createElement("div", {
39218
+ className: "easy-email-extensions-divider"
39219
+ })));
39206
39220
  }
39207
- const TEXT_BAR_LOCATION_KEY = "TEXT_BAR_LOCATION_KEY";
39208
- const RichTextFieldItem = (props) => {
39209
- const { activeTab } = useActiveTab();
39210
- const isActive = activeTab === "EDIT";
39211
- const [position, setPosition] = useState({ top: 0, left: 0 });
39212
- const [locationState, setLocationState] = useLocalStorage$1(TEXT_BAR_LOCATION_KEY, { left: 0, top: 0 });
39213
- const { idx } = props;
39214
- const container2 = getBlockNodeByIdx(idx);
39221
+ var styleText = ".easy-email-extensions-emailToolItem{display:inline-flex;position:relative;outline:none;font-weight:400;appearance:none;cursor:pointer!important;white-space:nowrap;transition:all .1s linear;box-sizing:border-box;line-height:1.5715;border:none;background-color:transparent;color:#fff}.easy-email-extensions-divider{position:relative;display:inline-flex;width:1px;height:16px;background-color:#808080e6}\n";
39222
+ function RichTextToolBar() {
39223
+ const [direction, setDirection] = useState("top");
39224
+ const [blockNode, setBlockNode] = useState(null);
39225
+ const [offsetX, setOffsetX] = useState(0);
39226
+ const { focusBlock: focusBlock2 } = useBlock();
39227
+ const { pageData: pageData2 } = useEditorContext();
39228
+ const { focusIdx: focusIdx2 } = useFocusIdx();
39229
+ const pageWidth = +(pageData2.attributes.width || "600").replace("px", "");
39215
39230
  useEffect(() => {
39216
- const fixContainer = getEditorRoot();
39217
- if (fixContainer && idx) {
39218
- const { left, top } = fixContainer.getBoundingClientRect();
39219
- setPosition({
39220
- left: (locationState == null ? void 0 : locationState.left) || left,
39221
- top: (locationState == null ? void 0 : locationState.top) || top - 46
39222
- });
39223
- }
39224
- }, [idx, locationState == null ? void 0 : locationState.left, locationState == null ? void 0 : locationState.top]);
39225
- const onChange = useCallback(() => {
39226
- }, []);
39227
- const editorContainer = container2 && getEditNode(container2);
39228
- const textToolbar = useMemo(() => {
39229
- const onMoveTextToolbar = (event2) => {
39230
- onDrag({
39231
- event: event2,
39232
- onMove(x, y) {
39233
- setPosition({
39234
- left: position.left + x,
39235
- top: position.top + y
39236
- });
39237
- setLocationState({
39238
- left: position.left + x,
39239
- top: position.top + y
39240
- });
39241
- },
39242
- onEnd() {
39243
- }
39244
- });
39231
+ const promiseObj = awaitForElement(focusIdx2);
39232
+ promiseObj.promise.then((blockNode2) => {
39233
+ setBlockNode(blockNode2);
39234
+ });
39235
+ return () => {
39236
+ promiseObj.cancel();
39245
39237
  };
39246
- return createPortal(/* @__PURE__ */ React__default.createElement("div", {
39247
- key: idx,
39248
- style: __spreadProps(__spreadValues({
39249
- position: "fixed"
39250
- }, position), {
39251
- transform: "translate(0,-100%)",
39252
- padding: 16,
39253
- boxSizing: "border-box",
39254
- zIndex: 100,
39255
- display: Boolean(isActive) ? void 0 : "none"
39256
- })
39257
- }, /* @__PURE__ */ React__default.createElement("div", {
39258
- style: {
39259
- position: "absolute",
39260
- backgroundColor: "#41444d",
39261
- height: "100%",
39262
- width: "100%",
39263
- left: 0,
39264
- top: 0,
39265
- cursor: "move"
39266
- },
39267
- onMouseDown: onMoveTextToolbar
39268
- }), /* @__PURE__ */ React__default.createElement("div", {
39269
- style: { position: "relative", zIndex: 1 }
39270
- }, /* @__PURE__ */ React__default.createElement(TextToolbar, {
39271
- container: editorContainer,
39272
- onChange
39273
- }))), document.getElementById(FIXED_CONTAINER_ID));
39274
- }, [idx, position, isActive, editorContainer, onChange, setLocationState]);
39275
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(InlineTextField, __spreadValues({}, props)), editorContainer && textToolbar);
39238
+ }, [focusIdx2, focusBlock2]);
39239
+ useEffect(() => {
39240
+ if (blockNode) {
39241
+ const options2 = {
39242
+ rootMargin: "-84px 0px 0px 0px",
39243
+ root: getShadowRoot().firstChild,
39244
+ threshold: [0, 1e-3, 0.1, 0.999, 0.8, 0.9, 1]
39245
+ };
39246
+ const checkDirection = (ev) => {
39247
+ const [current] = ev;
39248
+ const { top } = current.intersectionRect;
39249
+ const boundingClientRect = current.boundingClientRect;
39250
+ const rootBounds = current.rootBounds;
39251
+ const intersectionRatio = current.intersectionRatio;
39252
+ if (!rootBounds)
39253
+ return;
39254
+ const paddingLeft = (rootBounds.width - pageWidth) / 2;
39255
+ const offsetLeft = boundingClientRect.left - rootBounds.left;
39256
+ setOffsetX(paddingLeft - offsetLeft);
39257
+ if (intersectionRatio === 1) {
39258
+ setDirection("top");
39259
+ } else {
39260
+ if (top) {
39261
+ if (top > rootBounds.top) {
39262
+ setDirection("top");
39263
+ } else {
39264
+ setDirection("bottom");
39265
+ }
39266
+ }
39267
+ }
39268
+ };
39269
+ const observer = new IntersectionObserver(checkDirection, options2);
39270
+ observer.observe(blockNode);
39271
+ return () => {
39272
+ observer.unobserve(blockNode);
39273
+ };
39274
+ }
39275
+ }, [blockNode, pageWidth]);
39276
+ if (!blockNode)
39277
+ return null;
39278
+ const editorContainer = blockNode && getEditNode(blockNode);
39279
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
39280
+ dangerouslySetInnerHTML: { __html: styleText }
39281
+ }), /* @__PURE__ */ React__default.createElement("div", {
39282
+ style: {
39283
+ transform: direction === "top" ? "translate(0,-100%)" : void 0,
39284
+ padding: "4px 8px",
39285
+ boxSizing: "border-box",
39286
+ position: "absolute",
39287
+ zIndex: 100,
39288
+ top: direction === "top" ? -40 : "calc(100% + 40px)",
39289
+ left: offsetX,
39290
+ width: pageWidth
39291
+ }
39292
+ }, /* @__PURE__ */ React__default.createElement("div", {
39293
+ style: {
39294
+ position: "absolute",
39295
+ backgroundColor: "#41444d",
39296
+ height: "100%",
39297
+ width: "100%",
39298
+ left: 0,
39299
+ top: 0,
39300
+ cursor: "move"
39301
+ }
39302
+ }), /* @__PURE__ */ React__default.createElement(Tools, {
39303
+ container: editorContainer,
39304
+ onChange: () => {
39305
+ }
39306
+ }))), blockNode));
39307
+ }
39308
+ const TEXT_BAR_LOCATION_KEY = "TEXT_BAR_LOCATION_KEY";
39309
+ const RichTextFieldItem = (props) => {
39310
+ useLocalStorage$1(TEXT_BAR_LOCATION_KEY, { left: 0, top: 0 });
39311
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(InlineTextField, __spreadValues({}, props)));
39276
39312
  };
39277
39313
  const RichTextField = (props) => {
39278
39314
  const { focusBlock: focusBlock2 } = useBlock();
@@ -43999,7 +44035,6 @@ const BlocksPanel = (props) => {
43999
44035
  tabPosition: "left",
44000
44036
  size: "large"
44001
44037
  }, filterCategories.map((category, index2) => /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
44002
- className: "no-scrollbar",
44003
44038
  style: {
44004
44039
  padding: 0,
44005
44040
  overflow: "auto"
@@ -44186,31 +44221,6 @@ function SourceCodePanel() {
44186
44221
  onBlur: onMjmlChange
44187
44222
  })));
44188
44223
  }
44189
- function awaitForElement(idx) {
44190
- let promiseObj = {
44191
- cancel: () => {
44192
- },
44193
- promise: Promise.resolve()
44194
- };
44195
- promiseObj.promise = new Promise((resolve) => {
44196
- const ele = getBlockNodeByIdx(idx);
44197
- if (ele) {
44198
- resolve(ele);
44199
- return;
44200
- }
44201
- const timer = setInterval(() => {
44202
- const ele2 = getBlockNodeByIdx(idx);
44203
- if (ele2) {
44204
- resolve(ele2);
44205
- clearInterval(timer);
44206
- }
44207
- }, 50);
44208
- promiseObj.cancel = () => {
44209
- clearInterval(timer);
44210
- };
44211
- });
44212
- return promiseObj;
44213
- }
44214
44224
  function Toolbar({
44215
44225
  block: block2,
44216
44226
  direction
@@ -44323,22 +44333,27 @@ function FocusTooltip() {
44323
44333
  useEffect(() => {
44324
44334
  if (blockNode) {
44325
44335
  const options2 = {
44326
- rootMargin: "-24px 0px -24px 0px",
44327
- root: getShadowRoot().host,
44328
- threshold: [0, 1e-3, 0.1, 0.999, 0.9, 1]
44336
+ rootMargin: "-24px 0px 0px 0px",
44337
+ root: getShadowRoot().firstChild,
44338
+ threshold: [0, 1e-3, 0.1, 0.5, 0.999, 1]
44329
44339
  };
44330
44340
  const checkDirection = (ev) => {
44331
44341
  const [current] = ev;
44332
- const { top, bottom } = current.intersectionRect;
44342
+ const { top } = current.intersectionRect;
44333
44343
  const rootBounds = current.rootBounds;
44344
+ const intersectionRatio = current.intersectionRatio;
44334
44345
  if (!rootBounds)
44335
44346
  return;
44336
- if (rootBounds.bottom === bottom) {
44347
+ if (intersectionRatio === 1) {
44337
44348
  setDirection("top");
44338
- } else if (rootBounds.top === top) {
44339
- setDirection("bottom");
44340
44349
  } else {
44341
- setDirection("top");
44350
+ if (top) {
44351
+ if (top > rootBounds.top) {
44352
+ setDirection("top");
44353
+ } else {
44354
+ setDirection("bottom");
44355
+ }
44356
+ }
44342
44357
  }
44343
44358
  };
44344
44359
  const observer = new IntersectionObserver(checkDirection, options2);