diff --git a/packages/block-editor/src/components/use-resize-canvas/index.js b/packages/block-editor/src/components/use-resize-canvas/index.js
index 3b4d97a097964c..9c8b5ed319afc3 100644
--- a/packages/block-editor/src/components/use-resize-canvas/index.js
+++ b/packages/block-editor/src/components/use-resize-canvas/index.js
@@ -14,7 +14,7 @@ export default function useResizeCanvas( deviceType ) {
const [ actualWidth, updateActualWidth ] = useState( window.innerWidth );
useEffect( () => {
- if ( deviceType === 'Desktop' ) {
+ if ( deviceType === 'Desktop' || deviceType === 'Responsive' ) {
return;
}
@@ -49,6 +49,8 @@ export default function useResizeCanvas( deviceType ) {
const marginHorizontal = 'auto';
switch ( device ) {
+ case 'Responsive':
+ return {};
case 'Tablet':
case 'Mobile':
return {
diff --git a/packages/editor/src/components/header/index.js b/packages/editor/src/components/header/index.js
index e404b1afa70b16..35f845a3d2a401 100644
--- a/packages/editor/src/components/header/index.js
+++ b/packages/editor/src/components/header/index.js
@@ -24,11 +24,6 @@ import PostViewLink from '../post-view-link';
import PreviewDropdown from '../preview-dropdown';
import ZoomOutToggle from '../zoom-out-toggle';
import { store as editorStore } from '../../store';
-import {
- TEMPLATE_PART_POST_TYPE,
- PATTERN_POST_TYPE,
- NAVIGATION_POST_TYPE,
-} from '../../store/constants';
import { unlock } from '../../lock-unlock';
const toolbarVariations = {
@@ -96,13 +91,6 @@ function Header( {
[ 'post', 'page', 'wp_template' ].includes( postType ) &&
hasSectionRootClientId;
- const disablePreviewOption =
- [
- NAVIGATION_POST_TYPE,
- TEMPLATE_PART_POST_TYPE,
- PATTERN_POST_TYPE,
- ].includes( postType ) || isStylesCanvasActive;
-
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
useState( true );
@@ -172,7 +160,7 @@ function Header( {
:not(.alignleft):not(.alignright) { max-width: none;}`;
const enableResizing =
- [
- NAVIGATION_POST_TYPE,
- TEMPLATE_PART_POST_TYPE,
- PATTERN_POST_TYPE,
- ].includes( postType ) &&
+ deviceType === 'Responsive' &&
// Disable in previews / view mode.
! isPreview &&
// Disable resizing in mobile viewport.
diff --git a/packages/editor/src/store/reducer.js b/packages/editor/src/store/reducer.js
index aef5286a1fc52f..5d4d684a1512e0 100644
--- a/packages/editor/src/store/reducer.js
+++ b/packages/editor/src/store/reducer.js
@@ -8,6 +8,11 @@ import { combineReducers } from '@wordpress/data';
*/
import { EDITOR_SETTINGS_DEFAULTS } from './defaults';
import dataviewsReducer from '../dataviews/store/reducer';
+import {
+ PATTERN_POST_TYPE,
+ TEMPLATE_PART_POST_TYPE,
+ NAVIGATION_POST_TYPE,
+} from './constants';
/**
* Returns a post attribute value, flattening nested rendered content using its
@@ -288,6 +293,17 @@ export function deviceType( state = 'Desktop', action ) {
switch ( action.type ) {
case 'SET_DEVICE_TYPE':
return action.deviceType;
+ case 'SET_EDITED_POST':
+ if (
+ [
+ PATTERN_POST_TYPE,
+ TEMPLATE_PART_POST_TYPE,
+ NAVIGATION_POST_TYPE,
+ ].includes( action.postType )
+ ) {
+ return 'Responsive';
+ }
+ return 'Desktop';
}
return state;