easy-email-extensions 3.0.10 → 3.0.14

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 (142) 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 +2 -3
  117. package/lib/components/Form/RichTextToolBar/RichTextToolBar.d.ts +1 -1
  118. package/lib/components/Form/RichTextToolBar/components/FontFamily/index.d.ts +3 -3
  119. package/lib/components/Form/RichTextToolBar/components/FontSizeList/index.d.ts +3 -3
  120. package/lib/components/Form/RichTextToolBar/components/Heading/index.d.ts +3 -3
  121. package/lib/components/Form/RichTextToolBar/components/Link/index.d.ts +12 -12
  122. package/lib/components/Form/RichTextToolBar/components/MergeTags/MergeTags.d.ts +6 -6
  123. package/lib/components/Form/RichTextToolBar/components/MergeTags/index.d.ts +1 -1
  124. package/lib/components/Form/RichTextToolBar/components/ToolItem/index.d.ts +7 -7
  125. package/lib/components/Form/RichTextToolBar/components/Tools/Tools.d.ts +5 -5
  126. package/lib/components/Form/RichTextToolBar/components/Tools/index.d.ts +1 -1
  127. package/lib/components/Form/RichTextToolBar/index.d.ts +1 -1
  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 +36 -73
  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 +2 -2
  142. package/readme.md +138 -138
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, useEditorContext, useFocusIdx, scrollBlockEleIntoView, useHoverIdx, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, useActiveTab, ActiveTabKeys } from "easy-email-editor";
58
+ import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, useEditorProps, getShadowRoot, FIXED_CONTAINER_ID, useEditorContext, useFocusIdx, scrollBlockEleIntoView, useHoverIdx, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getEditorRoot, 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";
@@ -38655,92 +38655,51 @@ function InlineText({ idx, onChange, children }) {
38655
38655
  const {
38656
38656
  mutators: { setFieldTouched }
38657
38657
  } = useForm$1();
38658
- const [isFocus, setIsFocus] = useState(false);
38659
38658
  const [textContainer, setTextContainer] = useState(null);
38660
38659
  useField(idx);
38661
38660
  const { focusBlock: focusBlock2 } = useBlock();
38662
38661
  useEffect(() => {
38663
- const promiseObj = awaitForElement$1(idx);
38664
- promiseObj.promise.then((blockNode) => {
38665
- setTextContainer(blockNode);
38666
- });
38662
+ let promiseObj;
38663
+ const getTextBlock = () => {
38664
+ promiseObj = awaitForElement$1(idx);
38665
+ promiseObj.promise.then((blockNode) => {
38666
+ if (blockNode.querySelector('[contenteditable="true"]')) {
38667
+ setTextContainer(blockNode);
38668
+ } else {
38669
+ setTimeout(() => {
38670
+ getTextBlock();
38671
+ }, 50);
38672
+ }
38673
+ });
38674
+ };
38675
+ getTextBlock();
38667
38676
  return () => {
38668
38677
  promiseObj.cancel();
38669
38678
  };
38670
38679
  }, [idx, focusBlock2]);
38671
- const onTextChange = useCallback((text) => {
38672
- if ((focusBlock2 == null ? void 0 : focusBlock2.data.value.content) !== text) {
38673
- onChange(text);
38674
- }
38675
- }, [focusBlock2 == null ? void 0 : focusBlock2.data.value.content, onChange]);
38676
38680
  useEffect(() => {
38677
38681
  if (!textContainer)
38678
38682
  return;
38679
38683
  const container2 = getEditNode(textContainer);
38680
38684
  if (container2) {
38681
- container2.focus();
38682
- let focusTarget = null;
38683
- const root2 = getShadowRoot();
38684
- const onClick = (ev) => {
38685
- ev.stopPropagation();
38686
- focusTarget = ev.target;
38687
- const fixedContainer = document.getElementById(FIXED_CONTAINER_ID);
38688
- if (textContainer == null ? void 0 : textContainer.contains(focusTarget))
38689
- return;
38690
- if (fixedContainer && fixedContainer.contains(focusTarget))
38691
- return;
38692
- if (fixedContainer == null ? void 0 : fixedContainer.contains(document.activeElement))
38693
- return;
38694
- onTextChange(getEditContent(textContainer));
38695
- };
38696
38685
  const onPaste = (e) => {
38697
38686
  var _a;
38698
38687
  e.preventDefault();
38699
38688
  const text = ((_a = e.clipboardData) == null ? void 0 : _a.getData("text/plain")) || "";
38700
38689
  document.execCommand("insertHTML", false, text);
38701
- };
38702
- const stopDrag = (e) => {
38703
- e.preventDefault();
38704
- e.stopPropagation();
38690
+ onChange(getEditContent(textContainer));
38705
38691
  };
38706
38692
  const onInput = () => {
38707
- setFieldTouched(idx, true);
38693
+ onChange(getEditContent(textContainer));
38708
38694
  };
38709
38695
  container2.addEventListener("paste", onPaste, true);
38710
- container2.addEventListener("dragstart", stopDrag);
38711
38696
  container2.addEventListener("input", onInput);
38712
- document.addEventListener("mousedown", onClick);
38713
- root2.addEventListener("mousedown", onClick);
38714
38697
  return () => {
38715
38698
  container2.removeEventListener("paste", onPaste, true);
38716
- container2.removeEventListener("dragstart", stopDrag);
38717
38699
  container2.removeEventListener("input", onInput);
38718
- document.removeEventListener("mousedown", onClick);
38719
- root2.removeEventListener("mousedown", onClick);
38720
38700
  };
38721
38701
  }
38722
- }, [idx, onTextChange, setFieldTouched, textContainer]);
38723
- useEffect(() => {
38724
- const onFocus3 = (ev) => {
38725
- ev.stopPropagation();
38726
- if (document.activeElement === getEditorRoot()) {
38727
- setIsFocus(true);
38728
- } else {
38729
- setIsFocus(false);
38730
- }
38731
- };
38732
- const root2 = getShadowRoot();
38733
- root2.addEventListener("click", onFocus3);
38734
- root2.addEventListener("focusin", onFocus3);
38735
- window.addEventListener("focusin", onFocus3);
38736
- return () => {
38737
- root2.addEventListener("click", onFocus3);
38738
- root2.removeEventListener("focusin", onFocus3);
38739
- window.removeEventListener("focusin", onFocus3);
38740
- };
38741
- }, []);
38742
- if (!isFocus)
38743
- return null;
38702
+ }, [onChange, setFieldTouched, textContainer]);
38744
38703
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children);
38745
38704
  }
38746
38705
  function AutoComplete(props) {
@@ -39296,8 +39255,7 @@ function RichTextToolBar() {
39296
39255
  height: "100%",
39297
39256
  width: "100%",
39298
39257
  left: 0,
39299
- top: 0,
39300
- cursor: "move"
39258
+ top: 0
39301
39259
  }
39302
39260
  }), /* @__PURE__ */ React__default.createElement(Tools, {
39303
39261
  container: editorContainer,
@@ -39305,20 +39263,28 @@ function RichTextToolBar() {
39305
39263
  }
39306
39264
  }))), blockNode));
39307
39265
  }
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)));
39312
- };
39313
39266
  const RichTextField = (props) => {
39314
39267
  const { focusBlock: focusBlock2 } = useBlock();
39315
39268
  const { focusIdx: focusIdx2 } = useFocusIdx();
39316
39269
  if ((focusBlock2 == null ? void 0 : focusBlock2.type) !== BasicType.TEXT)
39317
39270
  return null;
39318
- return /* @__PURE__ */ React__default.createElement(RichTextFieldItem, __spreadValues({
39319
- key: focusIdx2
39320
- }, props));
39271
+ const name = `${focusIdx2}.data.value.content`;
39272
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(Field, {
39273
+ name,
39274
+ parse: (v) => v
39275
+ }, ({ input }) => /* @__PURE__ */ React__default.createElement(FieldWrapper, __spreadProps(__spreadValues({}, props), {
39276
+ input
39277
+ }))));
39321
39278
  };
39279
+ function FieldWrapper(props) {
39280
+ const _a = props, { input } = _a, rest = __objRest(_a, ["input"]);
39281
+ const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
39282
+ input.onChange(val);
39283
+ }, 500), [input]);
39284
+ return /* @__PURE__ */ React__default.createElement(InlineText, __spreadProps(__spreadValues({}, rest), {
39285
+ onChange: debounceCallbackChange
39286
+ }));
39287
+ }
39322
39288
  const TextField = enhancer(Input, (value) => value);
39323
39289
  const SearchField = enhancer(Input$5.Search, (val) => val);
39324
39290
  const TextAreaField = enhancer(Input$5.TextArea, (val) => val);
@@ -41749,10 +41715,7 @@ function AttributePanel() {
41749
41715
  }, "No matching components")), /* @__PURE__ */ React__default.createElement("div", {
41750
41716
  style: { position: "absolute" }
41751
41717
  }, /* @__PURE__ */ React__default.createElement(RichTextField, {
41752
- idx: focusIdx2,
41753
- name: `${focusIdx2}.data.value.content`,
41754
- label: "",
41755
- labelHidden: true
41718
+ idx: focusIdx2
41756
41719
  })), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
41757
41720
  .email-block [contentEditable="true"],
41758
41721
  .email-block [contentEditable="true"] * {