@makeswift/runtime 0.11.9 → 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 +1 -1
- package/dist/Image.es.js +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 +2 -2
- package/dist/index.cjs2.js +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs9.js +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es2.js +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/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 +1 -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.es.js
CHANGED
|
@@ -38,7 +38,7 @@ var _c;
|
|
|
38
38
|
import { combineReducers, createStore, applyMiddleware } from "redux";
|
|
39
39
|
import thunk from "redux-thunk";
|
|
40
40
|
import { A as ActionTypes } from "./actions.es.js";
|
|
41
|
-
import { findBreakpointOverride,
|
|
41
|
+
import { f as findBreakpointOverride, s as shallowMerge, k as keys, r as reducer$9, g as getInitialState$8 } from "./breakpoints.es.js";
|
|
42
42
|
import { match, P } from "ts-pattern";
|
|
43
43
|
import ipsum from "corporate-ipsum";
|
|
44
44
|
import { Element, Range, Editor, Text, Path, Transforms, Node, Point, createEditor } from "slate";
|
|
@@ -3607,6 +3607,168 @@ function getValue(editor) {
|
|
|
3607
3607
|
})).map(([node]) => node["typography"]);
|
|
3608
3608
|
return matchingValues;
|
|
3609
3609
|
}
|
|
3610
|
+
function shallowMergeTypographies(commonTypography, typography) {
|
|
3611
|
+
var _a, _b;
|
|
3612
|
+
const devices = [
|
|
3613
|
+
...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 : []))
|
|
3614
|
+
];
|
|
3615
|
+
return {
|
|
3616
|
+
id: (_b = commonTypography == null ? void 0 : commonTypography.id) != null ? _b : typography == null ? void 0 : typography.id,
|
|
3617
|
+
style: devices.map((deviceId) => {
|
|
3618
|
+
var _a2, _b2;
|
|
3619
|
+
const commonDevice = commonTypography == null ? void 0 : commonTypography.style.find((s) => s.deviceId === deviceId);
|
|
3620
|
+
const existingDeviceStyle = typography == null ? void 0 : typography.style.find((s) => s.deviceId === deviceId);
|
|
3621
|
+
return {
|
|
3622
|
+
deviceId,
|
|
3623
|
+
value: shallowMerge((_a2 = existingDeviceStyle == null ? void 0 : existingDeviceStyle.value) != null ? _a2 : {}, (_b2 = commonDevice == null ? void 0 : commonDevice.value) != null ? _b2 : {})
|
|
3624
|
+
};
|
|
3625
|
+
})
|
|
3626
|
+
};
|
|
3627
|
+
}
|
|
3628
|
+
function normalizeTypographyDown(editor, entry) {
|
|
3629
|
+
const [normalizationNode, normalizationPath] = entry;
|
|
3630
|
+
if (Element.isElement(normalizationNode) && normalizationNode.typography != null && normalizationNode.children.length) {
|
|
3631
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3632
|
+
var _a;
|
|
3633
|
+
Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3634
|
+
for (let i = 0; i < normalizationNode.children.length; i++) {
|
|
3635
|
+
const resultingTypography = shallowMergeTypographies(normalizationNode.typography, (_a = normalizationNode.children.at(i)) == null ? void 0 : _a.typography);
|
|
3636
|
+
Transforms.setNodes(editor, { typography: resultingTypography }, { at: [...normalizationPath, i] });
|
|
3637
|
+
}
|
|
3638
|
+
});
|
|
3639
|
+
return true;
|
|
3640
|
+
}
|
|
3641
|
+
return false;
|
|
3642
|
+
}
|
|
3643
|
+
function shallowAnd(a, b) {
|
|
3644
|
+
const bKeys = keys(b);
|
|
3645
|
+
const aPrime = __spreadValues({}, a);
|
|
3646
|
+
const and = {};
|
|
3647
|
+
bKeys.forEach((key) => {
|
|
3648
|
+
if (deepEqual(aPrime[key], b[key]))
|
|
3649
|
+
and[key] = aPrime[key];
|
|
3650
|
+
});
|
|
3651
|
+
return and;
|
|
3652
|
+
}
|
|
3653
|
+
function shallowAndTypographies(...typographies) {
|
|
3654
|
+
var _a;
|
|
3655
|
+
return {
|
|
3656
|
+
id: typographies.every((typography) => {
|
|
3657
|
+
var _a2;
|
|
3658
|
+
return (typography == null ? void 0 : typography.id) === ((_a2 = typographies.at(0)) == null ? void 0 : _a2.id);
|
|
3659
|
+
}) ? (_a = typographies.at(0)) == null ? void 0 : _a.id : void 0,
|
|
3660
|
+
style: [
|
|
3661
|
+
...new Set(typographies.flatMap((typography) => {
|
|
3662
|
+
var _a2;
|
|
3663
|
+
return (_a2 = typography == null ? void 0 : typography.style.map((node) => node.deviceId)) != null ? _a2 : [];
|
|
3664
|
+
}))
|
|
3665
|
+
].flatMap((deviceId) => {
|
|
3666
|
+
const stylesForThisDevice = typographies.map((typography) => {
|
|
3667
|
+
var _a2;
|
|
3668
|
+
return (_a2 = typography.style.find((s) => s.deviceId === deviceId)) == null ? void 0 : _a2.value;
|
|
3669
|
+
}).filter((typography) => Boolean(typography));
|
|
3670
|
+
if (typographies.length !== stylesForThisDevice.length)
|
|
3671
|
+
return [];
|
|
3672
|
+
const value = stylesForThisDevice.reduce((acc, curr) => {
|
|
3673
|
+
return shallowAnd(acc, curr);
|
|
3674
|
+
}, stylesForThisDevice.at(0));
|
|
3675
|
+
if (value == null || Object.keys(value).length === 0) {
|
|
3676
|
+
return [];
|
|
3677
|
+
}
|
|
3678
|
+
return [
|
|
3679
|
+
{
|
|
3680
|
+
deviceId,
|
|
3681
|
+
value
|
|
3682
|
+
}
|
|
3683
|
+
];
|
|
3684
|
+
})
|
|
3685
|
+
};
|
|
3686
|
+
}
|
|
3687
|
+
function shallowInverseAnd(a, b) {
|
|
3688
|
+
const bKeys = Array.from(/* @__PURE__ */ new Set([...keys(b), ...keys(a)]));
|
|
3689
|
+
const aPrime = __spreadValues({}, a);
|
|
3690
|
+
const bPrime = __spreadValues({}, b);
|
|
3691
|
+
const xor = {};
|
|
3692
|
+
bKeys.forEach((key) => {
|
|
3693
|
+
if (aPrime[key] == null && bPrime[key] == null || !deepEqual(aPrime[key], bPrime[key]))
|
|
3694
|
+
xor[key] = aPrime[key];
|
|
3695
|
+
});
|
|
3696
|
+
return xor;
|
|
3697
|
+
}
|
|
3698
|
+
function shallowInverseAndTypographies(a, b) {
|
|
3699
|
+
const typography = { style: [] };
|
|
3700
|
+
if ((a == null ? void 0 : a.id) !== b.id) {
|
|
3701
|
+
typography.id = a == null ? void 0 : a.id;
|
|
3702
|
+
}
|
|
3703
|
+
if (a && a.style.length > 0) {
|
|
3704
|
+
const styles = [];
|
|
3705
|
+
for (const style of a.style) {
|
|
3706
|
+
const bDeviceTypography = b.style.find((s) => s.deviceId === style.deviceId);
|
|
3707
|
+
if (bDeviceTypography == null) {
|
|
3708
|
+
styles.push(style);
|
|
3709
|
+
} else {
|
|
3710
|
+
const uniquePropertiesOfA = shallowInverseAnd(style.value, bDeviceTypography.value);
|
|
3711
|
+
if (Object.keys(uniquePropertiesOfA).length > 0) {
|
|
3712
|
+
styles.push({
|
|
3713
|
+
deviceId: style.deviceId,
|
|
3714
|
+
value: uniquePropertiesOfA
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
typography.style = styles;
|
|
3720
|
+
}
|
|
3721
|
+
return typography;
|
|
3722
|
+
}
|
|
3723
|
+
function isException(node) {
|
|
3724
|
+
return Text.isText(node) && node.text === "";
|
|
3725
|
+
}
|
|
3726
|
+
function normalizeTypographyUp(editor, entry) {
|
|
3727
|
+
const [node, path] = entry;
|
|
3728
|
+
if (Element.isElement(node) && node.children.length) {
|
|
3729
|
+
const typographiesOfChildren = node.children.filter((child) => !isException(child)).map((child) => child.typography);
|
|
3730
|
+
const definedTypographiesOfChildren = typographiesOfChildren.filter((typography) => Boolean(typography));
|
|
3731
|
+
if (typographiesOfChildren.length === definedTypographiesOfChildren.length) {
|
|
3732
|
+
let sharedTypography = shallowAndTypographies(...definedTypographiesOfChildren);
|
|
3733
|
+
if (sharedTypography.style.length > 0 || sharedTypography.id != null) {
|
|
3734
|
+
const rootTypography = shallowMergeTypographies(sharedTypography, node.typography);
|
|
3735
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3736
|
+
var _a, _b;
|
|
3737
|
+
Transforms.setNodes(editor, { typography: rootTypography }, { at: path });
|
|
3738
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
3739
|
+
const typography = shallowInverseAndTypographies((_b = (_a = node.children.at(i)) == null ? void 0 : _a.typography) != null ? _b : { style: [] }, sharedTypography);
|
|
3740
|
+
Transforms.setNodes(editor, { typography }, { at: [...path, i] });
|
|
3741
|
+
}
|
|
3742
|
+
});
|
|
3743
|
+
return true;
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
return false;
|
|
3748
|
+
}
|
|
3749
|
+
function isTextEqual(a, b) {
|
|
3750
|
+
const _a = a, { text: aText } = _a, aRest = __objRest(_a, ["text"]);
|
|
3751
|
+
const _b = b, { text: bText } = _b, bRest = __objRest(_b, ["text"]);
|
|
3752
|
+
return deepEqual(aRest, bRest);
|
|
3753
|
+
}
|
|
3754
|
+
function normalizeSimilarText(editor, entry) {
|
|
3755
|
+
const [node, path] = entry;
|
|
3756
|
+
if (Text.isText(node))
|
|
3757
|
+
return false;
|
|
3758
|
+
let hasMergedNodes = false;
|
|
3759
|
+
for (let i = node.children.length; i > 0; i--) {
|
|
3760
|
+
const currentNode = Node.get(editor, path);
|
|
3761
|
+
if (Text.isText(currentNode))
|
|
3762
|
+
continue;
|
|
3763
|
+
const child = currentNode.children[i];
|
|
3764
|
+
const prev = currentNode.children[i - 1];
|
|
3765
|
+
if (Text.isText(child) && prev != null && Text.isText(prev) && isTextEqual(child, prev)) {
|
|
3766
|
+
Transforms.mergeNodes(editor, { at: path.concat(i), voids: true });
|
|
3767
|
+
hasMergedNodes = true;
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
return hasMergedNodes;
|
|
3771
|
+
}
|
|
3610
3772
|
const TypographyActions = {
|
|
3611
3773
|
setActiveTypographyId,
|
|
3612
3774
|
setActiveTypographyStyle,
|
|
@@ -3620,14 +3782,20 @@ function withTypography(editor) {
|
|
|
3620
3782
|
editor.normalizeNode = (entry) => {
|
|
3621
3783
|
var _a, _b;
|
|
3622
3784
|
const [normalizationNode, normalizationPath] = entry;
|
|
3623
|
-
if (
|
|
3785
|
+
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) {
|
|
3624
3786
|
Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath });
|
|
3625
3787
|
return;
|
|
3626
3788
|
}
|
|
3627
|
-
if (
|
|
3789
|
+
if ("slice" in normalizationNode && (normalizationNode == null ? void 0 : normalizationNode.slice) != null) {
|
|
3628
3790
|
Transforms.unsetNodes(editor, "slice", { at: normalizationPath });
|
|
3629
3791
|
return;
|
|
3630
3792
|
}
|
|
3793
|
+
if (normalizeSimilarText(editor, entry))
|
|
3794
|
+
return;
|
|
3795
|
+
if (editor.typographyNormalizationDirection === "up" && normalizeTypographyUp(editor, entry))
|
|
3796
|
+
return;
|
|
3797
|
+
if ((editor.typographyNormalizationDirection === "down" || editor.typographyNormalizationDirection == null) && normalizeTypographyDown(editor, entry))
|
|
3798
|
+
return;
|
|
3631
3799
|
normalizeNode(entry);
|
|
3632
3800
|
};
|
|
3633
3801
|
return editor;
|
|
@@ -3994,6 +4162,8 @@ function getInlineOrTextTranslatableData(descendant, path = []) {
|
|
|
3994
4162
|
let string = escapeHtml(descendant.text);
|
|
3995
4163
|
if (string === "")
|
|
3996
4164
|
return null;
|
|
4165
|
+
if (descendant.typography === void 0)
|
|
4166
|
+
return string;
|
|
3997
4167
|
return `<span key="${pathToString(path)}">${string}</span>`;
|
|
3998
4168
|
}
|
|
3999
4169
|
const children = descendant.children.map((child, i) => getInlineOrTextTranslatableData(child, [...path, i])).join("");
|
|
@@ -4012,8 +4182,17 @@ function getInlineOrTextTranslatableData(descendant, path = []) {
|
|
|
4012
4182
|
return children;
|
|
4013
4183
|
}
|
|
4014
4184
|
}
|
|
4015
|
-
function getRichTextV2TranslatableData(data) {
|
|
4016
|
-
|
|
4185
|
+
function getRichTextV2TranslatableData(definition2, data) {
|
|
4186
|
+
var _a;
|
|
4187
|
+
const plugins = ((_a = definition2 == null ? void 0 : definition2.config) == null ? void 0 : _a.mode) === RichTextV2Mode.Inline ? [InlineModePlugin()] : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin()];
|
|
4188
|
+
const editor = plugins.reduceRight((editor2, plugin) => {
|
|
4189
|
+
var _a2, _b;
|
|
4190
|
+
return (_b = (_a2 = plugin == null ? void 0 : plugin.withPlugin) == null ? void 0 : _a2.call(plugin, editor2)) != null ? _b : editor2;
|
|
4191
|
+
}, createEditor());
|
|
4192
|
+
editor.children = data.descendants;
|
|
4193
|
+
editor.typographyNormalizationDirection = "up";
|
|
4194
|
+
Editor.normalize(editor, { force: true });
|
|
4195
|
+
return editor.children.reduce((acc, descendant, i) => __spreadValues(__spreadValues({}, acc), getDescendantTranslatableData(descendant, [i])), {});
|
|
4017
4196
|
}
|
|
4018
4197
|
function deserializeTranslationHtmlString(el, translationKey) {
|
|
4019
4198
|
var _a, _b;
|
|
@@ -4058,6 +4237,8 @@ function mergeRichTextV2TranslatedData(definition2, data, translatedData) {
|
|
|
4058
4237
|
return (_b = (_a2 = plugin == null ? void 0 : plugin.withPlugin) == null ? void 0 : _a2.call(plugin, editor)) != null ? _b : editor;
|
|
4059
4238
|
}, createEditor());
|
|
4060
4239
|
sourceEditor.children = data.descendants;
|
|
4240
|
+
sourceEditor.typographyNormalizationDirection = "up";
|
|
4241
|
+
Editor.normalize(sourceEditor, { force: true });
|
|
4061
4242
|
Object.entries(translatedData).reverse().forEach(([blockStringPath, htmlString]) => {
|
|
4062
4243
|
var _c2;
|
|
4063
4244
|
const blockPath = stringToPath(blockStringPath);
|
|
@@ -4066,6 +4247,7 @@ function mergeRichTextV2TranslatedData(definition2, data, translatedData) {
|
|
|
4066
4247
|
const html = parseFragment(htmlString);
|
|
4067
4248
|
const inlineDescendants = deserializeTranslationHtmlString(html);
|
|
4068
4249
|
targetEditor.children = [{ type: BlockType.Default, children: inlineDescendants }];
|
|
4250
|
+
targetEditor.typographyNormalizationDirection = "neutral";
|
|
4069
4251
|
Editor.normalize(targetEditor, { force: true });
|
|
4070
4252
|
for (const [descendant, absolutePathToTargetNode] of Node.descendants(targetEditor)) {
|
|
4071
4253
|
if (!Text.isText(descendant) && !ElementUtils.isInline(descendant) || descendant.translationKey == null || descendant.translationKey === "") {
|
|
@@ -4092,6 +4274,8 @@ function mergeRichTextV2TranslatedData(definition2, data, translatedData) {
|
|
|
4092
4274
|
Transforms.insertNodes(sourceEditor, translatedChildren, { at: [...blockPath, 0] });
|
|
4093
4275
|
});
|
|
4094
4276
|
});
|
|
4277
|
+
sourceEditor.typographyNormalizationDirection = "down";
|
|
4278
|
+
Editor.normalize(sourceEditor, { force: true });
|
|
4095
4279
|
return __spreadProps(__spreadValues({}, data), { descendants: sourceEditor.children });
|
|
4096
4280
|
}
|
|
4097
4281
|
function copy(definition2, value, context) {
|
|
@@ -4151,7 +4335,7 @@ function getTranslatableData(definition2, data) {
|
|
|
4151
4335
|
const richTextData = data;
|
|
4152
4336
|
if (isRichTextV1Data(richTextData))
|
|
4153
4337
|
return null;
|
|
4154
|
-
return getRichTextV2TranslatableData(richTextData);
|
|
4338
|
+
return getRichTextV2TranslatableData(definition2, richTextData);
|
|
4155
4339
|
case ListControlType:
|
|
4156
4340
|
if (data == null)
|
|
4157
4341
|
return null;
|
|
@@ -4165,6 +4349,8 @@ function getTranslatableData(definition2, data) {
|
|
|
4165
4349
|
}
|
|
4166
4350
|
}
|
|
4167
4351
|
function mergeTranslatedData(definition2, data, translatedData, context) {
|
|
4352
|
+
if (data == null)
|
|
4353
|
+
return data;
|
|
4168
4354
|
switch (definition2.type) {
|
|
4169
4355
|
case Types.TextInput:
|
|
4170
4356
|
case Types.TextArea:
|
|
@@ -4761,18 +4947,18 @@ function getDocumentElements(state, documentKey) {
|
|
|
4761
4947
|
}
|
|
4762
4948
|
function getDocumentKeysSortedByDepth(state) {
|
|
4763
4949
|
const documents = getDocuments(getDocumentsStateSlice(state));
|
|
4764
|
-
const
|
|
4765
|
-
if (
|
|
4766
|
-
return
|
|
4950
|
+
const keys2 = Array.from(documents.keys());
|
|
4951
|
+
if (keys2.length < 2)
|
|
4952
|
+
return keys2;
|
|
4767
4953
|
const elements = /* @__PURE__ */ new Map();
|
|
4768
|
-
|
|
4954
|
+
keys2.forEach((key) => {
|
|
4769
4955
|
elements.set(key, getDocumentElements(state, key));
|
|
4770
4956
|
});
|
|
4771
|
-
|
|
4957
|
+
keys2.sort((a, b) => {
|
|
4772
4958
|
var _a;
|
|
4773
4959
|
return ((_a = elements.get(a)) == null ? void 0 : _a.has(b)) ? -1 : 1;
|
|
4774
4960
|
});
|
|
4775
|
-
return
|
|
4961
|
+
return keys2;
|
|
4776
4962
|
}
|
|
4777
4963
|
function getElement(state, documentKey, elementKey) {
|
|
4778
4964
|
var _a;
|