Skip to content

Commit 84990c9

Browse files
committed
Disable zoom out mode for non-iframe editor
1 parent c307ce3 commit 84990c9

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

packages/block-editor/src/components/inserter/library.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function InserterLibrary(
2727
onSelect = noop,
2828
shouldFocusBlock = false,
2929
onClose,
30+
isEditorIframed,
3031
},
3132
ref
3233
) {
@@ -58,6 +59,7 @@ function InserterLibrary(
5859
shouldFocusBlock={ shouldFocusBlock }
5960
ref={ ref }
6061
onClose={ onClose }
62+
isEditorIframed={ isEditorIframed }
6163
/>
6264
);
6365
}

packages/block-editor/src/components/inserter/menu.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function InserterMenu(
4949
shouldFocusBlock = true,
5050
onPatternCategorySelection,
5151
onClose,
52+
isEditorIframed,
5253
__experimentalInitialTab,
5354
__experimentalInitialCategory,
5455
},
@@ -93,7 +94,7 @@ function InserterMenu(
9394
hasSectionRootClientId &&
9495
( selectedTab === 'patterns' || selectedTab === 'media' );
9596

96-
useZoomOut( shouldUseZoomOut && isLargeViewport );
97+
useZoomOut( shouldUseZoomOut && isLargeViewport && isEditorIframed );
9798

9899
const [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =
99100
useInsertionPoint( {

packages/editor/src/components/editor-interface/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,17 @@ export default function EditorInterface( {
128128
customSaveButton={ customSaveButton }
129129
forceDisableBlockTools={ forceDisableBlockTools }
130130
title={ title }
131+
isEditorIframed={ ! disableIframe }
131132
/>
132133
)
133134
}
134135
editorNotices={ <EditorNotices /> }
135136
secondarySidebar={
136137
! isPreviewMode &&
137138
mode === 'visual' &&
138-
( ( isInserterOpened && <InserterSidebar /> ) ||
139+
( ( isInserterOpened && (
140+
<InserterSidebar isEditorIframed={ ! disableIframe } />
141+
) ) ||
139142
( isListViewOpened && <ListViewSidebar /> ) )
140143
}
141144
sidebar={

packages/editor/src/components/header/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function Header( {
5757
forceDisableBlockTools,
5858
setEntitiesSavedStatesCallback,
5959
title,
60+
isEditorIframed,
6061
} ) {
6162
const isWideViewport = useViewportMatch( 'large' );
6263
const isLargeViewport = useViewportMatch( 'medium' );
@@ -179,7 +180,7 @@ function Header( {
179180
forceIsAutosaveable={ forceIsDirty }
180181
/>
181182

182-
{ isWideViewport && canBeZoomedOut && (
183+
{ isWideViewport && canBeZoomedOut && isEditorIframed && (
183184
<ZoomOutToggle disabled={ forceDisableBlockTools } />
184185
) }
185186

packages/editor/src/components/inserter-sidebar/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { store as editorStore } from '../../store';
2020

2121
const { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );
2222

23-
export default function InserterSidebar() {
23+
export default function InserterSidebar( { isEditorIframed } ) {
2424
const {
2525
blockSectionRootClientId,
2626
inserterSidebarToggleRef,
@@ -97,6 +97,7 @@ export default function InserterSidebar() {
9797
}
9898
ref={ libraryRef }
9999
onClose={ closeInserterSidebar }
100+
isEditorIframed={ isEditorIframed }
100101
/>
101102
</div>
102103
);

0 commit comments

Comments
 (0)