From 3a20fb048ffa8500d3359c9e0a8d99fd2a514a72 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 11 Jun 2024 09:05:07 +0200 Subject: [PATCH] Site Editor: Remove editor specific classes from shell wrapper. (#62389) Co-authored-by: youknowriad Co-authored-by: jasmussen Co-authored-by: ntsekouras --- .../block-library/src/navigation/editor.scss | 12 ---- .../edit-site/src/components/layout/index.js | 55 ++++++------------- .../editor/src/components/post-title/index.js | 7 +-- .../components/post-title/post-title-raw.js | 7 +-- 4 files changed, 22 insertions(+), 59 deletions(-) diff --git a/packages/block-library/src/navigation/editor.scss b/packages/block-library/src/navigation/editor.scss index 9f22262c53bd95..c62cbe9614c916 100644 --- a/packages/block-library/src/navigation/editor.scss +++ b/packages/block-library/src/navigation/editor.scss @@ -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; @@ -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; diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index 58de32d4b46878..45a2b79adca65c 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -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, @@ -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, @@ -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, } ) } > diff --git a/packages/editor/src/components/post-title/index.js b/packages/editor/src/components/post-title/index.js index 57ab39f0061615..08bd07f4b72dbe 100644 --- a/packages/editor/src/components/post-title/index.js +++ b/packages/editor/src/components/post-title/index.js @@ -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, }; }, [] ); @@ -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 ( diff --git a/packages/editor/src/components/post-title/post-title-raw.js b/packages/editor/src/components/post-title/post-title-raw.js index a4c9713a094925..66c944b45871ab 100644 --- a/packages/editor/src/components/post-title/post-title-raw.js +++ b/packages/editor/src/components/post-title/post-title-raw.js @@ -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, }; }, [] ); @@ -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, } );