Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try showing move controls only for the selected block. #17315

Merged
merged 2 commits into from
Sep 16, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import BlockInsertionPoint from './insertion-point';
import IgnoreNestedEvents from '../ignore-nested-events';
import InserterWithShortcuts from '../inserter-with-shortcuts';
import Inserter from '../inserter';
import useHoveredArea from './hover-area';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hook is not used anymore, right? Can we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, good call! Removed in 40fbc51

import { isInsideRootBlock } from '../../utils/dom';
import useMovingAnimation from './moving-animation';

Expand Down Expand Up @@ -81,7 +80,6 @@ function BlockListBlock( {
isParentOfSelectedBlock,
isDraggable,
isSelectionEnabled,
isRTL,
className,
name,
isValid,
Expand Down Expand Up @@ -117,9 +115,6 @@ function BlockListBlock( {
// Reference to the block edit node
const blockNodeRef = useRef();

// Hovered area of the block
const hoverArea = useHoveredArea( wrapper );

const breadcrumb = useRef();

// Keep track of touchstart to disable hover on iOS
Expand Down Expand Up @@ -404,7 +399,7 @@ function BlockListBlock( {
// We render block movers and block settings to keep them tabbale even if hidden
const shouldRenderMovers =
! isNavigationMode &&
( isSelected || hoverArea === ( isRTL ? 'right' : 'left' ) ) &&
isSelected &&
! showEmptyBlockSideInserter &&
! isPartOfMultiSelection &&
! isTypingWithinBlock;
Expand Down Expand Up @@ -523,7 +518,7 @@ function BlockListBlock( {
<BlockMover
clientIds={ clientId }
blockElementId={ blockElementId }
isHidden={ ! ( isHovered || isSelected ) || hoverArea !== ( isRTL ? 'right' : 'left' ) }
isHidden={ ! isSelected }
isDraggable={
isDraggable !== false &&
( ! isPartOfMultiSelection && isMovable )
Expand Down