Skip to content

Commit

Permalink
Allow all blocks to be edited
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave authored and scruffian committed Jan 31, 2023
1 parent bdb051d commit f296b1f
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import useBlockDisplayTitle from '../block-title/use-block-display-title';
import ListViewExpander from './expander';
import { useBlockLock } from '../block-lock';

const noop = () => {};

function ListViewBlockSelectButton(
{
className,
Expand All @@ -49,8 +47,6 @@ function ListViewBlockSelectButton(
} );
const { isLocked } = useBlockLock( clientId );

const isEditable = !! block && block.name !== 'core/page-list-item';

// The `href` attribute triggers the browser's native HTML drag operations.
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
Expand All @@ -61,10 +57,7 @@ function ListViewBlockSelectButton(
};

function onKeyDownHandler( event ) {
if (
( isEditable && event.keyCode === ENTER ) ||
event.keyCode === SPACE
) {
if ( event.keyCode === ENTER || event.keyCode === SPACE ) {
onClick( event );
}
}
Expand All @@ -84,17 +77,17 @@ function ListViewBlockSelectButton(
'block-editor-list-view-block-select-button',
className
) }
onClick={ isEditable ? onClick : noop }
onClick={ onClick }
onKeyDown={ onKeyDownHandler }
ref={ ref }
tabIndex={ tabIndex }
onFocus={ onFocus }
onDragStart={ onDragStartHandler }
onDragEnd={ onDragEnd }
draggable={ draggable }
href={ isEditable ? `#block-${ clientId }` : undefined }
href={ `#block-${ clientId }` }
aria-hidden={ true }
title={ isEditable ? editAriaLabel : undefined }
title={ editAriaLabel }
>
<ListViewExpander onClick={ onToggleExpanded } />
<BlockIcon
Expand Down

0 comments on commit f296b1f

Please sign in to comment.