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

Add a GlobalStylesScreenRootSlot slot in Global Styles root screen #49136

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

BogdanUngureanu
Copy link
Contributor

@BogdanUngureanu BogdanUngureanu commented Mar 16, 2023

What?

Resolves: #48068

Add a GlobalStylesScreenRootSlot slot in the Global Styles root screen.

Why?

In order to allow integrators a way to add custom elements in the Global Styles Screen Root, a new slot is added at the top of the section.

How?

It creates a new slot that's called at the top of the GlobalStylesScreenRoot component.

Testing Instructions

It doesn't change the current behavior.
Open the Global Styles in site editor and make sure nothing changes.

Testing Instructions for Keyboard

@Mamaduka Mamaduka requested review from a team, gziolo and nerrad and removed request for a team March 16, 2023 13:20
@Mamaduka Mamaduka requested review from a team and removed request for gziolo and nerrad March 16, 2023 13:20
@Mamaduka Mamaduka added [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Mar 16, 2023
@oandregal

This comment was marked as outdated.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work here, that's a great start.

Like mentioned here #48068 (comment) I think we should start by protecting this API with the Gutenberg plugin check, can we introduce this check.

Also, there's a couple things that we should consider:

  • Adding an e2e test for this extensibility API potentially.
  • Documentation: Not entirely sure how we're documenting the editSite slots in the block editor handbook but we should be consistent. It doesn't have to be in this PR since this is still experimental but let's make sure to have a todo item in the issue at least.

@@ -52,6 +71,8 @@ function ScreenRoot() {

return (
<Card size="small" className="edit-site-global-styles-screen-root">
<ScreenRootSlot />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a too prominent place to add a slot and plugins will compete too much for place. I think the preview and variations should stay at the top. Let's move this slot after the "browse styles" button

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd echo Riad on this one. After browse styles seems like a good position.

@@ -27,6 +29,23 @@ import ContextMenu from './context-menu';
import StylesPreview from './preview';
import { unlock } from '../../private-apis';

const { Slot: GlobalStylesScreenRootSlot } = createSlotFill(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be exposing the API in edit-site/src/index like we do for all the slots?

Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @BogdanUngureanu, this looks good in general!

Besides Riad's notes, I'd suggest to move the slot in its own file.

@bph
Copy link
Contributor

bph commented Dec 13, 2023

Hi @BogdanUngureanu This seems like a promising start to get this into the Gutenberg plugin for testing. Would you be available to adjust your PR to incorporate the comments you received from @ntsekouras and @youknowriad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing")
Projects
Status: PR needs review
Development

Successfully merging this pull request may close these issues.

Provide ways to extend/customize the Global Styles sidebar
6 participants