Skip to content

Commit

Permalink
Post Editor: Force iframe editor when zoom-out mode (#64316)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: stokesman <presstoke@git.wordpress.org>
  • Loading branch information
3 people authored Aug 9, 2024
1 parent f5959cc commit e0577df
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { store as editorStore } from '@wordpress/editor';
import { useSelect } from '@wordpress/data';
import { store as blocksStore } from '@wordpress/blocks';
import { store as blockEditorStore } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand All @@ -18,8 +19,10 @@ export function useShouldIframe() {
hasV3BlocksOnly,
isEditingTemplate,
hasMetaBoxes,
isZoomOutMode,
} = useSelect( ( select ) => {
const { getEditorSettings, getCurrentPostType } = select( editorStore );
const { __unstableGetEditorMode } = select( blockEditorStore );
const { getBlockTypes } = select( blocksStore );
const editorSettings = getEditorSettings();
return {
Expand All @@ -29,12 +32,14 @@ export function useShouldIframe() {
} ),
isEditingTemplate: getCurrentPostType() === 'wp_template',
hasMetaBoxes: select( editPostStore ).hasMetaBoxes(),
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
};
}, [] );

return (
( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&
! hasMetaBoxes ) ||
isEditingTemplate
isEditingTemplate ||
isZoomOutMode
);
}

0 comments on commit e0577df

Please sign in to comment.