@contentful/experiences-visual-editor-react 3.2.1-dev-20250818T1739-df3d95e.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 +28 -4
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +28 -4
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -43569,7 +43569,6 @@ const CF_STYLE_ATTRIBUTES = [
|
|
|
43569
43569
|
'cfTextUnderline',
|
|
43570
43570
|
];
|
|
43571
43571
|
const EMPTY_CONTAINER_SIZE$1 = '80px';
|
|
43572
|
-
const DEFAULT_IMAGE_WIDTH = '500px';
|
|
43573
43572
|
var PostMessageMethods$3;
|
|
43574
43573
|
(function (PostMessageMethods) {
|
|
43575
43574
|
PostMessageMethods["REQUEST_ENTITIES"] = "REQUEST_ENTITIES";
|
|
@@ -43791,9 +43790,9 @@ const optionalBuiltInStyles = {
|
|
|
43791
43790
|
type: 'Object',
|
|
43792
43791
|
group: 'style',
|
|
43793
43792
|
defaultValue: {
|
|
43794
|
-
width:
|
|
43793
|
+
width: '100%',
|
|
43795
43794
|
height: '100%',
|
|
43796
|
-
targetSize:
|
|
43795
|
+
targetSize: 'unset',
|
|
43797
43796
|
},
|
|
43798
43797
|
},
|
|
43799
43798
|
cfBackgroundColor: {
|
|
@@ -50265,7 +50264,7 @@ const sendCanvasGeometryUpdatedMessage = async (tree, sourceEvent) => {
|
|
|
50265
50264
|
const rootRect = document.documentElement.getBoundingClientRect();
|
|
50266
50265
|
const bodyRect = document.body.getBoundingClientRect();
|
|
50267
50266
|
const width = Math.max(document.documentElement.offsetWidth, rootRect.width, bodyRect.width);
|
|
50268
|
-
const height = Math.max(document.documentElement.offsetHeight, rootRect.height, bodyRect.height);
|
|
50267
|
+
const height = Math.max(document.documentElement.offsetHeight, rootRect.height, bodyRect.height, measureBodyContentHeight());
|
|
50269
50268
|
sendMessage(OUTGOING_EVENTS.CanvasGeometryUpdated, {
|
|
50270
50269
|
size: {
|
|
50271
50270
|
width,
|
|
@@ -50313,6 +50312,31 @@ function waitForImageToBeLoaded(imageNode) {
|
|
|
50313
50312
|
imageNode.addEventListener('error', handleImageLoad);
|
|
50314
50313
|
});
|
|
50315
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
|
+
}
|
|
50316
50340
|
|
|
50317
50341
|
const useCanvasGeometryUpdates = ({ tree, canvasMode }) => {
|
|
50318
50342
|
const debouncedUpdateGeometry = reactExports.useMemo(() => debounce((tree, sourceEvent) => {
|