Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@
border: $border-width solid $dark-gray-primary;
border-radius: $radius-block-ui;
background-color: $white;

.block-editor-block-toolbar .components-toolbar {
border-right-color: $dark-gray-primary;
}
}


Expand Down
14 changes: 7 additions & 7 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function BlockToolbar( { hideDragHandle } ) {
isBlockValid,
getBlockRootClientId,
getBlockListSettings,
getSettings,
} = select( 'core/block-editor' );
const selectedBlockClientIds = getSelectedBlockClientIds();
const blockRootClientId = getBlockRootClientId(
Expand All @@ -44,9 +45,7 @@ export default function BlockToolbar( { hideDragHandle } ) {

return {
blockClientIds: selectedBlockClientIds,
hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive(
'fixedToolbar'
),
hasFixedToolbar: getSettings().hasFixedToolbar,
rootClientId: blockRootClientId,
isValid:
selectedBlockClientIds.length === 1
Expand All @@ -68,10 +67,11 @@ export default function BlockToolbar( { hideDragHandle } ) {
gestures: showMoversGestures,
} = useShowMoversGestures( { ref: nodeRef } );

const displayHeaderToolbar =
useViewportMatch( 'medium', '<' ) || hasFixedToolbar;

const shouldShowMovers =
useViewportMatch( 'medium', '<' ) ||
hasFixedToolbar ||
( showMovers && hasMovers );
displayHeaderToolbar || ( showMovers && hasMovers );

if ( blockClientIds.length === 0 ) {
return null;
Expand All @@ -87,7 +87,7 @@ export default function BlockToolbar( { hideDragHandle } ) {

const classes = classnames(
'block-editor-block-toolbar',
! hasFixedToolbar && 'has-responsive-movers'
! displayHeaderToolbar && 'has-responsive-movers'
);

return (
Expand Down
14 changes: 0 additions & 14 deletions packages/block-editor/src/components/block-toolbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,13 @@
border: 0;

// Add a border after item groups to show as separator in the block toolbar.
// Also, on Mobile the toolbar is docked to the top of the screen.
border-right: $border-width solid $light-gray-500;
@include break-medium() {
border-right: $border-width solid $dark-gray-primary;
}
}

> :last-child,
> :last-child .components-toolbar {
border-right: none;
}

// Add a border and adjust the color for Top Toolbar mode.
.has-fixed-toolbar & {
.block-editor-block-mover .components-toolbar {
border-left: $border-width solid $light-gray-500;
}
.components-toolbar {
border-color: $light-gray-500;
}
}
}

.block-editor-block-toolbar,
Expand Down
3 changes: 2 additions & 1 deletion packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
@import "./components/block-settings-menu/style.scss";
@import "./components/block-styles/style.scss";
@import "./components/block-switcher/style.scss";
@import "./components/block-toolbar/style.scss";
@import "./components/block-types-list/style.scss";
@import "./components/block-variation-picker/style.scss";
@import "./components/button-block-appender/style.scss";
Expand Down Expand Up @@ -52,5 +51,7 @@

// Styles for components that are used outside of the editing canvas go here:

@import "./components/block-toolbar/style.scss";
@import "./components/editor-skeleton/style.scss";
@import "./components/inserter/style.scss";

17 changes: 14 additions & 3 deletions packages/edit-post/src/components/header/header-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ import { EditorHistoryRedo, EditorHistoryUndo } from '@wordpress/editor';
const inserterToggleProps = { isPrimary: true };

function HeaderToolbar() {
const { hasFixedToolbar, showInserter, isTextModeEnabled } = useSelect(
const {
hasFixedToolbar,
showInserter,
isTextModeEnabled,
previewDeviceType,
} = useSelect(
( select ) => ( {
hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive(
'fixedToolbar'
Expand All @@ -27,12 +32,18 @@ function HeaderToolbar() {
select( 'core/editor' ).getEditorSettings().richEditingEnabled,
isTextModeEnabled:
select( 'core/edit-post' ).getEditorMode() === 'text',
previewDeviceType: select(
'core/block-editor'
).getPreviewDeviceType(),
} ),
[]
);
const isLargeViewport = useViewportMatch( 'medium' );

const toolbarAriaLabel = hasFixedToolbar
const displayBlockToolbar =
! isLargeViewport || previewDeviceType !== 'Desktop' || hasFixedToolbar;

const toolbarAriaLabel = displayBlockToolbar
? /* translators: accessibility text for the editor toolbar when Top Toolbar is on */
__( 'Document and block tools' )
: /* translators: accessibility text for the editor toolbar when Top Toolbar is off */
Expand All @@ -53,7 +64,7 @@ function HeaderToolbar() {
<EditorHistoryUndo />
<EditorHistoryRedo />
<BlockNavigationDropdown isDisabled={ isTextModeEnabled } />
{ ( hasFixedToolbar || ! isLargeViewport ) && (
{ displayBlockToolbar && (
<div className="edit-post-header-toolbar__block-toolbar">
<BlockToolbar hideDragHandle />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
right: auto;
}

.block-editor-block-toolbar {
border-left: $border-width solid $light-gray-500;
}

.block-editor-block-toolbar .components-toolbar {
$top-toolbar-padding: ($header-height - $grid-unit-60) / 2;
height: $header-height;
Expand Down
5 changes: 4 additions & 1 deletion packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ export default compose( [
const { isFeatureActive, getPreference } = select( 'core/edit-post' );
const { getEntityRecord } = select( 'core' );
const { getBlockTypes } = select( 'core/blocks' );
const { getPreviewDeviceType } = select( 'core/block-editor' );

return {
showInserterHelpPanel: isFeatureActive( 'showInserterHelpPanel' ),
hasFixedToolbar: isFeatureActive( 'fixedToolbar' ),
hasFixedToolbar:
isFeatureActive( 'fixedToolbar' ) ||
getPreviewDeviceType() !== 'Desktop',
focusMode: isFeatureActive( 'focusMode' ),
post: getEntityRecord( 'postType', postType, postId ),
preferredStyleVariations: getPreference(
Expand Down
5 changes: 4 additions & 1 deletion packages/edit-post/src/editor.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,12 @@ export default compose( [
'core/edit-post'
);
const { getBlockTypes } = select( 'core/blocks' );
const { getPreviewDeviceType } = select( 'core/block-editor' );

return {
hasFixedToolbar: isFeatureActive( 'fixedToolbar' ),
hasFixedToolbar:
isFeatureActive( 'fixedToolbar' ) ||
getPreviewDeviceType() !== 'Desktop',
focusMode: isFeatureActive( 'focusMode' ),
mode: getEditorMode(),
hiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),
Expand Down