diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss index fc8c72660ab3e..e3318841e57bc 100644 --- a/packages/base-styles/_z-index.scss +++ b/packages/base-styles/_z-index.scss @@ -82,6 +82,8 @@ $z-layers: ( // .edit-post-header { z-index: 30 } ".components-notice-list": 29, + // Above the block list, under the header. + ".block-editor-block-list__block-popover": 29, // Show snackbars above everything (similar to popovers) ".components-snackbar-list": 100000, diff --git a/packages/block-editor/src/components/block-list/block-contextual-toolbar.js b/packages/block-editor/src/components/block-list/block-contextual-toolbar.js index ce9a1c8578084..9c6ccb22a7fbe 100644 --- a/packages/block-editor/src/components/block-list/block-contextual-toolbar.js +++ b/packages/block-editor/src/components/block-list/block-contextual-toolbar.js @@ -9,15 +9,16 @@ import { __ } from '@wordpress/i18n'; import NavigableToolbar from '../navigable-toolbar'; import { BlockToolbar } from '../'; -function BlockContextualToolbar( { focusOnMount } ) { +function BlockContextualToolbar( { focusOnMount, moverDirection, ...props } ) { return ( - + ); } diff --git a/packages/block-editor/src/components/block-list/block.js b/packages/block-editor/src/components/block-list/block.js index 294cb91e60b9e..216cae25aec4a 100644 --- a/packages/block-editor/src/components/block-list/block.js +++ b/packages/block-editor/src/components/block-list/block.js @@ -22,7 +22,7 @@ import { isUnmodifiedDefaultBlock, getUnregisteredTypeHandlerName, } from '@wordpress/blocks'; -import { KeyboardShortcuts, withFilters } from '@wordpress/components'; +import { KeyboardShortcuts, withFilters, Popover } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { withDispatch, @@ -36,7 +36,6 @@ import { compose, pure, ifCondition } from '@wordpress/compose'; * Internal dependencies */ import BlockEdit from '../block-edit'; -import BlockMover from '../block-mover'; import BlockDropZone from '../block-drop-zone'; import BlockInvalidWarning from './block-invalid-warning'; import BlockCrashWarning from './block-crash-warning'; @@ -44,7 +43,6 @@ import BlockCrashBoundary from './block-crash-boundary'; import BlockHtml from './block-html'; import BlockBreadcrumb from './breadcrumb'; import BlockContextualToolbar from './block-contextual-toolbar'; -import BlockMultiControls from './multi-controls'; import BlockInsertionPoint from './insertion-point'; import IgnoreNestedEvents from '../ignore-nested-events'; import Inserter from '../inserter'; @@ -421,13 +419,6 @@ function BlockListBlock( { ! hasFixedToolbar && isHovered && ! isEmptyDefaultBlock; - // We render block movers and block settings to keep them tabbale even if hidden - const shouldRenderMovers = - ! isNavigationMode && - isSelected && - ! showEmptyBlockSideInserter && - ! isPartOfMultiSelection && - ! isTypingWithinBlock; const shouldShowBreadcrumb = isNavigationMode && isSelected; const shouldShowContextualToolbar = ! isNavigationMode && @@ -479,13 +470,6 @@ function BlockListBlock( { }; } const blockElementId = `block-${ clientId }`; - const blockMover = ( - - ); // We wrap the BlockEdit component in a div that hides it when editing in // HTML mode. This allows us to render all of the ancillary pieces @@ -522,6 +506,9 @@ function BlockListBlock( { // If the toolbar is being shown because of being forced // it should focus the toolbar right after the mount. focusOnMount={ isForcingContextualToolbar.current } + data-type={ name } + data-align={ wrapperProps ? wrapperProps[ 'data-align' ] : undefined } + moverDirection={ moverDirection } /> ); @@ -563,44 +550,48 @@ function BlockListBlock( { clientId={ clientId } rootClientId={ rootClientId } /> } -
- { isFirstMultiSelected && ( - - ) } - { shouldRenderMovers && ( moverDirection === 'vertical' ) && blockMover } - { shouldShowBreadcrumb && ( - - ) } - +
{ ( isCapturingDescendantToolbars ) && ( // A slot made available on all ancestors of the selected Block // to allow child Blocks to render their toolbars into the DOM // of the appropriate parent. ) } - - { ( ! ( hasAncestorCapturingToolbars ) ) && ( shouldShowContextualToolbar || isForcingContextualToolbar.current ) && renderBlockContextualToolbar() } - - { ( hasAncestorCapturingToolbars ) && ( shouldShowContextualToolbar || isForcingContextualToolbar.current ) && ( - // If the parent Block is set to consume toolbars of the child Blocks - // then render the child Block's toolbar into the Slot provided - // by the parent. - - { renderBlockContextualToolbar() } - + { ( shouldShowBreadcrumb || shouldShowContextualToolbar || isForcingContextualToolbar.current ) && ( + + { ! hasAncestorCapturingToolbars && ( shouldShowContextualToolbar || isForcingContextualToolbar.current ) && renderBlockContextualToolbar() } + { hasAncestorCapturingToolbars && ( shouldShowContextualToolbar || isForcingContextualToolbar.current ) && ( + // If the parent Block is set to consume toolbars of the child Blocks + // then render the child Block's toolbar into the Slot provided + // by the parent. + + { renderBlockContextualToolbar() } + + ) } + { shouldShowBreadcrumb && ( + + ) } + ) } - { ! isNavigationMode && ! shouldShowContextualToolbar && @@ -628,7 +619,6 @@ function BlockListBlock( { { isValid && mode === 'html' && ( ) } - { shouldRenderMovers && ( moverDirection === 'horizontal' ) && blockMover } { ! isValid && [ { +const BlockBreadcrumb = forwardRef( ( { clientId, ...props }, ref ) => { const { setNavigationMode } = useDispatch( 'core/block-editor' ); return ( -
+