@makeswift/runtime 0.11.8 → 0.11.10
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/dist/Box.cjs.js +1 -1
- package/dist/Box.es.js +1 -1
- package/dist/Button.cjs.js +1 -1
- package/dist/Button.es.js +1 -1
- package/dist/Carousel.cjs.js +1 -1
- package/dist/Carousel.es.js +1 -1
- package/dist/Countdown.cjs.js +1 -1
- package/dist/Countdown.es.js +1 -1
- package/dist/Divider.cjs.js +1 -1
- package/dist/Divider.es.js +1 -1
- package/dist/Embed.cjs.js +1 -1
- package/dist/Embed.es.js +1 -1
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +1 -1
- package/dist/Image.cjs.js +6 -3
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +6 -3
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +1 -1
- package/dist/LiveProvider.es.js +1 -1
- package/dist/Navigation.cjs.js +1 -1
- package/dist/Navigation.es.js +1 -1
- package/dist/PreviewProvider.cjs.js +1 -1
- package/dist/PreviewProvider.es.js +1 -1
- package/dist/ReadOnlyText.cjs.js +1 -1
- package/dist/ReadOnlyText.es.js +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +2 -2
- package/dist/ReadOnlyTextV2.es.js +2 -2
- package/dist/Root.cjs.js +1 -1
- package/dist/Root.es.js +1 -1
- package/dist/SocialLinks.cjs.js +109 -51
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +109 -51
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Video.cjs.js +1 -1
- package/dist/Video.es.js +1 -1
- package/dist/breakpoints.cjs.js +223 -0
- package/dist/breakpoints.cjs.js.map +1 -0
- package/dist/breakpoints.es.js +206 -0
- package/dist/breakpoints.es.js.map +1 -0
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/control-serialization.cjs.js +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +1 -1
- package/dist/controls.es.js +1 -1
- package/dist/index.cjs.js +4 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +7 -4
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs9.js +1 -1
- package/dist/index.es.js +4 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +7 -4
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es8.js +1 -1
- package/dist/index.es9.js +1 -1
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/dist/next.cjs.js +1 -1
- package/dist/next.es.js +1 -1
- package/dist/prop-controllers.cjs.js +1 -1
- package/dist/prop-controllers.es.js +1 -1
- package/dist/react-page.cjs.js +192 -6
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +198 -12
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +1 -1
- package/dist/react.es.js +1 -1
- package/dist/slate.cjs.js +1 -1
- package/dist/slate.es.js +1 -1
- package/dist/state/breakpoints.cjs.js +17 -219
- package/dist/state/breakpoints.cjs.js.map +1 -1
- package/dist/state/breakpoints.es.js +2 -205
- package/dist/state/breakpoints.es.js.map +1 -1
- package/dist/toText.cjs.js +1 -1
- package/dist/toText.es.js +1 -1
- package/dist/types/src/components/builtin/Image/Image.d.ts +1 -0
- package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Image/register.d.ts.map +1 -1
- package/dist/types/src/components/builtin/SocialLinks/options.d.ts +10 -0
- package/dist/types/src/components/builtin/SocialLinks/options.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/__tests__/copy.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/__tests__/dto.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/__tests__/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__tests__/copy.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__tests__/fixtures/rearranged.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__tests__/fixtures/simple.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__tests__/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/__tests__/translation.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +3 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +4 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/normalizeSimilarText.d.ts +10 -0
- package/dist/types/src/slate/TypographyPlugin/normalizeSimilarText.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/normalizeTypographyDown.d.ts +29 -0
- package/dist/types/src/slate/TypographyPlugin/normalizeTypographyDown.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/normalizeTypographyUp.d.ts +4 -0
- package/dist/types/src/slate/TypographyPlugin/normalizeTypographyUp.d.ts.map +1 -0
- package/dist/types/src/slate/types.d.ts +19 -2
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/useMediaQuery.cjs.js +1 -1
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +1 -1
- package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text/__test__/dto.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text/__test__/introspection.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/__test__/fixtures/rearranged.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/__test__/fixtures/simple.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/__test__/introspection.test.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text-v2/__test__/translation.test.d.ts.map +0 -1
- /package/dist/types/src/controls/rich-text/{__test__ → __tests__}/copy.test.d.ts +0 -0
- /package/dist/types/src/controls/rich-text/{__test__ → __tests__}/dto.test.d.ts +0 -0
- /package/dist/types/src/controls/rich-text/{__test__ → __tests__}/introspection.test.d.ts +0 -0
- /package/dist/types/src/controls/rich-text-v2/{__test__ → __tests__}/copy.test.d.ts +0 -0
- /package/dist/types/src/controls/rich-text-v2/{__test__ → __tests__}/fixtures/rearranged.d.ts +0 -0
- /package/dist/types/src/controls/rich-text-v2/{__test__ → __tests__}/fixtures/simple.d.ts +0 -0
- /package/dist/types/src/controls/rich-text-v2/{__test__ → __tests__}/introspection.test.d.ts +0 -0
- /package/dist/types/src/controls/rich-text-v2/{__test__ → __tests__}/translation.test.d.ts +0 -0
package/dist/react-page.cjs.js
CHANGED
|
@@ -38,7 +38,7 @@ var _c;
|
|
|
38
38
|
var redux = require("redux");
|
|
39
39
|
var thunk = require("redux-thunk");
|
|
40
40
|
var actions = require("./actions.cjs.js");
|
|
41
|
-
var state_breakpoints = require("./
|
|
41
|
+
var state_breakpoints = require("./breakpoints.cjs.js");
|
|
42
42
|
var tsPattern = require("ts-pattern");
|
|
43
43
|
var ipsum = require("corporate-ipsum");
|
|
44
44
|
var slate = require("slate");
|
|
@@ -3615,6 +3615,168 @@ function getValue(editor) {
|
|
|
3615
3615
|
})).map(([node]) => node["typography"]);
|
|
3616
3616
|
return matchingValues;
|
|
3617
3617
|
}
|
|
3618
|
+
function shallowMergeTypographies(commonTypography, typography) {
|
|
3619
|
+
var _a, _b;
|
|
3620
|
+
const devices = [
|
|
3621
|
+
...new Set(commonTypography == null ? void 0 : commonTypography.style.map((node) => node.deviceId).concat((_a = typography == null ? void 0 : typography.style.map((node) => node.deviceId)) != null ? _a : []))
|
|
3622
|
+
];
|
|
3623
|
+
return {
|
|
3624
|
+
id: (_b = commonTypography == null ? void 0 : commonTypography.id) != null ? _b : typography == null ? void 0 : typography.id,
|
|
3625
|
+
style: devices.map((deviceId) => {
|
|
3626
|
+
var _a2, _b2;
|
|
3627
|
+
const commonDevice = commonTypography == null ? void 0 : commonTypography.style.find((s) => s.deviceId === deviceId);
|
|
3628
|
+
const existingDeviceStyle = typography == null ? void 0 : typography.style.find((s) => s.deviceId === deviceId);
|
|
3629
|
+
return {
|
|
3630
|
+
deviceId,
|
|
3631
|
+
value: state_breakpoints.shallowMerge((_a2 = existingDeviceStyle == null ? void 0 : existingDeviceStyle.value) != null ? _a2 : {}, (_b2 = commonDevice == null ? void 0 : commonDevice.value) != null ? _b2 : {})
|
|
3632
|
+
};
|
|
3633
|
+
})
|
|
3634
|
+
};
|
|
3635
|
+
}
|
|
3636
|
+
function normalizeTypographyDown(editor, entry) {
|
|
3637
|
+
const [normalizationNode, normalizationPath] = entry;
|
|
3638
|
+
if (slate.Element.isElement(normalizationNode) && normalizationNode.typography != null && normalizationNode.children.length) {
|
|
3639
|
+
slate.Editor.withoutNormalizing(editor, () => {
|
|
3640
|
+
var _a;
|
|
3641
|
+
slate.Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3642
|
+
for (let i = 0; i < normalizationNode.children.length; i++) {
|
|
3643
|
+
const resultingTypography = shallowMergeTypographies(normalizationNode.typography, (_a = normalizationNode.children.at(i)) == null ? void 0 : _a.typography);
|
|
3644
|
+
slate.Transforms.setNodes(editor, { typography: resultingTypography }, { at: [...normalizationPath, i] });
|
|
3645
|
+
}
|
|
3646
|
+
});
|
|
3647
|
+
return true;
|
|
3648
|
+
}
|
|
3649
|
+
return false;
|
|
3650
|
+
}
|
|
3651
|
+
function shallowAnd(a, b) {
|
|
3652
|
+
const bKeys = state_breakpoints.keys(b);
|
|
3653
|
+
const aPrime = __spreadValues({}, a);
|
|
3654
|
+
const and = {};
|
|
3655
|
+
bKeys.forEach((key) => {
|
|
3656
|
+
if (deepEqual(aPrime[key], b[key]))
|
|
3657
|
+
and[key] = aPrime[key];
|
|
3658
|
+
});
|
|
3659
|
+
return and;
|
|
3660
|
+
}
|
|
3661
|
+
function shallowAndTypographies(...typographies) {
|
|
3662
|
+
var _a;
|
|
3663
|
+
return {
|
|
3664
|
+
id: typographies.every((typography) => {
|
|
3665
|
+
var _a2;
|
|
3666
|
+
return (typography == null ? void 0 : typography.id) === ((_a2 = typographies.at(0)) == null ? void 0 : _a2.id);
|
|
3667
|
+
}) ? (_a = typographies.at(0)) == null ? void 0 : _a.id : void 0,
|
|
3668
|
+
style: [
|
|
3669
|
+
...new Set(typographies.flatMap((typography) => {
|
|
3670
|
+
var _a2;
|
|
3671
|
+
return (_a2 = typography == null ? void 0 : typography.style.map((node) => node.deviceId)) != null ? _a2 : [];
|
|
3672
|
+
}))
|
|
3673
|
+
].flatMap((deviceId) => {
|
|
3674
|
+
const stylesForThisDevice = typographies.map((typography) => {
|
|
3675
|
+
var _a2;
|
|
3676
|
+
return (_a2 = typography.style.find((s) => s.deviceId === deviceId)) == null ? void 0 : _a2.value;
|
|
3677
|
+
}).filter((typography) => Boolean(typography));
|
|
3678
|
+
if (typographies.length !== stylesForThisDevice.length)
|
|
3679
|
+
return [];
|
|
3680
|
+
const value = stylesForThisDevice.reduce((acc, curr) => {
|
|
3681
|
+
return shallowAnd(acc, curr);
|
|
3682
|
+
}, stylesForThisDevice.at(0));
|
|
3683
|
+
if (value == null || Object.keys(value).length === 0) {
|
|
3684
|
+
return [];
|
|
3685
|
+
}
|
|
3686
|
+
return [
|
|
3687
|
+
{
|
|
3688
|
+
deviceId,
|
|
3689
|
+
value
|
|
3690
|
+
}
|
|
3691
|
+
];
|
|
3692
|
+
})
|
|
3693
|
+
};
|
|
3694
|
+
}
|
|
3695
|
+
function shallowInverseAnd(a, b) {
|
|
3696
|
+
const bKeys = Array.from(/* @__PURE__ */ new Set([...state_breakpoints.keys(b), ...state_breakpoints.keys(a)]));
|
|
3697
|
+
const aPrime = __spreadValues({}, a);
|
|
3698
|
+
const bPrime = __spreadValues({}, b);
|
|
3699
|
+
const xor = {};
|
|
3700
|
+
bKeys.forEach((key) => {
|
|
3701
|
+
if (aPrime[key] == null && bPrime[key] == null || !deepEqual(aPrime[key], bPrime[key]))
|
|
3702
|
+
xor[key] = aPrime[key];
|
|
3703
|
+
});
|
|
3704
|
+
return xor;
|
|
3705
|
+
}
|
|
3706
|
+
function shallowInverseAndTypographies(a, b) {
|
|
3707
|
+
const typography = { style: [] };
|
|
3708
|
+
if ((a == null ? void 0 : a.id) !== b.id) {
|
|
3709
|
+
typography.id = a == null ? void 0 : a.id;
|
|
3710
|
+
}
|
|
3711
|
+
if (a && a.style.length > 0) {
|
|
3712
|
+
const styles = [];
|
|
3713
|
+
for (const style of a.style) {
|
|
3714
|
+
const bDeviceTypography = b.style.find((s) => s.deviceId === style.deviceId);
|
|
3715
|
+
if (bDeviceTypography == null) {
|
|
3716
|
+
styles.push(style);
|
|
3717
|
+
} else {
|
|
3718
|
+
const uniquePropertiesOfA = shallowInverseAnd(style.value, bDeviceTypography.value);
|
|
3719
|
+
if (Object.keys(uniquePropertiesOfA).length > 0) {
|
|
3720
|
+
styles.push({
|
|
3721
|
+
deviceId: style.deviceId,
|
|
3722
|
+
value: uniquePropertiesOfA
|
|
3723
|
+
});
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
typography.style = styles;
|
|
3728
|
+
}
|
|
3729
|
+
return typography;
|
|
3730
|
+
}
|
|
3731
|
+
function isException(node) {
|
|
3732
|
+
return slate.Text.isText(node) && node.text === "";
|
|
3733
|
+
}
|
|
3734
|
+
function normalizeTypographyUp(editor, entry) {
|
|
3735
|
+
const [node, path] = entry;
|
|
3736
|
+
if (slate.Element.isElement(node) && node.children.length) {
|
|
3737
|
+
const typographiesOfChildren = node.children.filter((child) => !isException(child)).map((child) => child.typography);
|
|
3738
|
+
const definedTypographiesOfChildren = typographiesOfChildren.filter((typography) => Boolean(typography));
|
|
3739
|
+
if (typographiesOfChildren.length === definedTypographiesOfChildren.length) {
|
|
3740
|
+
let sharedTypography = shallowAndTypographies(...definedTypographiesOfChildren);
|
|
3741
|
+
if (sharedTypography.style.length > 0 || sharedTypography.id != null) {
|
|
3742
|
+
const rootTypography = shallowMergeTypographies(sharedTypography, node.typography);
|
|
3743
|
+
slate.Editor.withoutNormalizing(editor, () => {
|
|
3744
|
+
var _a, _b;
|
|
3745
|
+
slate.Transforms.setNodes(editor, { typography: rootTypography }, { at: path });
|
|
3746
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
3747
|
+
const typography = shallowInverseAndTypographies((_b = (_a = node.children.at(i)) == null ? void 0 : _a.typography) != null ? _b : { style: [] }, sharedTypography);
|
|
3748
|
+
slate.Transforms.setNodes(editor, { typography }, { at: [...path, i] });
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
return true;
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
return false;
|
|
3756
|
+
}
|
|
3757
|
+
function isTextEqual(a, b) {
|
|
3758
|
+
const _a = a, { text: aText } = _a, aRest = __objRest(_a, ["text"]);
|
|
3759
|
+
const _b = b, { text: bText } = _b, bRest = __objRest(_b, ["text"]);
|
|
3760
|
+
return deepEqual(aRest, bRest);
|
|
3761
|
+
}
|
|
3762
|
+
function normalizeSimilarText(editor, entry) {
|
|
3763
|
+
const [node, path] = entry;
|
|
3764
|
+
if (slate.Text.isText(node))
|
|
3765
|
+
return false;
|
|
3766
|
+
let hasMergedNodes = false;
|
|
3767
|
+
for (let i = node.children.length; i > 0; i--) {
|
|
3768
|
+
const currentNode = slate.Node.get(editor, path);
|
|
3769
|
+
if (slate.Text.isText(currentNode))
|
|
3770
|
+
continue;
|
|
3771
|
+
const child = currentNode.children[i];
|
|
3772
|
+
const prev = currentNode.children[i - 1];
|
|
3773
|
+
if (slate.Text.isText(child) && prev != null && slate.Text.isText(prev) && isTextEqual(child, prev)) {
|
|
3774
|
+
slate.Transforms.mergeNodes(editor, { at: path.concat(i), voids: true });
|
|
3775
|
+
hasMergedNodes = true;
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
return hasMergedNodes;
|
|
3779
|
+
}
|
|
3618
3780
|
const TypographyActions = {
|
|
3619
3781
|
setActiveTypographyId,
|
|
3620
3782
|
setActiveTypographyStyle,
|
|
@@ -3628,14 +3790,20 @@ function withTypography(editor) {
|
|
|
3628
3790
|
editor.normalizeNode = (entry) => {
|
|
3629
3791
|
var _a, _b;
|
|
3630
3792
|
const [normalizationNode, normalizationPath] = entry;
|
|
3631
|
-
if (
|
|
3793
|
+
if ("typography" in normalizationNode && ((_a = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _a.id) == null && ((_b = normalizationNode == null ? void 0 : normalizationNode.typography) == null ? void 0 : _b.style.length) === 0) {
|
|
3632
3794
|
slate.Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3633
3795
|
return;
|
|
3634
3796
|
}
|
|
3635
|
-
if (
|
|
3797
|
+
if ("slice" in normalizationNode && (normalizationNode == null ? void 0 : normalizationNode.slice) != null) {
|
|
3636
3798
|
slate.Transforms.unsetNodes(editor, "slice", { at: normalizationPath });
|
|
3637
3799
|
return;
|
|
3638
3800
|
}
|
|
3801
|
+
if (normalizeSimilarText(editor, entry))
|
|
3802
|
+
return;
|
|
3803
|
+
if (editor.typographyNormalizationDirection === "up" && normalizeTypographyUp(editor, entry))
|
|
3804
|
+
return;
|
|
3805
|
+
if ((editor.typographyNormalizationDirection === "down" || editor.typographyNormalizationDirection == null) && normalizeTypographyDown(editor, entry))
|
|
3806
|
+
return;
|
|
3639
3807
|
normalizeNode(entry);
|
|
3640
3808
|
};
|
|
3641
3809
|
return editor;
|
|
@@ -4002,6 +4170,8 @@ function getInlineOrTextTranslatableData(descendant, path = []) {
|
|
|
4002
4170
|
let string = escapeHtml__default["default"](descendant.text);
|
|
4003
4171
|
if (string === "")
|
|
4004
4172
|
return null;
|
|
4173
|
+
if (descendant.typography === void 0)
|
|
4174
|
+
return string;
|
|
4005
4175
|
return `<span key="${pathToString(path)}">${string}</span>`;
|
|
4006
4176
|
}
|
|
4007
4177
|
const children = descendant.children.map((child, i) => getInlineOrTextTranslatableData(child, [...path, i])).join("");
|
|
@@ -4020,8 +4190,17 @@ function getInlineOrTextTranslatableData(descendant, path = []) {
|
|
|
4020
4190
|
return children;
|
|
4021
4191
|
}
|
|
4022
4192
|
}
|
|
4023
|
-
function getRichTextV2TranslatableData(data) {
|
|
4024
|
-
|
|
4193
|
+
function getRichTextV2TranslatableData(definition2, data) {
|
|
4194
|
+
var _a;
|
|
4195
|
+
const plugins = ((_a = definition2 == null ? void 0 : definition2.config) == null ? void 0 : _a.mode) === RichTextV2Mode.Inline ? [InlineModePlugin()] : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin()];
|
|
4196
|
+
const editor = plugins.reduceRight((editor2, plugin) => {
|
|
4197
|
+
var _a2, _b;
|
|
4198
|
+
return (_b = (_a2 = plugin == null ? void 0 : plugin.withPlugin) == null ? void 0 : _a2.call(plugin, editor2)) != null ? _b : editor2;
|
|
4199
|
+
}, slate.createEditor());
|
|
4200
|
+
editor.children = data.descendants;
|
|
4201
|
+
editor.typographyNormalizationDirection = "up";
|
|
4202
|
+
slate.Editor.normalize(editor, { force: true });
|
|
4203
|
+
return editor.children.reduce((acc, descendant, i) => __spreadValues(__spreadValues({}, acc), getDescendantTranslatableData(descendant, [i])), {});
|
|
4025
4204
|
}
|
|
4026
4205
|
function deserializeTranslationHtmlString(el, translationKey) {
|
|
4027
4206
|
var _a, _b;
|
|
@@ -4066,6 +4245,8 @@ function mergeRichTextV2TranslatedData(definition2, data, translatedData) {
|
|
|
4066
4245
|
return (_b = (_a2 = plugin == null ? void 0 : plugin.withPlugin) == null ? void 0 : _a2.call(plugin, editor)) != null ? _b : editor;
|
|
4067
4246
|
}, slate.createEditor());
|
|
4068
4247
|
sourceEditor.children = data.descendants;
|
|
4248
|
+
sourceEditor.typographyNormalizationDirection = "up";
|
|
4249
|
+
slate.Editor.normalize(sourceEditor, { force: true });
|
|
4069
4250
|
Object.entries(translatedData).reverse().forEach(([blockStringPath, htmlString]) => {
|
|
4070
4251
|
var _c2;
|
|
4071
4252
|
const blockPath = stringToPath(blockStringPath);
|
|
@@ -4074,6 +4255,7 @@ function mergeRichTextV2TranslatedData(definition2, data, translatedData) {
|
|
|
4074
4255
|
const html = parse5.parseFragment(htmlString);
|
|
4075
4256
|
const inlineDescendants = deserializeTranslationHtmlString(html);
|
|
4076
4257
|
targetEditor.children = [{ type: BlockType.Default, children: inlineDescendants }];
|
|
4258
|
+
targetEditor.typographyNormalizationDirection = "neutral";
|
|
4077
4259
|
slate.Editor.normalize(targetEditor, { force: true });
|
|
4078
4260
|
for (const [descendant, absolutePathToTargetNode] of slate.Node.descendants(targetEditor)) {
|
|
4079
4261
|
if (!slate.Text.isText(descendant) && !ElementUtils.isInline(descendant) || descendant.translationKey == null || descendant.translationKey === "") {
|
|
@@ -4100,6 +4282,8 @@ function mergeRichTextV2TranslatedData(definition2, data, translatedData) {
|
|
|
4100
4282
|
slate.Transforms.insertNodes(sourceEditor, translatedChildren, { at: [...blockPath, 0] });
|
|
4101
4283
|
});
|
|
4102
4284
|
});
|
|
4285
|
+
sourceEditor.typographyNormalizationDirection = "down";
|
|
4286
|
+
slate.Editor.normalize(sourceEditor, { force: true });
|
|
4103
4287
|
return __spreadProps(__spreadValues({}, data), { descendants: sourceEditor.children });
|
|
4104
4288
|
}
|
|
4105
4289
|
function copy(definition2, value, context) {
|
|
@@ -4159,7 +4343,7 @@ function getTranslatableData(definition2, data) {
|
|
|
4159
4343
|
const richTextData = data;
|
|
4160
4344
|
if (isRichTextV1Data(richTextData))
|
|
4161
4345
|
return null;
|
|
4162
|
-
return getRichTextV2TranslatableData(richTextData);
|
|
4346
|
+
return getRichTextV2TranslatableData(definition2, richTextData);
|
|
4163
4347
|
case ListControlType:
|
|
4164
4348
|
if (data == null)
|
|
4165
4349
|
return null;
|
|
@@ -4173,6 +4357,8 @@ function getTranslatableData(definition2, data) {
|
|
|
4173
4357
|
}
|
|
4174
4358
|
}
|
|
4175
4359
|
function mergeTranslatedData(definition2, data, translatedData, context) {
|
|
4360
|
+
if (data == null)
|
|
4361
|
+
return data;
|
|
4176
4362
|
switch (definition2.type) {
|
|
4177
4363
|
case Types.TextInput:
|
|
4178
4364
|
case Types.TextArea:
|