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

Site Editor: Remove editor specific classes from shell wrapper. #62389

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Site Editor: Remove editor specific classes from shell wrapper.
  • Loading branch information
youknowriad committed Jun 6, 2024
commit c80b5f853d51824b6342802f4cabd8701d6bff4f
12 changes: 0 additions & 12 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,6 @@ $color-control-label-height: 20px;
}
}

.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested the navigation block, it's the only place where this has-fixed-toolbar was used but I didn't find that these styles had any meaningful impact.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's been a while, but I believe that these styles are probably related to when the overlay menu is open. It may be fine to remove if this still tests well, regardless there should be an incoming overlay-to-template-part PR that would most likely make it redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I tried this flow, and didn't notice any difference with or without the style.

@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 @@ -479,12 +473,6 @@ $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
55 changes: 18 additions & 37 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
CommandMenu,
privateApis as commandsPrivateApis,
} from '@wordpress/commands';
import { store as preferencesStore } from '@wordpress/preferences';
import {
privateApis as blockEditorPrivateApis,
store as blockEditorStore,
Expand Down Expand Up @@ -74,38 +73,24 @@ export default function Layout() {

const isMobileViewport = useViewportMatch( 'medium', '<' );
const toggleRef = useRef();
const {
isDistractionFree,
hasFixedToolbar,
hasBlockSelected,
canvasMode,
previousShortcut,
nextShortcut,
} = useSelect( ( select ) => {
const { getAllShortcutKeyCombinations } = select(
keyboardShortcutsStore
);
const { getCanvasMode } = unlock( select( editSiteStore ) );
return {
canvasMode: getCanvasMode(),
previousShortcut: getAllShortcutKeyCombinations(
'core/editor/previous-region'
),
nextShortcut: getAllShortcutKeyCombinations(
'core/editor/next-region'
),
hasFixedToolbar: select( preferencesStore ).get(
'core',
'fixedToolbar'
),
isDistractionFree: select( preferencesStore ).get(
'core',
'distractionFree'
),
hasBlockSelected:
select( blockEditorStore ).getBlockSelectionStart(),
};
}, [] );
const { hasBlockSelected, canvasMode, previousShortcut, nextShortcut } =
useSelect( ( select ) => {
const { getAllShortcutKeyCombinations } = select(
keyboardShortcutsStore
);
const { getCanvasMode } = unlock( select( editSiteStore ) );
return {
canvasMode: getCanvasMode(),
previousShortcut: getAllShortcutKeyCombinations(
'core/editor/previous-region'
),
nextShortcut: getAllShortcutKeyCombinations(
'core/editor/next-region'
),
hasBlockSelected:
select( blockEditorStore ).getBlockSelectionStart(),
};
}, [] );
const navigateRegionsProps = useNavigateRegions( {
previous: previousShortcut,
next: nextShortcut,
Expand Down Expand Up @@ -163,11 +148,7 @@ export default function Layout() {
'edit-site-layout',
navigateRegionsProps.className,
{
'is-distraction-free':
isDistractionFree && canvasMode === 'edit',
'is-full-canvas': canvasMode === 'edit',
'has-fixed-toolbar': hasFixedToolbar,
'is-block-toolbar-visible': hasBlockSelected,
}
) }
>
Expand Down
7 changes: 2 additions & 5 deletions packages/editor/src/components/post-title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ import usePostTitle from './use-post-title';
import PostTypeSupportCheck from '../post-type-support-check';

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

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

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

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

Expand All @@ -61,7 +59,6 @@ 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
Loading