diff --git a/packages/edit-post/src/components/header/header-toolbar/style.scss b/packages/edit-post/src/components/header/header-toolbar/style.scss
index e2c9241c4dec3..650d0d924ab30 100644
--- a/packages/edit-post/src/components/header/header-toolbar/style.scss
+++ b/packages/edit-post/src/components/header/header-toolbar/style.scss
@@ -23,6 +23,34 @@
display: flex;
}
}
+ &.show-icon-labels {
+ button[aria-label] {
+ display: inline-flex;
+ flex-wrap: nowrap;
+ &::after {
+ content: attr(aria-label);
+ display: block;
+ font-size: 12px;
+ margin-left: 5px;
+ }
+ &.is-primary {
+ &::after {
+ padding-right: 8px;
+ }
+ }
+ }
+ [aria-orientation=vertical] & {
+ display: block;
+ }
+ > div, > button {
+ [aria-orientation=vertical] & {
+ display: block;
+ button {
+ width: 100%;
+ }
+ }
+ }
+ }
}
// Block toolbar when fixed to the top of the screen.
@@ -75,7 +103,7 @@
.block-editor-block-toolbar .components-toolbar-group,
.block-editor-block-toolbar .components-toolbar {
- $top-toolbar-padding: ($header-height - $grid-unit-60) / 2;
+ $top-toolbar-padding: ( $header-height - $grid-unit-60 ) / 2;
height: $header-height;
padding: $top-toolbar-padding 0;
}
@@ -86,7 +114,6 @@
margin-right: $grid-unit-10;
// Special dimensions for this button.
min-width: 32px;
- width: 32px;
height: 32px;
padding: 0;
}
diff --git a/packages/edit-post/src/components/header/index.js b/packages/edit-post/src/components/header/index.js
index 8210e19ab0b29..7d40e0c69a2e6 100644
--- a/packages/edit-post/src/components/header/index.js
+++ b/packages/edit-post/src/components/header/index.js
@@ -2,10 +2,11 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { Button } from '@wordpress/components';
+import { Button, Dropdown } from '@wordpress/components';
import { PostSavedState, PostPreviewButton } from '@wordpress/editor';
import { useSelect, useDispatch } from '@wordpress/data';
-import { cog } from '@wordpress/icons';
+import { useViewportMatch } from '@wordpress/compose';
+import { cog, moreHorizontal } from '@wordpress/icons';
import {
PinnedItems,
__experimentalMainDashboardButton as MainDashboardButton,
@@ -32,6 +33,7 @@ function Header( {
isPublishSidebarOpened,
isSaving,
getBlockSelectionStart,
+ showIconLabel,
} = useSelect(
( select ) => ( {
shortcut: select(
@@ -48,6 +50,9 @@ function Header( {
getBlockSelectionStart: select( 'core/block-editor' )
.getBlockSelectionStart,
isPostSaveable: select( 'core/editor' ).isEditedPostSaveable(),
+ showIconLabel: select( 'core/edit-post' ).isFeatureActive(
+ 'showIconLabels'
+ ),
deviceType: select(
'core/edit-post'
).__experimentalGetPreviewDeviceType(),
@@ -58,6 +63,8 @@ function Header( {
'core/edit-post'
);
+ const isLargeViewport = useViewportMatch( 'large' );
+
const toggleGeneralSidebar = isEditorSidebarOpened
? closeGeneralSidebar
: () =>
@@ -67,6 +74,46 @@ function Header( {
: 'edit-post/document'
);
+ const headerSettings = (
+
+ { ! isPublishSidebarOpened && (
+ // This button isn't completely hidden by the publish sidebar.
+ // We can't hide the whole toolbar when the publish sidebar is open because
+ // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
+ // We track that DOM node to return focus to the PostPublishButtonOrToggle
+ // when the publish sidebar has been closed.
+
+ ) }
+
+
+
+
+
+
+
+ );
+
return (
@@ -78,41 +125,23 @@ function Header( {
isInserterOpen={ isInserterOpen }
/>
-
- { ! isPublishSidebarOpened && (
- // This button isn't completely hidden by the publish sidebar.
- // We can't hide the whole toolbar when the publish sidebar is open because
- // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
- // We track that DOM node to return focus to the PostPublishButtonOrToggle
- // when the publish sidebar has been closed.
-
- ) }
-
-
-
-
(
+
+ ) }
+ renderContent={ () => headerSettings }
/>
-
-
-
+ ) }
);
}
diff --git a/packages/edit-post/src/components/header/more-menu/index.js b/packages/edit-post/src/components/header/more-menu/index.js
index 9a0b39751fb82..383be35f6f924 100644
--- a/packages/edit-post/src/components/header/more-menu/index.js
+++ b/packages/edit-post/src/components/header/more-menu/index.js
@@ -1,9 +1,15 @@
+/**
+ * External dependencies
+ */
+import classnames from 'classnames';
+
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { DropdownMenu, MenuGroup } from '@wordpress/components';
import { moreVertical } from '@wordpress/icons';
+import { useLayoutEffect, useRef, useState } from '@wordpress/element';
/**
* Internal dependencies
@@ -14,34 +20,62 @@ import ToolsMoreMenuGroup from '../tools-more-menu-group';
import OptionsMenuItem from '../options-menu-item';
import WritingMenu from '../writing-menu';
-const POPOVER_PROPS = {
- className: 'edit-post-more-menu__content',
- position: 'bottom left',
-};
const TOGGLE_PROPS = {
tooltipPosition: 'bottom',
};
-const MoreMenu = () => (
-