Skip to content

Commit

Permalink
Revert "Site Editor: Remove has-fixed-toolbar class"
Browse files Browse the repository at this point in the history
This reverts commit 4dd71d3.
  • Loading branch information
youknowriad committed Jun 6, 2024
1 parent 4dd71d3 commit 3bd6799
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
12 changes: 12 additions & 0 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ $color-control-label-height: 20px;
}
}

.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
@include break-medium() {
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width;
}
}

.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,
.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open {
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width;
Expand All @@ -473,6 +479,12 @@ $color-control-label-height: 20px;
}
}

.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
@include break-medium() {
top: $header-height + $block-toolbar-height + $border-width;
}
}

.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,
.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open {
top: $header-height + $block-toolbar-height + $border-width;
Expand Down
6 changes: 6 additions & 0 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default function Layout() {
const toggleRef = useRef();
const {
isDistractionFree,
hasFixedToolbar,
hasBlockSelected,
canvasMode,
previousShortcut,
Expand All @@ -93,6 +94,10 @@ export default function Layout() {
nextShortcut: getAllShortcutKeyCombinations(
'core/editor/next-region'
),
hasFixedToolbar: select( preferencesStore ).get(
'core',
'fixedToolbar'
),
isDistractionFree: select( preferencesStore ).get(
'core',
'distractionFree'
Expand Down Expand Up @@ -161,6 +166,7 @@ export default function Layout() {
'is-distraction-free':
isDistractionFree && canvasMode === 'edit',
'is-full-canvas': canvasMode === 'edit',
'has-fixed-toolbar': hasFixedToolbar,
'is-block-toolbar-visible': hasBlockSelected,
}
) }
Expand Down
7 changes: 5 additions & 2 deletions packages/editor/src/components/post-title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ import usePostTitle from './use-post-title';
import PostTypeSupportCheck from '../post-type-support-check';

function PostTitle( _, forwardedRef ) {
const { placeholder } = useSelect( ( select ) => {
const { placeholder, hasFixedToolbar } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
const { titlePlaceholder } = getSettings();
const { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =
getSettings();

return {
placeholder: titlePlaceholder,
hasFixedToolbar: _hasFixedToolbar,
};
}, [] );

Expand Down Expand Up @@ -184,6 +186,7 @@ function PostTitle( _, forwardedRef ) {
// This same block is used in both the visual and the code editor.
const className = clsx( DEFAULT_CLASSNAMES, {
'is-selected': isSelected,
'has-fixed-toolbar': hasFixedToolbar,
} );

return (
Expand Down
7 changes: 5 additions & 2 deletions packages/editor/src/components/post-title/post-title-raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ import usePostTitle from './use-post-title';
* @return {Component} The rendered component.
*/
function PostTitleRaw( _, forwardedRef ) {
const { placeholder } = useSelect( ( select ) => {
const { placeholder, hasFixedToolbar } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
const { titlePlaceholder } = getSettings();
const { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =
getSettings();

return {
placeholder: titlePlaceholder,
hasFixedToolbar: _hasFixedToolbar,
};
}, [] );

Expand All @@ -59,6 +61,7 @@ function PostTitleRaw( _, forwardedRef ) {
// This same block is used in both the visual and the code editor.
const className = clsx( DEFAULT_CLASSNAMES, {
'is-selected': isSelected,
'has-fixed-toolbar': hasFixedToolbar,
'is-raw-text': true,
} );

Expand Down

1 comment on commit 3bd6799

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 3bd6799.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9408403646
📝 Reported issues:

Please sign in to comment.