Skip to content

Commit

Permalink
Fix template parts in view mode
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 7, 2022
1 parent f42f8cd commit 569315c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 10 additions & 8 deletions packages/edit-site/src/components/block-editor/resizable-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
const iframeRef = useRef();
const mouseMoveTypingResetRef = useMouseMoveTypingReset();
const ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );

const isResizingEnabled = enableResizing && canvasMode !== 'view';
const resizeWidthBy = useCallback( ( deltaPixels ) => {
if ( iframeRef.current ) {
setWidth( iframeRef.current.offsetWidth + deltaPixels );
}
}, [] );

return (
<ResizableBox
size={ {
width: enableResizing ? width : '100%',
height: enableResizing && sizes.height ? sizes.height : '100%',
width: isResizingEnabled ? width : '100%',
height:
isResizingEnabled && sizes.height ? sizes.height : '100%',
} }
onResizeStop={ ( event, direction, element ) => {
setWidth( element.style.width );
Expand All @@ -69,10 +71,10 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
maxWidth="100%"
maxHeight="100%"
enable={ {
right: enableResizing,
left: enableResizing,
right: isResizingEnabled,
left: isResizingEnabled,
} }
showHandle={ enableResizing }
showHandle={ isResizingEnabled }
// The editor is centered horizontally, resizing it only
// moves half the distance. Hence double the ratio to correctly
// align the cursor to the resizer handle.
Expand Down Expand Up @@ -104,7 +106,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
undefined
}
frameSize={ isZoomOutMode ? 100 : undefined }
style={ enableResizing ? {} : deviceStyles }
style={ isResizingEnabled ? {} : deviceStyles }
head={
<>
<EditorStyles styles={ settings.styles } />
Expand All @@ -114,7 +116,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
`.is-root-container { display: flow-root; }
body { position: relative; }`
}</style>
{ enableResizing && (
{ isResizingEnabled && (
<style>
{
// Some themes will have `min-height: 100vh` for the root container,
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-site/src/components/block-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
}

&.is-focus-mode {
padding: $grid-unit-60;
.edit-site-layout.is-full-canvas & {
padding: $grid-unit-60;
}

.edit-site-visual-editor__editor-canvas {
border-radius: $radius-block-ui;
Expand Down

0 comments on commit 569315c

Please sign in to comment.