Skip to content

Commit

Permalink
Revert placeholder component, update showBlock logic so that selected…
Browse files Browse the repository at this point in the history
… blocks are rendered as real ListViewBlock components
  • Loading branch information
andrewserong committed Feb 14, 2023
1 parent 0e64fd1 commit 1e6580a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 48 deletions.
11 changes: 4 additions & 7 deletions packages/block-editor/src/components/list-view/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { AsyncModeProvider, useSelect } from '@wordpress/data';
* Internal dependencies
*/
import ListViewBlock from './block';
import ListViewLeafPlaceholder from './leaf-placeholder';
import { useListViewContext } from './context';
import { isClientIdSelected } from './utils';
import { store as blockEditorStore } from '../../store';
Expand Down Expand Up @@ -156,8 +155,6 @@ function ListViewBranch( props ) {

const isDragged = !! draggedClientIds?.includes( clientId );

const showBlock = isDragged || blockInView;

// Make updates to the selected or dragged blocks synchronous,
// but asynchronous for any other block.
const isSelected = isClientIdSelected(
Expand All @@ -166,6 +163,7 @@ function ListViewBranch( props ) {
);
const isSelectedBranch =
isBranchSelected || ( isSelected && hasNestedBlocks );
const showBlock = isDragged || blockInView || isSelected;
return (
<AsyncModeProvider key={ clientId } value={ ! isSelected }>
{ showBlock && (
Expand All @@ -188,10 +186,9 @@ function ListViewBranch( props ) {
/>
) }
{ ! showBlock && (
<ListViewLeafPlaceholder
isSelected={ isSelected }
selectedClientIds={ selectedClientIds }
/>
<tr>
<td className="block-editor-list-view-placeholder" />
</tr>
) }
{ hasNestedBlocks && shouldExpand && ! isDragged && (
<ListViewBranch
Expand Down
41 changes: 0 additions & 41 deletions packages/block-editor/src/components/list-view/leaf-placeholder.js

This file was deleted.

0 comments on commit 1e6580a

Please sign in to comment.