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

Hide Zoom Out Inserters when dragging into canvas #65789

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
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
13 changes: 7 additions & 6 deletions packages/block-editor/src/components/block-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function selector( select ) {
getSettings,
__unstableGetEditorMode,
isTyping,
} = select( blockEditorStore );
isDragging,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Private selector.

} = unlock( select( blockEditorStore ) );

const clientId =
getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
Expand All @@ -46,6 +47,7 @@ function selector( select ) {
hasFixedToolbar: getSettings().hasFixedToolbar,
isTyping: isTyping(),
isZoomOutMode: editorMode === 'zoom-out',
isDragging: isDragging(),
};
}

Expand All @@ -63,10 +65,9 @@ export default function BlockTools( {
__unstableContentRef,
...props
} ) {
const { clientId, hasFixedToolbar, isTyping, isZoomOutMode } = useSelect(
selector,
[]
);
const { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =
useSelect( selector, [] );

const isMatch = useShortcutEventMatch();
const {
getBlocksByClientId,
Expand Down Expand Up @@ -241,7 +242,7 @@ export default function BlockTools( {
name="__unstable-block-tools-after"
ref={ blockToolbarAfterRef }
/>
{ isZoomOutMode && (
{ isZoomOutMode && ! isDragging && (
<ZoomOutModeInserters
__unstableContentRef={ __unstableContentRef }
/>
Expand Down
Loading