Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover Block: Show settings inspector controls in the Site Editor #69178

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/block-library/src/cover/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { __ } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { isBlobURL } from '@wordpress/blob';
import { store as noticesStore } from '@wordpress/notices';
import { getPath } from '@wordpress/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -127,6 +128,10 @@ function CoverEdit( {
},
[ featuredImage, useFeaturedImage ]
);

const isSiteEditor = getPath( window.location.href )?.includes(
'site-editor.php'
);
const mediaUrl =
media?.media_details?.sizes?.[ sizeSlug ]?.source_url ??
media?.source_url;
Expand Down Expand Up @@ -390,6 +395,7 @@ function CoverEdit( {
const currentSettings = {
isVideoBackground,
isImageBackground,
isSiteEditor,
mediaElement,
hasInnerBlocks,
url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default function CoverInspectorControls( {
const {
isVideoBackground,
isImageBackground,
isSiteEditor,
mediaElement,
url,
overlayColor,
Expand Down Expand Up @@ -189,7 +190,7 @@ export default function CoverInspectorControls( {
return (
<>
<InspectorControls>
{ !! url && (
{ ( !! url || ( useFeaturedImage && isSiteEditor ) ) && (
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
Expand Down
Loading