Skip to content

Commit

Permalink
Editor: Limit spotlight mode to the editor. (#58817)
Browse files Browse the repository at this point in the history
* Limit spotlight mode to the editor.

* Revert "Limit spotlight mode to the editor."

This reverts commit b8d4754.

* Disable "Spotlight mode" for block previews.

* Revert non-required changes.
  • Loading branch information
juanfra authored and getdave committed Feb 27, 2024
1 parent fdc1d25 commit 1d279ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/block-editor/src/components/block-preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export function BlockPreview( {
[]
);
const settings = useMemo(
() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),
() => ( {
...originalSettings,
focusMode: false, // Disable "Spotlight mode".
__unstableIsPreviewMode: true,
} ),
[ originalSettings ]
);
const renderedBlocks = useMemo(
Expand Down Expand Up @@ -117,6 +121,7 @@ export function useBlockPreview( { blocks, props = {}, layout } ) {
() => ( {
...originalSettings,
styles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
focusMode: false, // Disable "Spotlight mode".
__unstableIsPreviewMode: true,
} ),
[ originalSettings ]
Expand Down
6 changes: 5 additions & 1 deletion packages/edit-site/src/components/style-book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@ const Example = ( { id, title, blocks, isSelected, onClick } ) => {
[]
);
const settings = useMemo(
() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),
() => ( {
...originalSettings,
focusMode: false, // Disable "Spotlight mode".
__unstableIsPreviewMode: true,
} ),
[ originalSettings ]
);

Expand Down

0 comments on commit 1d279ad

Please sign in to comment.