Skip to content

Commit

Permalink
Remove code related to showing/hiding inserters on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Sep 30, 2024
1 parent 4371db5 commit 2812479
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
8 changes: 0 additions & 8 deletions packages/block-editor/src/components/block-tools/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,3 @@
border: none;
}
}

.block-editor-block-tools__zoom-out-mode-inserter-button {
visibility: hidden;

&.is-visible {
visibility: visible;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,21 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
import { Button } from '@wordpress/components';
import { plus } from '@wordpress/icons';
import { _x } from '@wordpress/i18n';

function ZoomOutModeInserterButton( { isVisible, onClick } ) {
const [
zoomOutModeInserterButtonHovered,
setZoomOutModeInserterButtonHovered,
] = useState( false );

function ZoomOutModeInserterButton( { onClick } ) {
return (
<Button
variant="primary"
icon={ plus }
size="compact"
className={ clsx(
'block-editor-button-pattern-inserter__button',
'block-editor-block-tools__zoom-out-mode-inserter-button',
{
'is-visible': isVisible || zoomOutModeInserterButtonHovered,
}
'block-editor-block-tools__zoom-out-mode-inserter-button'
) }
onClick={ onClick }
onMouseOver={ () => {
setZoomOutModeInserterButtonHovered( true );
} }
onMouseOut={ () => {
setZoomOutModeInserterButtonHovered( false );
} }
label={ _x(
'Add pattern',
'Generic label for pattern inserter button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function ZoomOutModeInserters() {
};
}, [] );

if ( ! isReady ) {
if ( ! isReady || ! hasSelection ) {
return null;
}

Expand All @@ -72,19 +72,17 @@ function ZoomOutModeInserters() {
const nextClientId = blockOrder[ index ];

const isSelected =
hasSelection &&
( selectedBlockClientId === previousClientId ||
selectedBlockClientId === nextClientId );
selectedBlockClientId === previousClientId ||
selectedBlockClientId === nextClientId;

return (
<BlockPopoverInbetween
key={ index }
previousClientId={ previousClientId }
nextClientId={ nextClientId }
>
{ ! shouldRenderInsertionPoint && (
{ ! shouldRenderInsertionPoint && isSelected && (
<ZoomOutModeInserterButton
isVisible={ isSelected }
onClick={ () => {
setInserterIsOpened( {
rootClientId: sectionRootClientId,
Expand Down

0 comments on commit 2812479

Please sign in to comment.