Skip to content

Commit 033973e

Browse files
t-hamanoMamadukaAzragh
authored
Site editor: preserve non-global styles in pattern previews (#77957)
PR #73952 replaced settings.styles with the output of generateGlobalStyles, which only emits styles tagged isGlobalStyles: true, dropping non-global styles such as those registered via add_editor_style(). PR #74088 restored them for the site editor canvas; apply the same isGlobalStyles filter pattern in usePatternSettings so add_editor_style output reappears in pattern previews. Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: Azragh <azragh@git.wordpress.org>
1 parent b9757cd commit 033973e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/edit-site/src/components/page-patterns/use-pattern-settings.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ export default function usePatternSettings() {
6464
...restStoredSettings
6565
} = storedSettings;
6666

67+
// Preserve non-global styles from settings.styles (e.g., editor styles from add_editor_style)
68+
const nonGlobalStyles = ( styles ?? [] ).filter(
69+
( style ) => ! style.isGlobalStyles
70+
);
71+
6772
return {
6873
...restStoredSettings,
69-
styles: globalStyles,
74+
styles: [ ...nonGlobalStyles, ...globalStyles ],
7075
__experimentalFeatures: globalSettings,
7176
[ globalStylesDataKey ]: mergedConfig.styles ?? {},
7277
__experimentalBlockPatterns: blockPatterns,

0 commit comments

Comments
 (0)