diff --git a/packages/edit-site/src/components/block-editor/resizable-editor.js b/packages/edit-site/src/components/block-editor/resizable-editor.js index ce692af4b5d44..a4a170623d4e8 100644 --- a/packages/edit-site/src/components/block-editor/resizable-editor.js +++ b/packages/edit-site/src/components/block-editor/resizable-editor.js @@ -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 ( { setWidth( element.style.width ); @@ -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. @@ -104,7 +106,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) { undefined } frameSize={ isZoomOutMode ? 100 : undefined } - style={ enableResizing ? {} : deviceStyles } + style={ isResizingEnabled ? {} : deviceStyles } head={ <> @@ -114,7 +116,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) { `.is-root-container { display: flow-root; } body { position: relative; }` } - { enableResizing && ( + { isResizingEnabled && (