Skip to content

Commit

Permalink
fix PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Jul 22, 2024
1 parent 3ee41e8 commit 2c26d65
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,13 +807,13 @@ protected static function get_style_variation_files_from_current_theme() {
* @return array
*/
public static function get_style_variations_from_directory( $directory, $scope = 'theme' ) {
$variation_files = array();
$variations = array();
$variation_files = array();
$variations = array();
if ( is_dir( $directory ) ) {
if ( $directory === get_stylesheet_directory() ) {
if ( get_stylesheet_directory() === $directory ) {
$variation_files = static::get_style_variation_files_from_current_theme();
} else {
$variation_files = static::recursively_iterate_json( $base_directory );
$variation_files = static::recursively_iterate_json( $directory );
}
}
ksort( $variation_files );
Expand Down
22 changes: 21 additions & 1 deletion packages/block-editor/src/components/inner-blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import clsx from 'clsx';
* WordPress dependencies
*/
import { useMergeRefs } from '@wordpress/compose';
import { forwardRef, useMemo, memo } from '@wordpress/element';
import {
forwardRef,
useMemo,
memo,
useState,
useEffect,
} from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import {
getBlockSupport,
Expand Down Expand Up @@ -186,6 +192,7 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
__unstableDisableDropZone,
dropZoneElement,
} = options;

const {
clientId,
layout = null,
Expand Down Expand Up @@ -262,15 +269,28 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
defaultLayout,
} = selected;

const [ isReady, setIsReady ] = useState( false );
// Defer the initial rendering to avoid the jumps due to the animation.
useEffect( () => {
const timeout = setTimeout( () => {
setIsReady( true );
}, 5000 );
return () => {
clearTimeout( timeout );
};
}, [] );

const blockDropZoneRef = useBlockDropZone( {
dropZoneElement,
rootClientId: clientId,
parentClientId,
isDropZoneDisabled,
} );

const ref = useMergeRefs( [
props.ref,
__unstableDisableDropZone ||
! isReady ||
isDropZoneDisabled ||
( layout?.isManualPlacement &&
window.__experimentalEnableGridInteractivity )
Expand Down

0 comments on commit 2c26d65

Please sign in to comment.