diff --git a/lib/experimental/class-wp-rest-block-editor-settings-controller.php b/lib/experimental/class-wp-rest-block-editor-settings-controller.php index d38f73be71d20..7bca2a9e8e996 100644 --- a/lib/experimental/class-wp-rest-block-editor-settings-controller.php +++ b/lib/experimental/class-wp-rest-block-editor-settings-controller.php @@ -168,12 +168,6 @@ public function get_item_schema() { 'context' => array( 'mobile' ), ), - '__experimentalBlockInspectorAnimation' => array( - 'description' => __( 'Whether to enable animation when showing and hiding the block inspector.', 'gutenberg' ), - 'type' => 'object', - 'context' => array( 'site-editor' ), - ), - 'alignWide' => array( 'description' => __( 'Enable/Disable Wide/Full Alignments.', 'gutenberg' ), 'type' => 'boolean', diff --git a/packages/block-editor/src/components/block-inspector/index.js b/packages/block-editor/src/components/block-inspector/index.js index e7a769f51cec7..f80bfddb74018 100644 --- a/packages/block-editor/src/components/block-inspector/index.js +++ b/packages/block-editor/src/components/block-inspector/index.js @@ -178,7 +178,7 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => { if ( blockType ) { const globalBlockInspectorAnimationSettings = select( blockEditorStore ).getSettings() - .__experimentalBlockInspectorAnimation; + .blockInspectorAnimation; return globalBlockInspectorAnimationSettings?.[ blockType.name ]; diff --git a/packages/block-editor/src/store/defaults.js b/packages/block-editor/src/store/defaults.js index 18f189dab4105..44095cff573f5 100644 --- a/packages/block-editor/src/store/defaults.js +++ b/packages/block-editor/src/store/defaults.js @@ -170,6 +170,13 @@ export const SETTINGS_DEFAULTS = { __unstableGalleryWithImageBlocks: false, __unstableIsPreviewMode: false, + // This setting is `private` now with `lock` API. + blockInspectorAnimation: { + 'core/navigation': { enterDirection: 'leftToRight' }, + 'core/navigation-submenu': { enterDirection: 'rightToLeft' }, + 'core/navigation-link': { enterDirection: 'rightToLeft' }, + }, + generateAnchors: false, // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. // The setting is only kept for backward compatibility purposes. diff --git a/packages/block-editor/src/store/private-actions.js b/packages/block-editor/src/store/private-actions.js index faf227edc0de6..2d33ea82cb9b6 100644 --- a/packages/block-editor/src/store/private-actions.js +++ b/packages/block-editor/src/store/private-actions.js @@ -11,7 +11,10 @@ import { Platform } from '@wordpress/element'; * * @see https://github.com/WordPress/gutenberg/pull/46131 */ -const privateSettings = [ 'inserterMediaCategories' ]; +const privateSettings = [ + 'inserterMediaCategories', + 'blockInspectorAnimation', +]; /** * Action that updates the block editor settings and diff --git a/packages/block-library/src/navigation-link/index.php b/packages/block-library/src/navigation-link/index.php index 34db86d3b341e..1164fa995b28c 100644 --- a/packages/block-library/src/navigation-link/index.php +++ b/packages/block-library/src/navigation-link/index.php @@ -371,35 +371,3 @@ function register_block_core_navigation_link() { ); } add_action( 'init', 'register_block_core_navigation_link' ); - -/** - * Enables animation of the block inspector for the Navigation Link block. - * - * See: - * - https://github.com/WordPress/gutenberg/pull/46342 - * - https://github.com/WordPress/gutenberg/issues/45884 - * - * @param array $settings Default editor settings. - * @return array Filtered editor settings. - */ -function block_core_navigation_link_enable_inspector_animation( $settings ) { - $current_animation_settings = _wp_array_get( - $settings, - array( '__experimentalBlockInspectorAnimation' ), - array() - ); - - $settings['__experimentalBlockInspectorAnimation'] = array_merge( - $current_animation_settings, - array( - 'core/navigation-link' => - array( - 'enterDirection' => 'rightToLeft', - ), - ) - ); - - return $settings; -} - -add_filter( 'block_editor_settings_all', 'block_core_navigation_link_enable_inspector_animation' ); diff --git a/packages/block-library/src/navigation-submenu/index.php b/packages/block-library/src/navigation-submenu/index.php index 870fda57b5ef5..be6046076e76e 100644 --- a/packages/block-library/src/navigation-submenu/index.php +++ b/packages/block-library/src/navigation-submenu/index.php @@ -289,35 +289,3 @@ function register_block_core_navigation_submenu() { ); } add_action( 'init', 'register_block_core_navigation_submenu' ); - -/** - * Enables animation of the block inspector for the Navigation Submenu block. - * - * See: - * - https://github.com/WordPress/gutenberg/pull/46342 - * - https://github.com/WordPress/gutenberg/issues/45884 - * - * @param array $settings Default editor settings. - * @return array Filtered editor settings. - */ -function block_core_navigation_submenu_enable_inspector_animation( $settings ) { - $current_animation_settings = _wp_array_get( - $settings, - array( '__experimentalBlockInspectorAnimation' ), - array() - ); - - $settings['__experimentalBlockInspectorAnimation'] = array_merge( - $current_animation_settings, - array( - 'core/navigation-submenu' => - array( - 'enterDirection' => 'rightToLeft', - ), - ) - ); - - return $settings; -} - -add_filter( 'block_editor_settings_all', 'block_core_navigation_submenu_enable_inspector_animation' ); diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 06cc21aa87351..01c64cf9e5a66 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -874,35 +874,3 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl } add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' ); - -/** - * Enables animation of the block inspector for the Navigation block. - * - * See: - * - https://github.com/WordPress/gutenberg/pull/46342 - * - https://github.com/WordPress/gutenberg/issues/45884 - * - * @param array $settings Default editor settings. - * @return array Filtered editor settings. - */ -function block_core_navigation_enable_inspector_animation( $settings ) { - $current_animation_settings = _wp_array_get( - $settings, - array( '__experimentalBlockInspectorAnimation' ), - array() - ); - - $settings['__experimentalBlockInspectorAnimation'] = array_merge( - $current_animation_settings, - array( - 'core/navigation' => - array( - 'enterDirection' => 'leftToRight', - ), - ) - ); - - return $settings; -} - -add_filter( 'block_editor_settings_all', 'block_core_navigation_enable_inspector_animation' ); diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 8fbd2cdd54823..8b9d9e5ba86d7 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -21,7 +21,6 @@ const EMPTY_BLOCKS_LIST = []; const BLOCK_EDITOR_SETTINGS = [ '__experimentalBlockDirectory', - '__experimentalBlockInspectorAnimation', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles',