diff --git a/packages/edit-post/src/components/layout/use-should-iframe.js b/packages/edit-post/src/components/layout/use-should-iframe.js index 9fed30c07b37e..e36a4773c4a1f 100644 --- a/packages/edit-post/src/components/layout/use-should-iframe.js +++ b/packages/edit-post/src/components/layout/use-should-iframe.js @@ -6,22 +6,33 @@ import { useSelect } from '@wordpress/data'; import { store as blocksStore } from '@wordpress/blocks'; import { store as blockEditorStore } from '@wordpress/block-editor'; +const isGutenbergPlugin = globalThis.IS_GUTENBERG_PLUGIN ? true : false; + export function useShouldIframe() { - const { hasV3BlocksOnly, isEditingTemplate, isZoomOutMode } = useSelect( - ( select ) => { - const { getCurrentPostType } = select( editorStore ); - const { __unstableGetEditorMode } = select( blockEditorStore ); - const { getBlockTypes } = select( blocksStore ); - return { - hasV3BlocksOnly: getBlockTypes().every( ( type ) => { - return type.apiVersion >= 3; - } ), - isEditingTemplate: getCurrentPostType() === 'wp_template', - isZoomOutMode: __unstableGetEditorMode() === 'zoom-out', - }; - }, - [] - ); + const { + isBlockBasedTheme, + hasV3BlocksOnly, + isEditingTemplate, + isZoomOutMode, + } = useSelect( ( select ) => { + const { getEditorSettings, getCurrentPostType } = select( editorStore ); + const { __unstableGetEditorMode } = select( blockEditorStore ); + const { getBlockTypes } = select( blocksStore ); + const editorSettings = getEditorSettings(); + return { + isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme, + hasV3BlocksOnly: getBlockTypes().every( ( type ) => { + return type.apiVersion >= 3; + } ), + isEditingTemplate: getCurrentPostType() === 'wp_template', + isZoomOutMode: __unstableGetEditorMode() === 'zoom-out', + }; + }, [] ); - return hasV3BlocksOnly || isEditingTemplate || isZoomOutMode; + return ( + hasV3BlocksOnly || + ( isGutenbergPlugin && isBlockBasedTheme ) || + isEditingTemplate || + isZoomOutMode + ); }