Skip to content

Commit

Permalink
Site Editor: Remove editor specific classes from shell wrapper. (#62389)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
  • Loading branch information
4 people authored Jun 11, 2024
1 parent 48d9364 commit 3a20fb0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 59 deletions.
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 {
@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

0 comments on commit 3a20fb0

Please sign in to comment.