easy-email-extensions 4.14.0 → 4.14.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index2.js +29 -25
- package/lib/index2.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +2 -2
package/lib/index2.js
CHANGED
@@ -30346,9 +30346,9 @@ function CacheTree(props) {
|
|
30346
30346
|
}, [props]);
|
30347
30347
|
return useMemo(() => /* @__PURE__ */ React__default.createElement(Tree$1, __spreadValues({}, cacheProps)), [cacheProps]);
|
30348
30348
|
}
|
30349
|
-
const wrap$1 = "
|
30350
|
-
const listItem = "
|
30351
|
-
const contextmenuMark = "
|
30349
|
+
const wrap$1 = "_wrap_1x927_1";
|
30350
|
+
const listItem = "_listItem_1x927_13";
|
30351
|
+
const contextmenuMark = "_contextmenuMark_1x927_23";
|
30352
30352
|
var styles$a = {
|
30353
30353
|
wrap: wrap$1,
|
30354
30354
|
listItem,
|
@@ -40157,35 +40157,39 @@ function SourceCodePanel({ jsonReadOnly, mjmlReadOnly }) {
|
|
40157
40157
|
return JSON.stringify(focusBlock, null, 2) || "";
|
40158
40158
|
}, [focusBlock]);
|
40159
40159
|
const onChangeCode = useCallback((event) => {
|
40160
|
-
|
40161
|
-
|
40162
|
-
|
40163
|
-
|
40164
|
-
|
40165
|
-
|
40166
|
-
|
40167
|
-
|
40160
|
+
if (!jsonReadOnly) {
|
40161
|
+
try {
|
40162
|
+
const parseValue = JSON.parse(JSON.stringify(eval("(" + event.target.value + ")")));
|
40163
|
+
const block = BlockManager.getBlockByType(parseValue.type);
|
40164
|
+
if (!block) {
|
40165
|
+
throw new Error(t("Invalid content"));
|
40166
|
+
}
|
40167
|
+
if (!parseValue.data || !parseValue.data.value || !parseValue.attributes || !Array.isArray(parseValue.children)) {
|
40168
|
+
throw new Error(t("Invalid content"));
|
40169
|
+
}
|
40170
|
+
setValueByIdx(focusIdx, parseValue);
|
40171
|
+
} catch (error2) {
|
40172
|
+
Message$1.error((error2 == null ? void 0 : error2.message) || error2);
|
40168
40173
|
}
|
40169
|
-
setValueByIdx(focusIdx, parseValue);
|
40170
|
-
} catch (error2) {
|
40171
|
-
Message$1.error((error2 == null ? void 0 : error2.message) || error2);
|
40172
40174
|
}
|
40173
40175
|
}, [focusIdx, setValueByIdx]);
|
40174
40176
|
const onMjmlChange = useCallback((event2) => {
|
40175
|
-
|
40176
|
-
|
40177
|
-
|
40178
|
-
|
40179
|
-
|
40180
|
-
|
40177
|
+
if (!mjmlReadOnly) {
|
40178
|
+
try {
|
40179
|
+
const parseValue2 = MjmlToJson(event2.target.value);
|
40180
|
+
if (parseValue2.type !== BasicType.PAGE) {
|
40181
|
+
const parentBlock = getParentByIdx(values, focusIdx);
|
40182
|
+
const parseBlock = BlockManager.getBlockByType(parseValue2.type);
|
40183
|
+
if (!(parseBlock == null ? void 0 : parseBlock.validParentType.includes(parentBlock == null ? void 0 : parentBlock.type))) {
|
40184
|
+
throw new Error(t("Invalid content"));
|
40185
|
+
}
|
40186
|
+
} else if (focusIdx !== getPageIdx()) {
|
40181
40187
|
throw new Error(t("Invalid content"));
|
40182
40188
|
}
|
40183
|
-
|
40184
|
-
|
40189
|
+
setValueByIdx(focusIdx, parseValue2);
|
40190
|
+
} catch (error2) {
|
40191
|
+
Message$1.error(t("Invalid content"));
|
40185
40192
|
}
|
40186
|
-
setValueByIdx(focusIdx, parseValue2);
|
40187
|
-
} catch (error2) {
|
40188
|
-
Message$1.error(t("Invalid content"));
|
40189
40193
|
}
|
40190
40194
|
}, [focusIdx, setValueByIdx, values]);
|
40191
40195
|
const onChangeMjmlText = useCallback((value) => {
|