easy-email-pro-theme 1.46.0 → 1.47.0
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.
- package/lib/index.js +139 -25
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -58,7 +58,7 @@ import { classnames, useEditorState, useEditorProps, useRefState, isDOMElement,
|
|
|
58
58
|
import { useSlate, ReactEditor, useSlateStatic, useSelected } from "slate-react";
|
|
59
59
|
import * as React$2 from "react";
|
|
60
60
|
import React__default, { useRef, useState, useEffect, useCallback, useMemo, createContext, useContext, useLayoutEffect, memo, useReducer, cloneElement, forwardRef, Suspense, Component, createElement } from "react";
|
|
61
|
-
import { NodeUtils, BlockManager, ElementType, EditorCore, t, ElementCategory, classnames as classnames$1, StandardType, PluginManager, EditorAuth, HtmlNodeAdapter, ConditionOperator, ConditionOperatorSymbol, EmailRenderProvider, components } from "easy-email-pro-core";
|
|
61
|
+
import { NodeUtils, BlockManager, ElementType, EditorCore, t, ElementCategory, classnames as classnames$1, StandardType, PluginManager, EditorAuth, HtmlNodeAdapter, ConditionOperator, ConditionOperatorSymbol, EmailRenderProvider, components, I18nManager } from "easy-email-pro-core";
|
|
62
62
|
import { Editor, Range, Node, Transforms, Path, Text as Text$2, createEditor } from "slate";
|
|
63
63
|
import { createPortal, unstable_batchedUpdates } from "react-dom";
|
|
64
64
|
import { cloneDeep, get, isEqual, set, omit as omit$2, merge as merge$1, debounce as debounce$2, isUndefined as isUndefined$1, uniqueId, isString as isString$1, isFunction as isFunction$4, isNumber as isNumber$1, upperFirst, sum, flatMap } from "lodash";
|
|
@@ -8358,25 +8358,33 @@ const PreviewEmail = ({
|
|
|
8358
8358
|
}) => {
|
|
8359
8359
|
const [html, setHtml] = useState("");
|
|
8360
8360
|
const mjmlString = useMemo(() => {
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8361
|
+
try {
|
|
8362
|
+
let content = values.content;
|
|
8363
|
+
if (widgetMode) {
|
|
8364
|
+
content = __spreadProps(__spreadValues({}, content), {
|
|
8365
|
+
children: [
|
|
8366
|
+
__spreadProps(__spreadValues({}, values.widgetElement), {
|
|
8367
|
+
children: values.content.children
|
|
8368
|
+
})
|
|
8369
|
+
]
|
|
8370
|
+
});
|
|
8371
|
+
}
|
|
8372
|
+
return EditorCore.toMJML({
|
|
8373
|
+
element: content,
|
|
8374
|
+
mode: "production",
|
|
8375
|
+
universalElements: universalElementSetting,
|
|
8376
|
+
mergetagsData: cloneDeep(mergetagsData),
|
|
8377
|
+
attributesVariables: pageDataVariables,
|
|
8378
|
+
headerElement,
|
|
8379
|
+
footerElement
|
|
8369
8380
|
});
|
|
8381
|
+
} catch (error2) {
|
|
8382
|
+
console.error(error2);
|
|
8383
|
+
setHtml(
|
|
8384
|
+
`<div style="color:red;margin:auto;max-width:600px;font-size:24px;">${String(error2)}</div>`
|
|
8385
|
+
);
|
|
8386
|
+
return "";
|
|
8370
8387
|
}
|
|
8371
|
-
return EditorCore.toMJML({
|
|
8372
|
-
element: content,
|
|
8373
|
-
mode: "production",
|
|
8374
|
-
universalElements: universalElementSetting,
|
|
8375
|
-
mergetagsData: cloneDeep(mergetagsData),
|
|
8376
|
-
attributesVariables: pageDataVariables,
|
|
8377
|
-
headerElement,
|
|
8378
|
-
footerElement
|
|
8379
|
-
});
|
|
8380
8388
|
}, [
|
|
8381
8389
|
values.content,
|
|
8382
8390
|
values.widgetElement,
|
|
@@ -8395,6 +8403,8 @@ const PreviewEmail = ({
|
|
|
8395
8403
|
}, [values.content, values.widgetElement, widgetMode]);
|
|
8396
8404
|
useEffect(() => {
|
|
8397
8405
|
try {
|
|
8406
|
+
if (!mjmlString)
|
|
8407
|
+
return;
|
|
8398
8408
|
const skeletonHtml = mjml(mjmlString, {
|
|
8399
8409
|
fonts: {}
|
|
8400
8410
|
}).html;
|
|
@@ -28590,6 +28600,12 @@ const generateLogic = (option) => {
|
|
|
28590
28600
|
if (condition.operator === ConditionOperator.FALSY) {
|
|
28591
28601
|
return condition.left + " == nil" || condition.left + " == false";
|
|
28592
28602
|
}
|
|
28603
|
+
if (condition.operator === ConditionOperator.EMPTY) {
|
|
28604
|
+
return condition.left + " == empty";
|
|
28605
|
+
}
|
|
28606
|
+
if (condition.operator === ConditionOperator.NOT_EMPTY) {
|
|
28607
|
+
return condition.left + " not empty";
|
|
28608
|
+
}
|
|
28593
28609
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: index2 }, index2 !== 0 && /* @__PURE__ */ React__default.createElement("span", null, " ", symbol2.toLocaleUpperCase(), " "), /* @__PURE__ */ React__default.createElement(Tag, { color: "arcoblue" }, condition.left + " " + condition.operator + " " + condition.right));
|
|
28594
28610
|
};
|
|
28595
28611
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, groups.map((item2, index2) => {
|
|
@@ -28871,6 +28887,46 @@ const options$4 = [
|
|
|
28871
28887
|
tootip: "Less than or equal",
|
|
28872
28888
|
label: "<=",
|
|
28873
28889
|
value: ConditionOperator.LESS_OR_EQUAL
|
|
28890
|
+
},
|
|
28891
|
+
{
|
|
28892
|
+
tootip: "Empty",
|
|
28893
|
+
label: "empty",
|
|
28894
|
+
value: ConditionOperator.EMPTY
|
|
28895
|
+
},
|
|
28896
|
+
{
|
|
28897
|
+
tootip: "Not empty",
|
|
28898
|
+
label: "Not empty",
|
|
28899
|
+
value: ConditionOperator.NOT_EMPTY
|
|
28900
|
+
},
|
|
28901
|
+
{
|
|
28902
|
+
tootip: "Contains",
|
|
28903
|
+
label: "Contains",
|
|
28904
|
+
value: ConditionOperator.CONTAINS
|
|
28905
|
+
},
|
|
28906
|
+
{
|
|
28907
|
+
tootip: "Not contains",
|
|
28908
|
+
label: "Not contains",
|
|
28909
|
+
value: ConditionOperator.NOT_CONTAINS
|
|
28910
|
+
},
|
|
28911
|
+
{
|
|
28912
|
+
tootip: "Starts with",
|
|
28913
|
+
label: "Starts with",
|
|
28914
|
+
value: ConditionOperator.STARTS_WITH
|
|
28915
|
+
},
|
|
28916
|
+
{
|
|
28917
|
+
tootip: "Ends with",
|
|
28918
|
+
label: "Ends with",
|
|
28919
|
+
value: ConditionOperator.ENDS_WITH
|
|
28920
|
+
},
|
|
28921
|
+
{
|
|
28922
|
+
tootip: "In",
|
|
28923
|
+
label: "In",
|
|
28924
|
+
value: ConditionOperator.IN
|
|
28925
|
+
},
|
|
28926
|
+
{
|
|
28927
|
+
tootip: "Not in",
|
|
28928
|
+
label: "Not in",
|
|
28929
|
+
value: ConditionOperator.NOT_IN
|
|
28874
28930
|
}
|
|
28875
28931
|
];
|
|
28876
28932
|
Object.values(ConditionOperator).map((item2) => ({
|
|
@@ -28885,7 +28941,7 @@ function ConditionItem({
|
|
|
28885
28941
|
}) {
|
|
28886
28942
|
const name = `${path2}.${gIndex}.groups.${ggIndex}`;
|
|
28887
28943
|
const value = Form.useWatch(name);
|
|
28888
|
-
const hideRight = value.operator === ConditionOperator.TRUTHY || value.operator === ConditionOperator.FALSY;
|
|
28944
|
+
const hideRight = value.operator === ConditionOperator.TRUTHY || value.operator === ConditionOperator.FALSY || value.operator === ConditionOperator.EMPTY || value.operator === ConditionOperator.NOT_EMPTY;
|
|
28889
28945
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Grid.Row, { align: "end" }, /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 9 }, /* @__PURE__ */ React__default.createElement(
|
|
28890
28946
|
AttributeField.MergeTagSelectInputField,
|
|
28891
28947
|
{
|
|
@@ -28914,10 +28970,13 @@ function ConditionItem({
|
|
|
28914
28970
|
{
|
|
28915
28971
|
label: t("Operator"),
|
|
28916
28972
|
field: `${name}.operator`,
|
|
28917
|
-
layout: "vertical"
|
|
28973
|
+
layout: "vertical",
|
|
28974
|
+
style: {
|
|
28975
|
+
minWidth: 150
|
|
28976
|
+
}
|
|
28918
28977
|
},
|
|
28919
28978
|
/* @__PURE__ */ React__default.createElement(Select$1, { options: options$4 }, options$4.map((item2) => {
|
|
28920
|
-
return /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: item2.value, value: item2.value }, /* @__PURE__ */ React__default.createElement(
|
|
28979
|
+
return /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: item2.value, value: item2.value }, /* @__PURE__ */ React__default.createElement("div", null, item2.label));
|
|
28921
28980
|
}))
|
|
28922
28981
|
)), /* @__PURE__ */ React__default.createElement(Grid.Col, { span: 8, style: { paddingLeft: 5 } }, !hideRight && /* @__PURE__ */ React__default.createElement(
|
|
28923
28982
|
Form.Item,
|
|
@@ -32063,7 +32122,7 @@ function FieldConfigItem(props) {
|
|
|
32063
32122
|
function WidgetConfigPanel({
|
|
32064
32123
|
containerHeight
|
|
32065
32124
|
}) {
|
|
32066
|
-
const { values, setFieldValue } = useEditorContext();
|
|
32125
|
+
const { values, setFieldValue, getFieldValue } = useEditorContext();
|
|
32067
32126
|
const widgetElement = values.widgetElement;
|
|
32068
32127
|
if (!widgetElement) {
|
|
32069
32128
|
throw new Error(`Invalid widgetElement`);
|
|
@@ -32097,6 +32156,11 @@ function WidgetConfigPanel({
|
|
|
32097
32156
|
},
|
|
32098
32157
|
[setFieldValue, widgetElement]
|
|
32099
32158
|
);
|
|
32159
|
+
const contentEditable = getFieldValue(
|
|
32160
|
+
null,
|
|
32161
|
+
`widgetElement.data.contentEditable`
|
|
32162
|
+
);
|
|
32163
|
+
console.log("contentEditable", contentEditable);
|
|
32100
32164
|
return /* @__PURE__ */ React__default.createElement(AttributesPanelWrapper, null, /* @__PURE__ */ React__default.createElement(
|
|
32101
32165
|
Tabs,
|
|
32102
32166
|
{
|
|
@@ -32149,11 +32213,19 @@ function WidgetConfigPanel({
|
|
|
32149
32213
|
AttributeField.SwitchField,
|
|
32150
32214
|
{
|
|
32151
32215
|
name: "widgetElement.data.contentEditable",
|
|
32152
|
-
label: "Content editable",
|
|
32216
|
+
label: /* @__PURE__ */ React__default.createElement(Space, null, t("Content editable"), /* @__PURE__ */ React__default.createElement(
|
|
32217
|
+
Tooltip,
|
|
32218
|
+
{
|
|
32219
|
+
content: t(
|
|
32220
|
+
`Once enabled, the widget's text and button blocks will be editable directly in the editor`
|
|
32221
|
+
)
|
|
32222
|
+
},
|
|
32223
|
+
/* @__PURE__ */ React__default.createElement(IconQuestionCircle, { style: { fontSize: 16 } })
|
|
32224
|
+
)),
|
|
32153
32225
|
path: null,
|
|
32154
32226
|
style: { position: "relative", top: 0 },
|
|
32155
32227
|
formItem: {
|
|
32156
|
-
layout: "
|
|
32228
|
+
layout: "inline",
|
|
32157
32229
|
labelCol: {
|
|
32158
32230
|
span: 10,
|
|
32159
32231
|
style: {
|
|
@@ -32168,6 +32240,39 @@ function WidgetConfigPanel({
|
|
|
32168
32240
|
}
|
|
32169
32241
|
}
|
|
32170
32242
|
}
|
|
32243
|
+
), !contentEditable && /* @__PURE__ */ React__default.createElement(
|
|
32244
|
+
AttributeField.SwitchField,
|
|
32245
|
+
{
|
|
32246
|
+
name: "widgetElement.data.staticLogicEnabled",
|
|
32247
|
+
label: /* @__PURE__ */ React__default.createElement(Space, null, t("Static logic enabled"), /* @__PURE__ */ React__default.createElement(
|
|
32248
|
+
Tooltip,
|
|
32249
|
+
{
|
|
32250
|
+
content: t(
|
|
32251
|
+
`If enabled, only the input value will be used as the data for dynamic rendering`
|
|
32252
|
+
)
|
|
32253
|
+
},
|
|
32254
|
+
/* @__PURE__ */ React__default.createElement(IconQuestionCircle, { style: { fontSize: 16 } })
|
|
32255
|
+
)),
|
|
32256
|
+
path: null,
|
|
32257
|
+
style: { position: "relative", top: 0, marginBottom: 0 },
|
|
32258
|
+
formItem: {
|
|
32259
|
+
style: {},
|
|
32260
|
+
layout: "inline",
|
|
32261
|
+
labelCol: {
|
|
32262
|
+
span: 10,
|
|
32263
|
+
style: {
|
|
32264
|
+
textAlign: "left",
|
|
32265
|
+
paddingBottom: 50
|
|
32266
|
+
}
|
|
32267
|
+
},
|
|
32268
|
+
wrapperCol: {
|
|
32269
|
+
span: 12,
|
|
32270
|
+
style: {
|
|
32271
|
+
textAlign: "left"
|
|
32272
|
+
}
|
|
32273
|
+
}
|
|
32274
|
+
}
|
|
32275
|
+
}
|
|
32171
32276
|
)))
|
|
32172
32277
|
),
|
|
32173
32278
|
/* @__PURE__ */ React__default.createElement(
|
|
@@ -36773,7 +36878,13 @@ const useCreateConfig$1 = (_k) => {
|
|
|
36773
36878
|
};
|
|
36774
36879
|
const Layout$1 = ({ children, footer, header }) => {
|
|
36775
36880
|
const { inited, values } = useEditorContext();
|
|
36776
|
-
const {
|
|
36881
|
+
const {
|
|
36882
|
+
showSidebar = true,
|
|
36883
|
+
widgetMode,
|
|
36884
|
+
height,
|
|
36885
|
+
compact,
|
|
36886
|
+
localeData
|
|
36887
|
+
} = useEditorProps();
|
|
36777
36888
|
const { isLayerItemDragging, zoom, setZoom } = useEditorThemeState();
|
|
36778
36889
|
const pageDataWidth = parseInt(values.content.attributes.width || "600") || 600;
|
|
36779
36890
|
const editor = useSlate();
|
|
@@ -36886,6 +36997,9 @@ const Layout$1 = ({ children, footer, header }) => {
|
|
|
36886
36997
|
widgetMode,
|
|
36887
36998
|
zoom
|
|
36888
36999
|
]);
|
|
37000
|
+
if (localeData) {
|
|
37001
|
+
I18nManager.setLocaleData(localeData);
|
|
37002
|
+
}
|
|
36889
37003
|
if (!root2 || !inited)
|
|
36890
37004
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, layoutContent);
|
|
36891
37005
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, layoutContent, /* @__PURE__ */ React__default.createElement(SharedComponents.HoveringToolbar, null), /* @__PURE__ */ React__default.createElement(SharedComponents.Controller, null), /* @__PURE__ */ React__default.createElement(SharedComponents.Hotkeys, null), /* @__PURE__ */ React__default.createElement(AutoDeselectElement$1, null), /* @__PURE__ */ React__default.createElement("style", null, styleText$g));
|