@wordpress/block-library
Version:
Block library for the WordPress editor.
24 lines (23 loc) • 674 B
JavaScript
import { useRef } from "@wordpress/element";
import { useResizeObserver } from "@wordpress/compose";
import { jsx } from "react/jsx-runtime";
// packages/block-library/src/image/use-max-width-observer.jsx
function useMaxWidthObserver() {
const [contentResizeListener, { width }] = useResizeObserver();
const observerRef = useRef();
return [/* @__PURE__ */ jsx("div", {
className: "wp-block",
"aria-hidden": "true",
style: {
position: "absolute",
inset: 0,
width: "100%",
height: 0,
margin: 0
},
ref: observerRef,
children: contentResizeListener
}), width];
}
export { useMaxWidthObserver };
//# sourceMappingURL=use-max-width-observer.mjs.map