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

Fullscreen Mode: Change W button to toggle wp-admin sidebar #22191

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0e1898f
Revert "Revert "Fullscreen Mode: Change the "Back" button to toggle t…
Apr 30, 2020
63c81b2
Moving the adminMenuToggle outside of the skeleton. This could be a b…
shaunandrews May 7, 2020
900e970
Fixing two Safari issues related to the #adminmenuback element
shaunandrews May 8, 2020
7dfd0b0
Hide the body's scrollbar until the admin menu is shown.
shaunandrews May 12, 2020
6e04db8
Adding a new color to the base-styles for the sidebar color.
shaunandrews May 13, 2020
b9e261b
Adding a sidebarText value to the base-styles package.
shaunandrews May 13, 2020
554847e
Implementing the color schemes, and simplifying the focus state.
shaunandrews May 13, 2020
cc0634b
Moving __experimentalMainDashboardButton from the skeleton into the l…
shaunandrews May 15, 2020
a31863e
Change focus outline to use variable and simplier shadow.
shaunandrews May 15, 2020
3761c30
Hide the submenus without affecting the height of the sidebar.
shaunandrews May 15, 2020
d707c01
First pass at adding the adminMenuToggle to the site editor.
shaunandrews May 15, 2020
aa94e0f
Opens admin/post page in new tab if middle click or ctrl/cmd + click
May 19, 2020
e703d2f
Jump focus from WP-Admin menu back to Gutenberg toolbar on shift+tab
May 19, 2020
79eb3ad
Update AdminMenuToggle to display show/hide based on menu open state
May 19, 2020
ef2c284
Fix AdminMenuToggle link to post.php
May 20, 2020
69825e4
Fix ref to buttonNode for click events
May 20, 2020
744e547
Merge branch 'master' into try/fullscreen-sidebar-toggle-2
Jun 1, 2020
f35569a
Update show/hide navigation label
Jun 2, 2020
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
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions packages/base-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ exports.adminColorSchemes = {
toggle: '#11a0d2',
button: '#007cba',
outlines: '#007cba',
sidebar: '#23282d',
sidebarText: '#eee',
},
themes: {
'admin-color-light': {
Expand All @@ -13,48 +15,62 @@ exports.adminColorSchemes = {
toggle: '#11a0d2',
button: '#0085ba',
outlines: '#007cba',
sidebar: '#e5e5e5',
sidebarText: '#333',
},
'admin-color-blue': {
primary: '#82b4cb',
secondary: '#d9ab59',
toggle: '#82b4cb',
button: '#d9ab59',
outlines: '#417e9B',
sidebar: '#52accc',
sidebarText: '#fff',
},
'admin-color-coffee': {
primary: '#c2a68c',
secondary: '#9fa47b',
toggle: '#c2a68c',
button: '#c2a68c',
outlines: '#59524c',
sidebar: '#59524c',
sidebarText: '#fff',
},
'admin-color-ectoplasm': {
primary: '#a7b656',
secondary: '#c77430',
toggle: '#a7b656',
button: '#a7b656',
outlines: '#523f6d',
sidebar: '#523f6d',
sidebarText: '#fff',
},
'admin-color-midnight': {
primary: '#e14d43',
secondary: '#77a6b9',
toggle: '#77a6b9',
button: '#e14d43',
outlines: '#497b8d',
sidebar: '#363b3f',
sidebarText: '#fff',
},
'admin-color-ocean': {
primary: '#a3b9a2',
secondary: '#a89d8a',
toggle: '#a3b9a2',
button: '#a3b9a2',
outlines: '#5e7d5e',
sidebar: '#738e96',
sidebarText: '#fff',
},
'admin-color-sunrise': {
primary: '#d1864a',
secondary: '#c8b03c',
toggle: '#c8b03c',
button: '#d1864a',
outlines: '#837425',
sidebar: '#cf4944',
sidebarText: '#fff',
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,5 @@ describe( 'Fullscreen Mode', () => {
} );

expect( isFullscreenEnabled ).toBe( true );

const fullscreenCloseButton = await page.$(
'.edit-post-fullscreen-mode-close'
);

expect( fullscreenCloseButton ).not.toBeNull();
} );
} );

This file was deleted.

This file was deleted.

55 changes: 45 additions & 10 deletions packages/edit-post/src/components/header/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { PostSavedState, PostPreviewButton } from '@wordpress/editor';
import { useSelect } from '@wordpress/data';
import {
PinnedItems,
__experimentalMainDashboardButton as MainDashboardButton,
} from '@wordpress/interface';
import { useSelect, useDispatch } from '@wordpress/data';
import { cog } from '@wordpress/icons';
import { PinnedItems } from '@wordpress/interface';

/**
* Internal dependencies
*/
import FullscreenModeClose from './fullscreen-mode-close';
import HeaderToolbar from './header-toolbar';
import MoreMenu from './more-menu';
import PostPublishButtonOrToggle from './post-publish-button-or-toggle';
Expand All @@ -22,22 +21,50 @@ function Header( {
isInserterOpen,
setEntitiesSavedStatesCallback,
} ) {
const { hasActiveMetaboxes, isPublishSidebarOpened, isSaving } = useSelect(
const {
shortcut,
hasActiveMetaboxes,
isEditorSidebarOpened,
isPublishSidebarOpened,
isSaving,
getBlockSelectionStart,
} = useSelect(
( select ) => ( {
shortcut: select(
'core/keyboard-shortcuts'
).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),
hasActiveMetaboxes: select( 'core/edit-post' ).hasMetaBoxes(),
isEditorSidebarOpened: select(
'core/edit-post'
).isEditorSidebarOpened(),
isPublishSidebarOpened: select(
'core/edit-post'
).isPublishSidebarOpened(),
isSaving: select( 'core/edit-post' ).isSavingMetaBoxes(),
getBlockSelectionStart: select( 'core/block-editor' )
.getBlockSelectionStart,
isPostSaveable: select( 'core/editor' ).isEditedPostSaveable(),
deviceType: select(
'core/edit-post'
).__experimentalGetPreviewDeviceType(),
} ),
[]
);
const { openGeneralSidebar, closeGeneralSidebar } = useDispatch(
'core/edit-post'
);

const toggleGeneralSidebar = isEditorSidebarOpened
? closeGeneralSidebar
: () =>
openGeneralSidebar(
getBlockSelectionStart()
? 'edit-post/block'
: 'edit-post/document'
);

return (
<div className="edit-post-header">
<MainDashboardButton.Slot>
<FullscreenModeClose />
</MainDashboardButton.Slot>
<div className="edit-post-header__toolbar">
<HeaderToolbar
onToggleInserter={ onToggleInserter }
Expand Down Expand Up @@ -68,6 +95,14 @@ function Header( {
setEntitiesSavedStatesCallback
}
/>
<Button
icon={ cog }
label={ __( 'Settings' ) }
onClick={ toggleGeneralSidebar }
isPressed={ isEditorSidebarOpened }
aria-expanded={ isEditorSidebarOpened }
shortcut={ shortcut }
/>
<PinnedItems.Slot scope="core/edit-post" />
<MoreMenu />
</div>
Expand Down
5 changes: 5 additions & 0 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
ComplementaryArea,
FullscreenMode,
InterfaceSkeleton,
AdminMenuToggle,
__experimentalMainDashboardButton as MainDashboardButton,
} from '@wordpress/interface';
import { useState, useEffect, useCallback } from '@wordpress/element';
import { close } from '@wordpress/icons';
Expand Down Expand Up @@ -140,6 +142,9 @@ function Layout() {
return (
<>
<FullscreenMode isActive={ isFullscreenActive } />
<MainDashboardButton.Slot>
{ isFullscreenActive && <AdminMenuToggle /> }
</MainDashboardButton.Slot>
<BrowserURL />
<UnsavedChangesWarning />
<AutosaveMonitor />
Expand Down
1 change: 0 additions & 1 deletion packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,3 @@ export { default as PluginPostStatusInfo } from './components/sidebar/plugin-pos
export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';
1 change: 0 additions & 1 deletion packages/edit-post/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ $footer-height: $button-size-small;
@import "../../interface/src/style.scss";

@import "./components/header/style.scss";
@import "./components/header/fullscreen-mode-close/style.scss";
@import "./components/header/header-toolbar/style.scss";
@import "./components/header/more-menu/style.scss";
@import "./components/keyboard-shortcut-help-modal/style.scss";
Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions packages/edit-site/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '@wordpress/data';
import {
PinnedItems,
AdminMenuToggle,
__experimentalMainDashboardButton as MainDashboardButton,
} from '@wordpress/interface';
import { _x } from '@wordpress/i18n';
Expand All @@ -33,7 +34,6 @@ import TemplateSwitcher from '../template-switcher';
import SaveButton from '../save-button';
import UndoButton from './undo-redo/undo';
import RedoButton from './undo-redo/redo';
import FullscreenModeClose from './fullscreen-mode-close';

/**
* Browser dependencies
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function Header( {
return (
<div className="edit-site-header">
<MainDashboardButton.Slot>
<FullscreenModeClose />
<AdminMenuToggle />
</MainDashboardButton.Slot>
<div className="edit-site-header__toolbar">
<Button
Expand Down
2 changes: 0 additions & 2 deletions packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,3 @@ export function initialize( id, settings ) {
settings.__experimentalFetchLinkSuggestions = fetchLinkSuggestions;
render( <Editor settings={ settings } />, document.getElementById( id ) );
}

export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';
1 change: 0 additions & 1 deletion packages/edit-site/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

@import "./components/block-editor/style.scss";
@import "./components/header/style.scss";
@import "./components/header/fullscreen-mode-close/style.scss";
@import "./components/header/more-menu/style.scss";
@import "./components/notices/style.scss";
@import "./components/page-switcher/style.scss";
Expand Down
Loading