Skip to content

Commit

Permalink
Restore turning on top toolbar setting for less-than-medium viewports
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Jan 4, 2024
1 parent 436aa7e commit 26ce3cd
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -10,6 +10,7 @@ import {
} from '@wordpress/core-data';
import { __ } from '@wordpress/i18n';
import { store as preferencesStore } from '@wordpress/preferences';
import { useViewportMatch } from '@wordpress/compose';

/**
* Internal dependencies
Expand Down Expand Up @@ -87,6 +88,7 @@ const BLOCK_EDITOR_SETTINGS = [
* @return {Object} Block Editor Settings.
*/
function useBlockEditorSettings( settings, postType, postId ) {
const isLargeViewport = useViewportMatch( 'medium' );
const {
allowRightClickOverrides,
hasFixedToolbar,
Expand Down Expand Up @@ -131,7 +133,8 @@ function useBlockEditorSettings( settings, postType, postId ) {
postType,
postId
)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),
hasFixedToolbar: get( 'core', 'fixedToolbar' ),
hasFixedToolbar:
get( 'core', 'fixedToolbar' ) || ! isLargeViewport,
keepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),
reusableBlocks: isWeb
? getEntityRecords( 'postType', 'wp_block', {
Expand All @@ -148,7 +151,7 @@ function useBlockEditorSettings( settings, postType, postId ) {
getPostLinkProps: postLinkProps,
};
},
[ postType, postId ]
[ postType, postId, isLargeViewport ]
);

const settingsBlockPatterns =
Expand Down

0 comments on commit 26ce3cd

Please sign in to comment.