Skip to content

Commit

Permalink
Only show header bar and padding if edit mode is set to focused
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Dec 18, 2023
1 parent 60adbba commit c5db0a8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/edit-post/src/components/browser-url/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { Component } from '@wordpress/element';
import { withSelect } from '@wordpress/data';
import { addQueryArgs } from '@wordpress/url';
import { addQueryArgs, getQueryArg } from '@wordpress/url';
import { store as editorStore } from '@wordpress/editor';

/**
Expand Down Expand Up @@ -82,6 +82,9 @@ export class BrowserURL extends Component {
* @param {number} postId Post ID for which to generate post editor URL.
*/
setBrowserURL( postId ) {
if ( getQueryArg( window.location.href, 'editMode' ) ) {
return;
}
window.history.replaceState(
{ id: postId },
'Post ' + postId,
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-post/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
Popover,
} from '@wordpress/components';
import { store as preferencesStore } from '@wordpress/preferences';
import { getQueryArg } from '@wordpress/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -90,7 +91,8 @@ function Header( {
}, [] );

const hasDocumentBar =
POST_TYPE_EDITOR_INTERFACE[ postType ]?.hasDocumentBar;
POST_TYPE_EDITOR_INTERFACE[ postType ]?.hasDocumentBar &&
getQueryArg( window.location.href, 'editMode' ) === 'focused';
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
useState( true );

Expand Down
7 changes: 5 additions & 2 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { useMemo } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { store as blocksStore } from '@wordpress/blocks';

import { getQueryArg } from '@wordpress/url';
/**
* Internal dependencies
*/
Expand Down Expand Up @@ -54,7 +54,10 @@ export default function VisualEditor( { styles } ) {
[]
);

const hasSurround = POST_TYPE_EDITOR_INTERFACE[ postType ]?.hasSurround;
const hasSurround =
POST_TYPE_EDITOR_INTERFACE[ postType ]?.hasSurround &&
getQueryArg( window.location.href, 'editMode' ) === 'focused';

let paddingBottom;

// Add a constant padding for the typewritter effect. When typing at the
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/hooks/pattern-partial-syncing.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const withPatternOnlyRenderMode = createHigherOrderComponent(
postId: props.attributes?.ref,
postType: 'wp_block',
canvas: 'edit',
editMode: 'focused',
} );

const newProps = {
Expand Down

0 comments on commit c5db0a8

Please sign in to comment.