Skip to content

Commit

Permalink
Rename a couple functions
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed Oct 7, 2024
1 parent 91ddb55 commit b1b0ad2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function MetaBoxesMain( { isLegacy } ) {
const resizeHandle = container.querySelector(
'.edit-post-meta-boxes-main__presenter'
);
const actualize = () => {
const deriveConstraints = () => {
const fullHeight = container.offsetHeight;
let nextMax = fullHeight;
for ( const element of noticeLists ) {
Expand All @@ -211,7 +211,7 @@ function MetaBoxesMain( { isLegacy } ) {
const nextMin = resizeHandle.offsetHeight;
setHeightConstraints( { min: nextMin, max: nextMax } );
};
const observer = new window.ResizeObserver( actualize );
const observer = new window.ResizeObserver( deriveConstraints );
observer.observe( container );
for ( const element of noticeLists ) {
observer.observe( element );
Expand All @@ -223,7 +223,7 @@ function MetaBoxesMain( { isLegacy } ) {
const separatorHelpId = useId();

const [ isUntouched, setIsUntouched ] = useState( true );
const actualizeHeight = ( candidateHeight, isPersistent, isInstant ) => {
const applyHeight = ( candidateHeight, isPersistent, isInstant ) => {
const nextHeight = Math.min( max, Math.max( min, candidateHeight ) );
if ( isPersistent ) {
setPreference(
Expand Down Expand Up @@ -291,7 +291,7 @@ function MetaBoxesMain( { isLegacy } ) {
const pane = metaBoxesMainRef.current.resizable;
const fromHeight = isAutoHeight ? pane.offsetHeight : openHeight;
const nextHeight = delta + fromHeight;
actualizeHeight( nextHeight, true, true );
applyHeight( nextHeight, true, true );
event.preventDefault();
}
};
Expand Down Expand Up @@ -354,14 +354,14 @@ function MetaBoxesMain( { isLegacy } ) {
if ( isAutoHeight ) {
// Sets the starting height to avoid visual jumps in height and
// aria-valuenow being `NaN` for the first (few) resize events.
actualizeHeight( elementRef.offsetHeight, false, true );
applyHeight( elementRef.offsetHeight, false, true );
setIsUntouched( false );
}
},
onResize: () =>
actualizeHeight( metaBoxesMainRef.current.state.height ),
applyHeight( metaBoxesMainRef.current.state.height ),
onResizeStop: () =>
actualizeHeight( metaBoxesMainRef.current.state.height, true ),
applyHeight( metaBoxesMainRef.current.state.height, true ),
} );
}

Expand Down

0 comments on commit b1b0ad2

Please sign in to comment.