diff --git a/packages/block-editor/src/components/block-lock/menu-item.js b/packages/block-editor/src/components/block-lock/menu-item.js index 6a7a1517cf4090..665d9bfbc91a40 100644 --- a/packages/block-editor/src/components/block-lock/menu-item.js +++ b/packages/block-editor/src/components/block-lock/menu-item.js @@ -13,7 +13,7 @@ import useBlockLock from './use-block-lock'; import BlockLockModal from './modal'; export default function BlockLockMenuItem( { clientId } ) { - const { canLock, isLocked } = useBlockLock( clientId, true ); + const { canLock, isLocked } = useBlockLock( clientId ); const [ isModalOpen, toggleModal ] = useReducer( ( isActive ) => ! isActive, diff --git a/packages/block-editor/src/components/block-lock/modal.js b/packages/block-editor/src/components/block-lock/modal.js index 311254d9c3e759..0efb69b5bda0eb 100644 --- a/packages/block-editor/src/components/block-lock/modal.js +++ b/packages/block-editor/src/components/block-lock/modal.js @@ -25,7 +25,7 @@ import { store as blockEditorStore } from '../../store'; export default function BlockLockModal( { clientId, onClose } ) { const [ lock, setLock ] = useState( { move: false, remove: false } ); - const { canEdit, canMove, canRemove } = useBlockLock( clientId, true ); + const { canEdit, canMove, canRemove } = useBlockLock( clientId ); const { isReusable } = useSelect( ( select ) => { const { getBlockName } = select( blockEditorStore ); diff --git a/packages/block-editor/src/components/block-lock/use-block-lock.js b/packages/block-editor/src/components/block-lock/use-block-lock.js index 6d4d7d8e86095f..ced310ebf5404b 100644 --- a/packages/block-editor/src/components/block-lock/use-block-lock.js +++ b/packages/block-editor/src/components/block-lock/use-block-lock.js @@ -11,13 +11,11 @@ import { store as blockEditorStore } from '../../store'; /** * Return details about the block lock status. * - * @param {string} clientId The block client Id. - * @param {boolean} checkParent Optional. The status is derived from the parent `templateLock` - * when the current block's lock state isn't defined. + * @param {string} clientId The block client Id. * * @return {Object} Block lock status */ -export default function useBlockLock( clientId, checkParent = false ) { +export default function useBlockLock( clientId ) { return useSelect( ( select ) => { const { @@ -28,9 +26,7 @@ export default function useBlockLock( clientId, checkParent = false ) { getBlockName, getBlockRootClientId, } = select( blockEditorStore ); - const rootClientId = checkParent - ? getBlockRootClientId( clientId ) - : null; + const rootClientId = getBlockRootClientId( clientId ); const canEdit = canEditBlock( clientId ); const canMove = canMoveBlock( clientId, rootClientId ); @@ -44,6 +40,6 @@ export default function useBlockLock( clientId, checkParent = false ) { isLocked: ! canEdit || ! canMove || ! canRemove, }; }, - [ clientId, checkParent ] + [ clientId ] ); }