Repository navigation
Site editor global styles settings: preserve non-global styles in default site editor settings #74088
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
Site editor global styles settings: preserve non-global styles in default site editor settings #74088
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -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( | ||||
| ( style ) => ! style.isGlobalStyles | ||||
| ); | ||||
|
|
||||
| return { | ||||
| ...settings, | ||||
| styles: [ | ||||
| ...( settings?.defaultEditorStyles ?? [] ), | ||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Wondering that was intentional @youknowriad ? Otherwise I can leave it out.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 So for example, here's my site frontend with my excellent choice of colours:
In the site editor with
And without
The latter appears to be closer to the site frontend, so I'd probably go with including What do you think?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
For So yeah, I think we're good! |
||||
| ...nonGlobalStyles, | ||||
| ...globalStyles, | ||||
| { | ||||
| // Forming a "block formatting context" to prevent margin collapsing. | ||||
|
|
||||



There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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