Skip to content

Commit fb3e161

Browse files
committed
Revert "Don't force iframe editor when gutenberg plugin and block theme are enabled (#65372)"
This reverts commit 99fefd7.
1 parent be8f9b6 commit fb3e161

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

packages/edit-post/src/components/layout/use-should-iframe.js

+27-16
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,33 @@ import { useSelect } from '@wordpress/data';
66
import { store as blocksStore } from '@wordpress/blocks';
77
import { store as blockEditorStore } from '@wordpress/block-editor';
88

9+
const isGutenbergPlugin = globalThis.IS_GUTENBERG_PLUGIN ? true : false;
10+
911
export function useShouldIframe() {
10-
const { hasV3BlocksOnly, isEditingTemplate, isZoomOutMode } = useSelect(
11-
( select ) => {
12-
const { getCurrentPostType } = select( editorStore );
13-
const { __unstableGetEditorMode } = select( blockEditorStore );
14-
const { getBlockTypes } = select( blocksStore );
15-
return {
16-
hasV3BlocksOnly: getBlockTypes().every( ( type ) => {
17-
return type.apiVersion >= 3;
18-
} ),
19-
isEditingTemplate: getCurrentPostType() === 'wp_template',
20-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
21-
};
22-
},
23-
[]
24-
);
12+
const {
13+
isBlockBasedTheme,
14+
hasV3BlocksOnly,
15+
isEditingTemplate,
16+
isZoomOutMode,
17+
} = useSelect( ( select ) => {
18+
const { getEditorSettings, getCurrentPostType } = select( editorStore );
19+
const { __unstableGetEditorMode } = select( blockEditorStore );
20+
const { getBlockTypes } = select( blocksStore );
21+
const editorSettings = getEditorSettings();
22+
return {
23+
isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,
24+
hasV3BlocksOnly: getBlockTypes().every( ( type ) => {
25+
return type.apiVersion >= 3;
26+
} ),
27+
isEditingTemplate: getCurrentPostType() === 'wp_template',
28+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
29+
};
30+
}, [] );
2531

26-
return hasV3BlocksOnly || isEditingTemplate || isZoomOutMode;
32+
return (
33+
hasV3BlocksOnly ||
34+
( isGutenbergPlugin && isBlockBasedTheme ) ||
35+
isEditingTemplate ||
36+
isZoomOutMode
37+
);
2738
}

0 commit comments

Comments
 (0)