Skip to content
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ export function useSpecificEditorSettings() {
}, [ mergedConfig ] );

const defaultEditorSettings = useMemo( () => {
// Preserve non-global styles from settings.styles (e.g., editor styles from add_editor_style)
const nonGlobalStyles = ( settings?.styles ?? [] ).filter(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note there are some concerns with the current architecture.

This PR only proposes to get things working for users while those concerns are addressed. They appear to require non-trivial refactors.

See: #73952 (comment)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe I should add some comments to explain why we've had to do all this, including the bug fix in #73952

( style ) => ! style.isGlobalStyles
);

return {
...settings,
styles: [
...( settings?.defaultEditorStyles ?? [] ),

@ramonjd ramonjd Dec 18, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

defaultEditorStyles wasn't added to site editor styles in https://github.com/WordPress/gutenberg/pull/72681/files#diff-0be42e7e256be23e22604abd2fafb9fd4b57091ee531ffdf95174cd581bb2dfb

Wondering that was intentional @youknowriad ? Otherwise I can leave it out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering if the omission was intentional? If memory serves me, adding in defaultEditorStyles is useful for classic themes that haven't thought to include styles that makes working with blocks pleasing. That is to say, when the editor is effectively unstyled. However for block themes / usage in the site editor, I believe we're after more of a 1:1 relationship to what the theme is doing.

So for example, here's my site frontend with my excellent choice of colours:

image

In the site editor with defaultEditorStyles applied:

image

And without defaultEditorStyles applied:

image

The latter appears to be closer to the site frontend, so I'd probably go with including nonGlobalStyles but not including defaultEditorStyles.

What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sounds eminently reasonable. Thanks for digging that up. I wasn't quite sure!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To close the loop on this, over in the post editor here is the check that uses defaultEditorStyles:

return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles;

For edit-site I believe we can assume that it always has theme styles as that's what the site editor + global styles is for.

So yeah, I think we're good!

...nonGlobalStyles,
...globalStyles,
{
// Forming a "block formatting context" to prevent margin collapsing.
Expand Down
Loading