@contentful/experiences-visual-editor-react 3.2.1-dev-20250819T1408-2dcca7e.0 → 3.2.1-dev-20250820T1011-7f01669.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 +26 -1
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +26 -1
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -50264,7 +50264,7 @@ const sendCanvasGeometryUpdatedMessage = async (tree, sourceEvent) => {
|
|
|
50264
50264
|
const rootRect = document.documentElement.getBoundingClientRect();
|
|
50265
50265
|
const bodyRect = document.body.getBoundingClientRect();
|
|
50266
50266
|
const width = Math.max(document.documentElement.offsetWidth, rootRect.width, bodyRect.width);
|
|
50267
|
-
const height = Math.max(document.documentElement.offsetHeight, rootRect.height, bodyRect.height);
|
|
50267
|
+
const height = Math.max(document.documentElement.offsetHeight, rootRect.height, bodyRect.height, measureBodyContentHeight());
|
|
50268
50268
|
sendMessage(OUTGOING_EVENTS.CanvasGeometryUpdated, {
|
|
50269
50269
|
size: {
|
|
50270
50270
|
width,
|
|
@@ -50312,6 +50312,31 @@ function waitForImageToBeLoaded(imageNode) {
|
|
|
50312
50312
|
imageNode.addEventListener('error', handleImageLoad);
|
|
50313
50313
|
});
|
|
50314
50314
|
}
|
|
50315
|
+
// calculates the content height by finding the deepest node in the first 2 levels of the body
|
|
50316
|
+
function measureBodyContentHeight(depth = 2, node = document.body) {
|
|
50317
|
+
if (depth <= 0)
|
|
50318
|
+
return 0;
|
|
50319
|
+
let height = 0;
|
|
50320
|
+
for (const element of node.children) {
|
|
50321
|
+
const rect = element.getBoundingClientRect();
|
|
50322
|
+
const style = window.getComputedStyle(element);
|
|
50323
|
+
const isHidden = (rect.width === 0 && rect.height === 0) ||
|
|
50324
|
+
style.display === 'none' ||
|
|
50325
|
+
style.visibility === 'hidden';
|
|
50326
|
+
// ignore relative positioned elements that are anchored to the bottom,
|
|
50327
|
+
// as this can cause infinite height
|
|
50328
|
+
const isBottomAnchored = (style.position === 'fixed' ||
|
|
50329
|
+
style.position === 'absolute' ||
|
|
50330
|
+
style.position === 'relative' ||
|
|
50331
|
+
style.position === 'sticky') &&
|
|
50332
|
+
parseFloat(style.bottom) < 0;
|
|
50333
|
+
if (isHidden || isBottomAnchored) {
|
|
50334
|
+
continue;
|
|
50335
|
+
}
|
|
50336
|
+
height = Math.max(height, Math.ceil(rect.bottom), measureBodyContentHeight(depth - 1, element));
|
|
50337
|
+
}
|
|
50338
|
+
return height;
|
|
50339
|
+
}
|
|
50315
50340
|
|
|
50316
50341
|
const useCanvasGeometryUpdates = ({ tree, canvasMode }) => {
|
|
50317
50342
|
const debouncedUpdateGeometry = reactExports.useMemo(() => debounce((tree, sourceEvent) => {
|