@contentful/experiences-visual-editor-react 1.40.0-alpha-20250604T0813-1f6e699.0 → 1.40.0-alpha-20250604T1545-078bcac.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/renderApp.js CHANGED
@@ -49598,7 +49598,7 @@ const waitForAllImagesToBeLoaded = () => {
49598
49598
  }));
49599
49599
  };
49600
49600
 
49601
- const useCanvasGeometryUpdates = ({ tree, rootContainerRef, }) => {
49601
+ const useCanvasGeometryUpdates = ({ tree }) => {
49602
49602
  const debouncedUpdateGeometry = reactExports.useMemo(() => debounce((tree, sourceEvent) => {
49603
49603
  // When the DOM changed, we still need to wait for the next frame to ensure that
49604
49604
  // rendering is complete (e.g. this is required when deleting a node).
@@ -49625,22 +49625,19 @@ const useCanvasGeometryUpdates = ({ tree, rootContainerRef, }) => {
49625
49625
  }, [debouncedUpdateGeometry]);
49626
49626
  // Handling DOM mutations
49627
49627
  reactExports.useEffect(() => {
49628
- if (!rootContainerRef.current)
49629
- return;
49630
49628
  const observer = new MutationObserver(() => debouncedUpdateGeometry(treeRef.current, 'mutation'));
49631
- observer.observe(rootContainerRef.current, {
49629
+ observer.observe(document.documentElement, {
49632
49630
  childList: true,
49633
49631
  subtree: true,
49634
49632
  attributes: true,
49635
49633
  });
49636
49634
  return () => observer.disconnect();
49637
- }, [debouncedUpdateGeometry, rootContainerRef]);
49635
+ }, [debouncedUpdateGeometry]);
49638
49636
  };
49639
49637
 
49640
49638
  const RootRenderer = () => {
49641
- const rootContainerRef = reactExports.useRef(null);
49642
49639
  const tree = useTreeStore((state) => state.tree);
49643
- useCanvasGeometryUpdates({ tree, rootContainerRef });
49640
+ useCanvasGeometryUpdates({ tree });
49644
49641
  useEditorSubscriber();
49645
49642
  const breakpoints = useTreeStore((state) => state.breakpoints);
49646
49643
  const { resolveDesignValue } = useBreakpoints(breakpoints);
@@ -49649,7 +49646,7 @@ const RootRenderer = () => {
49649
49646
  const rootBlockId = tree.root.data.blockId ?? ROOT_ID;
49650
49647
  const wrappingPatternIds = rootBlockId !== ROOT_ID ? new Set([rootBlockId]) : new Set();
49651
49648
  return (React$1.createElement(React$1.Fragment, null,
49652
- React$1.createElement("div", { "data-ctfl-root": true, className: styles$2.rootContainer, ref: rootContainerRef }, !tree.root.children.length ? (React$1.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React$1.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds })))))));
49649
+ React$1.createElement("div", { "data-ctfl-root": true, className: styles$2.rootContainer }, !tree.root.children.length ? (React$1.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React$1.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds })))))));
49653
49650
  };
49654
49651
 
49655
49652
  const useInitializeEditor = () => {