Skip to content

Commit 2da2665

Browse files
committed
Don't force iframe editor when gutenberg plugin and block theme are enabled
1 parent b10ca39 commit 2da2665

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

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

+16-27
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,22 @@ 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-
119
export function useShouldIframe() {
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-
}, [] );
31-
32-
return (
33-
hasV3BlocksOnly ||
34-
( isGutenbergPlugin && isBlockBasedTheme ) ||
35-
isEditingTemplate ||
36-
isZoomOutMode
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+
[]
3724
);
25+
26+
return hasV3BlocksOnly || isEditingTemplate || isZoomOutMode;
3827
}

0 commit comments

Comments
 (0)