From 93524793d8806ea51b7008fa438a6d060d6cc6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Wed, 29 Apr 2020 12:41:10 +0200 Subject: [PATCH] Grab clientId from context instead of requiring a prop --- .../src/components/block-navigation/list.js | 10 ++++++---- packages/block-library/src/navigation-link/edit.js | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/block-navigation/list.js b/packages/block-editor/src/components/block-navigation/list.js index f46e43372b315d..f664592916b83f 100644 --- a/packages/block-editor/src/components/block-navigation/list.js +++ b/packages/block-editor/src/components/block-navigation/list.js @@ -7,22 +7,24 @@ import { isNil, map, omitBy } from 'lodash'; * WordPress dependencies */ import { Slot, Fill } from '@wordpress/components'; -import { Children, cloneElement } from '@wordpress/element'; +import { Children, cloneElement, useContext } from '@wordpress/element'; /** * Internal dependencies */ import ListItem from './list-item'; import ButtonBlockAppender from '../button-block-appender'; +import { BlockListBlockContext } from '../block-list/block'; const listItemSlotName = ( blockId ) => `BlockNavigationList-item-${ blockId }`; export const ListItemSlot = ( { blockId, ...props } ) => ( ); -export const ListItemFill = ( { blockId, ...props } ) => ( - -); +export const ListItemFill = ( props ) => { + const { clientId } = useContext( BlockListBlockContext ); + return ; +}; export default function BlockNavigationList( { blocks, diff --git a/packages/block-library/src/navigation-link/edit.js b/packages/block-library/src/navigation-link/edit.js index 44efb40776a294..d9cc963e82d9e3 100644 --- a/packages/block-library/src/navigation-link/edit.js +++ b/packages/block-library/src/navigation-link/edit.js @@ -52,7 +52,6 @@ const noop = () => {}; function NavigationLinkEdit( { attributes, - clientId, hasDescendants, isSelected, isParentOfSelectedBlock, @@ -223,7 +222,7 @@ function NavigationLinkEdit( { /> - +