easy-email-extensions 3.2.1-alpha.1 → 3.2.1-alpha.6

Sign up to get free protection for your applications and to get access to all the features.
package/lib/index2.js CHANGED
@@ -56,7 +56,7 @@ var __async = (__this, __arguments, generator) => {
56
56
  import * as React from "react";
57
57
  import React__default, { Children, isValidElement, cloneElement, createContext, useContext, Component, useMemo, memo, forwardRef, useEffect, useRef, useLayoutEffect, useState, createRef, useImperativeHandle, PureComponent, useCallback, useReducer, Fragment, createElement, Suspense } from "react";
58
58
  import { IconFont, useEditorProps, Stack as Stack$6, getShadowRoot, TextStyle, useEditorContext, useBlock, useFocusIdx, useFocusBlockLayout, getEditNode, MergeTagBadge as MergeTagBadge$1, FIXED_CONTAINER_ID, getPluginElement, isTextBlock, scrollBlockEleIntoView, useHoverIdx, useDataTransfer, useRefState, getBlockNodeByChildEle, getDirectionPosition, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getBlockNodeByIdx, useLazyState, getEditorRoot, useActiveTab, ActiveTabKeys } from "easy-email-editor";
59
- import { BasicType, ImageManager, EMAIL_BLOCK_CLASS_NAME, BlockManager, createBlockDataByType, AdvancedType, Operator, OperatorSymbol, isAdvancedBlock, getParentByIdx, getParentIdx, getValueByIdx, getIndexByIdx, getSiblingIdx, getNodeIdxFromClassName, getNodeIdxClassName, getPageIdx, getChildIdx, MjmlToJson, JsonToMjml, getNodeTypeFromClassName } from "easy-email-core";
59
+ import { BasicType, ImageManager, EMAIL_BLOCK_CLASS_NAME, BlockManager, createBlockDataByType, AdvancedType, Operator, OperatorSymbol, isAdvancedBlock, getParentByIdx, getParentIdx, getIndexByIdx, getSiblingIdx, getNodeIdxFromClassName, getNodeIdxClassName, getPageIdx, getChildIdx, MjmlToJson, JsonToMjml, getNodeTypeFromClassName } from "easy-email-core";
60
60
  import ReactDOM, { findDOMNode, createPortal } from "react-dom";
61
61
  import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
62
62
  var index$2 = "";
@@ -42349,10 +42349,9 @@ function AttributePanel() {
42349
42349
  const { values: values2, focusBlock: focusBlock2 } = useBlock();
42350
42350
  const { initialized } = useEditorContext();
42351
42351
  const { focusIdx: focusIdx2 } = useFocusIdx();
42352
- const value = getValueByIdx(values2, focusIdx2);
42353
42352
  const Com = focusBlock2 && BlockAttributeConfigurationManager.get(focusBlock2.type);
42354
42353
  const shadowRoot = getShadowRoot();
42355
- if (!value || !initialized)
42354
+ if (!initialized)
42356
42355
  return null;
42357
42356
  return /* @__PURE__ */ React__default.createElement(SelectionRangeProvider, null, /* @__PURE__ */ React__default.createElement(PresetColorsProvider, null, Com ? /* @__PURE__ */ React__default.createElement(Com, {
42358
42357
  key: focusIdx2
@@ -46620,6 +46619,15 @@ function MergeTagBadge() {
46620
46619
  window.removeEventListener("click", onBlur3);
46621
46620
  };
46622
46621
  }, [targetRef, popoverRef]);
46622
+ const onClose = useCallback(() => {
46623
+ let ele = targetRef.current;
46624
+ setTimeout(() => {
46625
+ if (!ele)
46626
+ return;
46627
+ focusMergeTag(ele);
46628
+ }, 100);
46629
+ setTarget(null);
46630
+ }, [focusMergeTag, targetRef]);
46623
46631
  useEffect(() => {
46624
46632
  if (!root2)
46625
46633
  return;
@@ -46630,6 +46638,10 @@ function MergeTagBadge() {
46630
46638
  if (target22 instanceof HTMLInputElement && target22.classList.contains("easy-email-merge-tag")) {
46631
46639
  target22.classList.add("easy-email-merge-tag-focus");
46632
46640
  const namePath = target22.value;
46641
+ if (!onChangeMergeTag) {
46642
+ focusMergeTag(target22);
46643
+ return;
46644
+ }
46633
46645
  setText(lodash.exports.get(mergeTags2, namePath, ""));
46634
46646
  setTarget(target22);
46635
46647
  } else {
@@ -46642,16 +46654,7 @@ function MergeTagBadge() {
46642
46654
  return () => {
46643
46655
  root2.removeEventListener("click", onClick2);
46644
46656
  };
46645
- }, [focusMergeTag, mergeTags2, root2]);
46646
- const onClose = useCallback(() => {
46647
- let ele = targetRef.current;
46648
- setTimeout(() => {
46649
- if (!ele)
46650
- return;
46651
- focusMergeTag(ele);
46652
- }, 100);
46653
- setTarget(null);
46654
- }, [focusMergeTag, targetRef]);
46657
+ }, [focusMergeTag, mergeTags2, onChangeMergeTag, root2]);
46655
46658
  const onChange = useCallback((ev) => {
46656
46659
  setText(ev.target.value);
46657
46660
  }, []);
@@ -46777,9 +46780,9 @@ const SimpleLayout = (props) => {
46777
46780
  bodyStyle: { padding: 0 },
46778
46781
  className: styles.customScrollBar
46779
46782
  }, /* @__PURE__ */ React__default.createElement(Tabs$1, null, /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
46780
- key: "Configuration",
46781
46783
  title: "Configuration"
46782
46784
  }, /* @__PURE__ */ React__default.createElement(AttributePanel, null)), showSourceCode && /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
46785
+ destroyOnHide: true,
46783
46786
  key: "Source code",
46784
46787
  title: "Source code"
46785
46788
  }, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null), /* @__PURE__ */ React__default.createElement(MergeTagBadge, null)));