@contentful/experiences-visual-editor-react 1.40.0-alpha-20250604T1545-078bcac.0 → 1.40.0-alpha-20250702T0805-d0f2745.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/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +15 -1
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -45577,6 +45577,10 @@ const findOutermostCoordinates = (first, second) => {
|
|
|
45577
45577
|
left: Math.min(first.left, second.left),
|
|
45578
45578
|
};
|
|
45579
45579
|
};
|
|
45580
|
+
const isElementHidden = (rect) => {
|
|
45581
|
+
/** if the rect has no size and position, its element is not rendered in the DOM */
|
|
45582
|
+
return rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;
|
|
45583
|
+
};
|
|
45580
45584
|
const getElementCoordinates = (element) => {
|
|
45581
45585
|
const rect = element.getBoundingClientRect();
|
|
45582
45586
|
/**
|
|
@@ -45808,7 +45812,14 @@ function buildTemplate({ template, context, }) {
|
|
|
45808
45812
|
|
|
45809
45813
|
const stylesToKeep = ['cfImageAsset'];
|
|
45810
45814
|
const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));
|
|
45811
|
-
|
|
45815
|
+
// cfWrapColumns & cfWrapColumnsCount are no real style attributes as they are handled on the editor side
|
|
45816
|
+
const propsToRemove = [
|
|
45817
|
+
'cfHyperlink',
|
|
45818
|
+
'cfOpenInNewTab',
|
|
45819
|
+
'cfSsrClassName',
|
|
45820
|
+
'cfWrapColumns',
|
|
45821
|
+
'cfWrapColumnsCount',
|
|
45822
|
+
];
|
|
45812
45823
|
const sanitizeNodeProps = (nodeProps) => {
|
|
45813
45824
|
return omit(nodeProps, stylesToRemove, propsToRemove);
|
|
45814
45825
|
};
|
|
@@ -49562,6 +49573,9 @@ const collectNodeCoordinates = (node, nodeToCoordinatesMap) => {
|
|
|
49562
49573
|
const selectedElement = document.querySelector(`[data-cf-node-id="${node.data.id}"]`);
|
|
49563
49574
|
if (selectedElement) {
|
|
49564
49575
|
const rect = getElementCoordinates(selectedElement);
|
|
49576
|
+
if (isElementHidden(rect)) {
|
|
49577
|
+
return;
|
|
49578
|
+
}
|
|
49565
49579
|
nodeToCoordinatesMap[node.data.id] = {
|
|
49566
49580
|
coordinates: {
|
|
49567
49581
|
x: rect.x + window.scrollX,
|