Skip to content

Commit

Permalink
Rename ref callback suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlende committed Dec 3, 2024
1 parent 2fff145 commit 4f8c5be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
11 changes: 4 additions & 7 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ function Iframe( {
}, [] );

const {
contentRefCallback,
containerRefCallback,
contentRef: scaleContentRef,
containerRef,
isZoomedOut,
scaleContainerWidth,
} = useScaleCanvas( {
Expand All @@ -234,7 +234,7 @@ function Iframe( {
clearerRef,
writingFlowRef,
disabledRef,
contentRefCallback,
scaleContentRef,
] );

// Correct doctype is required to enable rendering in standards
Expand Down Expand Up @@ -354,10 +354,7 @@ function Iframe( {
);

return (
<div
className="block-editor-iframe__container"
ref={ containerRefCallback }
>
<div className="block-editor-iframe__container" ref={ containerRef }>
<div
className={ clsx(
'block-editor-iframe__scale-container',
Expand Down
16 changes: 8 additions & 8 deletions packages/block-editor/src/components/iframe/use-scale-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ function extractSize( entries ) {

/**
* @typedef {Object} ScaleCanvasResult
* @property {boolean} isZoomedOut A boolean indicating if the canvas is zoomed out.
* @property {number} scaleContainerWidth The width of the container used to calculate the scale.
* @property {Object} contentResizeListener A resize observer for the content.
* @property {Object} containerResizeListener A resize observer for the container.
* @property {boolean} isZoomedOut A boolean indicating if the canvas is zoomed out.
* @property {number} scaleContainerWidth The width of the container used to calculate the scale.
* @property {import('react').Ref<Element>} contentRef A callback ref to the content element.
* @property {import('react').Ref<Element>} containerRef A callback ref to the container element.
*/

/**
Expand All @@ -180,14 +180,14 @@ export function useScaleCanvas( {
scale,
} ) {
const [ { height: contentHeight }, setContentRect ] = useState( NULL_SIZE );
const contentRefCallback = useResizeObserver( ( entries ) => {
const contentRef = useResizeObserver( ( entries ) => {
setContentRect( extractSize( entries ) );
} );
const [
{ width: containerWidth, height: containerHeight },
setContainerRect,
] = useState( NULL_SIZE );
const containerRefCallback = useResizeObserver( ( entries ) => {
const containerRef = useResizeObserver( ( entries ) => {
setContainerRect( extractSize( entries ) );
} );

Expand Down Expand Up @@ -511,7 +511,7 @@ export function useScaleCanvas( {
return {
isZoomedOut,
scaleContainerWidth,
contentRefCallback,
containerRefCallback,
contentRef,
containerRef,
};
}

0 comments on commit 4f8c5be

Please sign in to comment.