Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/edit-post/src/components/layout/use-should-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ const isGutenbergPlugin = globalThis.IS_GUTENBERG_PLUGIN ? true : false;

export function useShouldIframe() {
return useSelect( ( select ) => {
const { getEditorSettings, getCurrentPostType, getDeviceType } =
select( editorStore );
const { getCurrentPostType, getDeviceType } = select( editorStore );
const { getClientIdsWithDescendants, getBlockName } =
select( blockEditorStore );
const { getBlockType } = select( blocksStore );

return (
// If the theme is block based and the Gutenberg plugin is active,
// we ALWAYS use the iframe for consistency across the post and site
// editor.
( isGutenbergPlugin &&
getEditorSettings().__unstableIsBlockBasedTheme ) ||
// If the Gutenberg plugin is active, we ALWAYS use the iframe for
// consistency across the post and site editor. We plan on enforcing
// the iframe in the future, so Gutenberg both serves as way for us
// to warn plugin developers and for plugin developers to test their
// blocks easily. Before GB v22.5, we only enforced it for
// block-based themes (classic themes used the same rules as core).
isGutenbergPlugin ||
// We also still want to iframe all the special
// editor features and modes such as device previews, zoom out, and
// template/pattern editing.
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/editor/various/should-iframe.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test.describe( 'Should iframe', () => {
await admin.createNewPost();
} );

test( 'should switch to non-iframe when a v2 block is added', async ( {
test( 'should remain iframed when a v1 block is added', async ( {
page,
editor,
} ) => {
Expand All @@ -33,7 +33,7 @@ test.describe( 'Should iframe', () => {
// Insert the v1 block.
await editor.insertBlock( { name: 'test/v1' } );

// The editor should no longer be iframed.
await expect( iframe ).toBeHidden();
// The editor should remain iframed because Gutenberg is active.
await expect( iframe ).toBeVisible();
} );
} );
Loading