easy-email-extensions 3.2.1-alpha.0 → 3.2.1-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index2.js +23 -15
- package/lib/index2.js.map +1 -1
- package/package.json +2 -2
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,
|
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 (!
|
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
|
@@ -42798,7 +42797,7 @@ function FontSize(props) {
|
|
42798
42797
|
}));
|
42799
42798
|
}
|
42800
42799
|
function Tools(props) {
|
42801
|
-
const { mergeTags: mergeTags2 } = useEditorProps();
|
42800
|
+
const { mergeTags: mergeTags2, enabledMergeTagsBadge } = useEditorProps();
|
42802
42801
|
const { focusBlockNode } = useFocusBlockLayout();
|
42803
42802
|
const { selectionRange, restoreRange, setRangeByElement } = useSelectionRange();
|
42804
42803
|
const execCommand = (cmd, val) => {
|
@@ -42834,7 +42833,10 @@ function Tools(props) {
|
|
42834
42833
|
link.style.textDecoration = linkData.underline ? "underline" : "none";
|
42835
42834
|
link.setAttribute("href", linkData.link);
|
42836
42835
|
} else if (cmd === "insertHTML") {
|
42837
|
-
|
42836
|
+
let newContent = val;
|
42837
|
+
if (enabledMergeTagsBadge) {
|
42838
|
+
newContent = MergeTagBadge$1.transform(val, uuid2);
|
42839
|
+
}
|
42838
42840
|
document.execCommand(cmd, false, newContent);
|
42839
42841
|
const insertMergeTagEle = getShadowRoot().getElementById(uuid2);
|
42840
42842
|
if (insertMergeTagEle) {
|
@@ -46617,6 +46619,15 @@ function MergeTagBadge() {
|
|
46617
46619
|
window.removeEventListener("click", onBlur3);
|
46618
46620
|
};
|
46619
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]);
|
46620
46631
|
useEffect(() => {
|
46621
46632
|
if (!root2)
|
46622
46633
|
return;
|
@@ -46627,6 +46638,10 @@ function MergeTagBadge() {
|
|
46627
46638
|
if (target22 instanceof HTMLInputElement && target22.classList.contains("easy-email-merge-tag")) {
|
46628
46639
|
target22.classList.add("easy-email-merge-tag-focus");
|
46629
46640
|
const namePath = target22.value;
|
46641
|
+
if (!onChangeMergeTag) {
|
46642
|
+
focusMergeTag(target22);
|
46643
|
+
return;
|
46644
|
+
}
|
46630
46645
|
setText(lodash.exports.get(mergeTags2, namePath, ""));
|
46631
46646
|
setTarget(target22);
|
46632
46647
|
} else {
|
@@ -46639,16 +46654,7 @@ function MergeTagBadge() {
|
|
46639
46654
|
return () => {
|
46640
46655
|
root2.removeEventListener("click", onClick2);
|
46641
46656
|
};
|
46642
|
-
}, [focusMergeTag, mergeTags2, root2]);
|
46643
|
-
const onClose = useCallback(() => {
|
46644
|
-
let ele = targetRef.current;
|
46645
|
-
setTimeout(() => {
|
46646
|
-
if (!ele)
|
46647
|
-
return;
|
46648
|
-
focusMergeTag(ele);
|
46649
|
-
}, 100);
|
46650
|
-
setTarget(null);
|
46651
|
-
}, [focusMergeTag, targetRef]);
|
46657
|
+
}, [focusMergeTag, mergeTags2, onChangeMergeTag, root2]);
|
46652
46658
|
const onChange = useCallback((ev) => {
|
46653
46659
|
setText(ev.target.value);
|
46654
46660
|
}, []);
|
@@ -46774,9 +46780,11 @@ const SimpleLayout = (props) => {
|
|
46774
46780
|
bodyStyle: { padding: 0 },
|
46775
46781
|
className: styles.customScrollBar
|
46776
46782
|
}, /* @__PURE__ */ React__default.createElement(Tabs$1, null, /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
46783
|
+
destroyOnHide: true,
|
46777
46784
|
key: "Configuration",
|
46778
46785
|
title: "Configuration"
|
46779
46786
|
}, /* @__PURE__ */ React__default.createElement(AttributePanel, null)), showSourceCode && /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
46787
|
+
destroyOnHide: true,
|
46780
46788
|
key: "Source code",
|
46781
46789
|
title: "Source code"
|
46782
46790
|
}, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null), /* @__PURE__ */ React__default.createElement(MergeTagBadge, null)));
|