From f5e4bf6864fb276e5d1e131806912dede625168f Mon Sep 17 00:00:00 2001 From: Tom Cafferkey Date: Wed, 31 Jul 2024 15:30:02 +0100 Subject: [PATCH] Remove the unlock functionality around objects that were not previously locked associated with the useZoomOut hook and feature. --- .../src/components/block-tools/zoom-out-mode-inserters.js | 3 +-- packages/block-editor/src/components/inner-blocks/index.js | 2 +- packages/block-editor/src/store/actions.js | 7 +++---- packages/block-editor/src/store/selectors.js | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js index bb044f9479c024..850c2432f611c1 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js @@ -10,7 +10,6 @@ import { useEffect, useState } from '@wordpress/element'; import BlockPopoverInbetween from '../block-popover/inbetween'; import ZoomOutModeInserterButton from './zoom-out-mode-inserter-button'; import { store as blockEditorStore } from '../../store'; -import { unlock } from '../../lock-unlock'; function ZoomOutModeInserters() { const [ isReady, setIsReady ] = useState( false ); @@ -33,7 +32,7 @@ function ZoomOutModeInserters() { getHoveredBlockClientId, isBlockInsertionPointVisible, } = select( blockEditorStore ); - const { sectionRootClientId: root } = unlock( getSettings() ); + const { sectionRootClientId: root } = getSettings(); return { hasSelection: !! getSelectionStart().clientId, blockInsertionPoint: getBlockInsertionPoint(), diff --git a/packages/block-editor/src/components/inner-blocks/index.js b/packages/block-editor/src/components/inner-blocks/index.js index 27e5064eeb6328..e61b0522fbe389 100644 --- a/packages/block-editor/src/components/inner-blocks/index.js +++ b/packages/block-editor/src/components/inner-blocks/index.js @@ -210,7 +210,7 @@ export function useInnerBlocksProps( props = {}, options = {} ) { // The inner blocks belonging to the section drop zone is // already disabled by the blocks themselves being disabled. if ( __unstableGetEditorMode() === 'zoom-out' ) { - const { sectionRootClientId } = unlock( getSettings() ); + const { sectionRootClientId } = getSettings(); _isDropZoneDisabled = clientId !== sectionRootClientId; } if ( ! clientId ) { diff --git a/packages/block-editor/src/store/actions.js b/packages/block-editor/src/store/actions.js index f7da8fa14b382a..3a209a1267e288 100644 --- a/packages/block-editor/src/store/actions.js +++ b/packages/block-editor/src/store/actions.js @@ -35,7 +35,6 @@ import { privateRemoveBlocks, } from './private-actions'; import { STORE_NAME } from './constants'; -import { unlock } from '../lock-unlock'; /** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */ @@ -1674,9 +1673,9 @@ export const __unstableSetEditorMode = // When switching to zoom-out mode, we need to select the parent section if ( mode === 'zoom-out' ) { const firstSelectedClientId = select.getBlockSelectionStart(); - const { sectionRootClientId } = unlock( - registry.select( STORE_NAME ).getSettings() - ); + const { sectionRootClientId } = registry + .select( STORE_NAME ) + .getSettings(); if ( firstSelectedClientId ) { let sectionClientId; diff --git a/packages/block-editor/src/store/selectors.js b/packages/block-editor/src/store/selectors.js index f06293dadf233c..01d34e7aed6a1b 100644 --- a/packages/block-editor/src/store/selectors.js +++ b/packages/block-editor/src/store/selectors.js @@ -2858,7 +2858,7 @@ export function __unstableHasActiveBlockOverlayActive( state, clientId ) { // In zoom-out mode, the block overlay is always active for section level blocks. if ( editorMode === 'zoom-out' ) { - const { sectionRootClientId } = unlock( getSettings( state ) ); + const { sectionRootClientId } = getSettings( state ); if ( sectionRootClientId ) { const sectionClientIds = getBlockOrder( state, @@ -2951,7 +2951,7 @@ export const getBlockEditingMode = createRegistrySelector( // sections. const editorMode = __unstableGetEditorMode( state ); if ( editorMode === 'zoom-out' ) { - const { sectionRootClientId } = unlock( getSettings( state ) ); + const { sectionRootClientId } = getSettings( state ); if ( clientId === '' /* ROOT_CONTAINER_CLIENT_ID */ ) { return sectionRootClientId ? 'disabled' : 'contentOnly'; }