Skip to content

Commit

Permalink
Add a new boolean 'header' setting so that it can be disabled when no…
Browse files Browse the repository at this point in the history
…t needed (#180)

* Add a new boolean 'header' setting so that it can be disabled when not needed

* Update changelog

Co-authored-by: Matías Surdi <matias.emanuel.surdi@automattic.om>
  • Loading branch information
msurdi and Matías Surdi committed Aug 4, 2022
1 parent be6113c commit 7d857b4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.17.0] - 2022-08-04
- Add a new boolean 'header' setting so that it can be disabled when not neede

## [2.16.0] - 2022-06-30
- Fixed the deprecated use of BlockNavigationDropdown
- Remove some old CSS adding focus borders to some blocks
Expand Down
13 changes: 6 additions & 7 deletions src/components/block-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function BlockEditor( props ) {
const isMobileViewport = useViewportMatch( 'medium', '<' );
const inspectorInSidebar = settings?.iso?.sidebar?.inspector || false;
const inserterInSidebar = settings?.iso?.sidebar?.inserter || false;
const showHeader = settings?.iso?.header ?? true;
const showFooter = settings?.iso?.footer || false;
const {
sidebarIsOpened,
Expand Down Expand Up @@ -141,6 +142,10 @@ function BlockEditor( props ) {
};
}, [ isFullscreenActive ] );

const header = showHeader ? (
<BlockEditorToolbar editorMode={ editorMode } settings={ settings } renderMoreMenu={ renderMoreMenu } />
) : null;

return (
<>
<SettingsSidebar documentInspector={ settings?.iso?.toolbar?.documentInspector ?? false } />
Expand All @@ -149,13 +154,7 @@ function BlockEditor( props ) {
<InterfaceSkeleton
className={ className }
labels={ interfaceLabels }
header={
<BlockEditorToolbar
editorMode={ editorMode }
settings={ settings }
renderMoreMenu={ renderMoreMenu }
/>
}
header={ header }
secondarySidebar={ secondarySidebar() }
sidebar={
( ! isMobileViewport || sidebarIsOpened ) &&
Expand Down
2 changes: 2 additions & 0 deletions src/components/default-settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export default function applyDefaultSettings( settings ) {
...( iso?.toolbar ?? {} ),
},

header: iso?.header ?? true,

sidebar: {
inserter: false,
inspector: false,
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import './style.scss';
* @property {string[]} [disallowEmbed] - List of embed names to remove
* @property {object[]} [customStores] - Array of custom stores
* @property {boolean} [footer] - Show footer component
* @property {boolean} [header] - Show header component
* @property {ToolbarSettings} [toolbar] - Toolbar settings
* @property {MoreMenuSettings|false} [moreMenu] - More menu settings, or false to disable
* @property {{title: string, url: string}[]} [linkMenu] - Link menu settings
Expand Down

0 comments on commit 7d857b4

Please sign in to comment.