@@ -6,22 +6,33 @@ import { useSelect } from '@wordpress/data';
6
6
import { store as blocksStore } from '@wordpress/blocks' ;
7
7
import { store as blockEditorStore } from '@wordpress/block-editor' ;
8
8
9
+ const isGutenbergPlugin = globalThis . IS_GUTENBERG_PLUGIN ? true : false ;
10
+
9
11
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
+ } , [ ] ) ;
25
31
26
- return hasV3BlocksOnly || isEditingTemplate || isZoomOutMode ;
32
+ return (
33
+ hasV3BlocksOnly ||
34
+ ( isGutenbergPlugin && isBlockBasedTheme ) ||
35
+ isEditingTemplate ||
36
+ isZoomOutMode
37
+ ) ;
27
38
}
0 commit comments