From 3c2185da8f667f3973627474032d1a65db669216 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Fri, 15 Mar 2024 17:06:23 -0500 Subject: [PATCH 01/10] Add global styles to editor settings --- packages/edit-post/src/editor.js | 12 ++++- packages/editor/src/components/index.js | 1 + .../editor/src/components/use-styles/index.js | 46 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 packages/editor/src/components/use-styles/index.js diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index 378265c192778..013b2f2788fe1 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -7,6 +7,7 @@ import { PostLockedModal, store as editorStore, privateApis as editorPrivateApis, + useStyles, } from '@wordpress/editor'; import { useMemo } from '@wordpress/element'; import { SlotFillProvider } from '@wordpress/components'; @@ -73,14 +74,23 @@ function Editor( { [ currentPost.postType, currentPost.postId ] ); + // get the styles from the global styles + const { styles } = useStyles(); + const editorSettings = useMemo( () => ( { ...settings, + __globalStyles: styles, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, defaultRenderingMode: 'post-only', } ), - [ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ] + [ + settings, + styles, + onNavigateToEntityRecord, + onNavigateToPreviousEntityRecord, + ] ); const initialPost = useMemo( () => { diff --git a/packages/editor/src/components/index.js b/packages/editor/src/components/index.js index e84942345fb32..b33a6f324f808 100644 --- a/packages/editor/src/components/index.js +++ b/packages/editor/src/components/index.js @@ -100,6 +100,7 @@ export { default as UnsavedChangesWarning } from './unsaved-changes-warning'; export { default as WordCount } from './word-count'; export { default as TimeToRead } from './time-to-read'; export { default as CharacterCount } from './character-count'; +export { useStyles } from './use-styles'; // State Related Components. export { default as EditorProvider } from './provider'; diff --git a/packages/editor/src/components/use-styles/index.js b/packages/editor/src/components/use-styles/index.js new file mode 100644 index 0000000000000..551ce815768bf --- /dev/null +++ b/packages/editor/src/components/use-styles/index.js @@ -0,0 +1,46 @@ +/** + * WordPress dependencies + */ +import { useMemo } from '@wordpress/element'; +import { useSelect } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; + +export function useStyles() { + const { styles, isReady } = useSelect( ( select ) => { + const { getEditedEntityRecord, hasFinishedResolution } = + select( coreStore ); + const _globalStylesId = + select( coreStore ).__experimentalGetCurrentGlobalStylesId(); + const record = _globalStylesId + ? getEditedEntityRecord( 'root', 'globalStyles', _globalStylesId ) + : undefined; + + let hasResolved = false; + if ( + hasFinishedResolution( '__experimentalGetCurrentGlobalStylesId' ) + ) { + hasResolved = _globalStylesId + ? hasFinishedResolution( 'getEditedEntityRecord', [ + 'root', + 'globalStyles', + _globalStylesId, + ] ) + : true; + } + + return { + isReady: hasResolved, + styles: record?.styles, + }; + }, [] ); + + // Make sure to recompute the styles when hasResolved changes. + const config = useMemo( () => { + return { + styles: styles ?? 'no styless', + isReady, + }; + }, [ isReady, styles ] ); + + return config; +} From ecb7b7e799becdcf932b4c9154c59c736f95ee2a Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Fri, 15 Mar 2024 17:30:42 -0500 Subject: [PATCH 02/10] Add comment --- packages/edit-post/src/editor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index 013b2f2788fe1..cd4f2ea242f11 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -80,6 +80,7 @@ function Editor( { const editorSettings = useMemo( () => ( { ...settings, + // TODO: This key should have a better names __globalStyles: styles, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, From 97aafabc8ae812aa750a24f0f8ee990b4ed17d3c Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Mon, 18 Mar 2024 17:28:31 -0500 Subject: [PATCH 03/10] Add __globalStyles to BLOCK_EDITOR_SETTINGS --- .../editor/src/components/provider/use-block-editor-settings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 4d51025aed567..f98f6fc91745d 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -41,6 +41,7 @@ const BLOCK_EDITOR_SETTINGS = [ '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__unstableGalleryWithImageBlocks', + '__globalStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', From 172cc9a871c6be40d8c7f63d3d0b3871283f299b Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Mon, 18 Mar 2024 17:31:48 -0500 Subject: [PATCH 04/10] Fix typo in editor.js --- packages/edit-post/src/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index cd4f2ea242f11..c97b5e2999fac 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -80,7 +80,7 @@ function Editor( { const editorSettings = useMemo( () => ( { ...settings, - // TODO: This key should have a better names + // TODO: This key should have a better name __globalStyles: styles, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, From 109426184b9c04f7ec83961239ae415f6c4b3932 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Tue, 19 Mar 2024 13:12:22 -0500 Subject: [PATCH 05/10] Remove unused code and update global styles --- packages/edit-post/src/editor.js | 13 +------------ .../provider/use-block-editor-settings.js | 7 ++++++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index c97b5e2999fac..378265c192778 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -7,7 +7,6 @@ import { PostLockedModal, store as editorStore, privateApis as editorPrivateApis, - useStyles, } from '@wordpress/editor'; import { useMemo } from '@wordpress/element'; import { SlotFillProvider } from '@wordpress/components'; @@ -74,24 +73,14 @@ function Editor( { [ currentPost.postType, currentPost.postId ] ); - // get the styles from the global styles - const { styles } = useStyles(); - const editorSettings = useMemo( () => ( { ...settings, - // TODO: This key should have a better name - __globalStyles: styles, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, defaultRenderingMode: 'post-only', } ), - [ - settings, - styles, - onNavigateToEntityRecord, - onNavigateToPreviousEntityRecord, - ] + [ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ] ); const initialPost = useMemo( () => { diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index f98f6fc91745d..f46601638b09c 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -24,6 +24,7 @@ import inserterMediaCategories from '../media-categories'; import { mediaUpload } from '../../utils'; import { store as editorStore } from '../../store'; import { lock, unlock } from '../../lock-unlock'; +import { useStyles } from '../use-styles'; const EMPTY_BLOCKS_LIST = []; @@ -41,7 +42,6 @@ const BLOCK_EDITOR_SETTINGS = [ '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__unstableGalleryWithImageBlocks', - '__globalStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', @@ -174,6 +174,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { [ postType, postId, isLargeViewport, renderingMode ] ); + // get the styles from the global styles + const { styles } = useStyles(); + const settingsBlockPatterns = settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 settings.__experimentalBlockPatterns; // WP 5.9 @@ -260,6 +263,8 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { BLOCK_EDITOR_SETTINGS.includes( key ) ) ), + // TODO: This key should have a better name + __globalStyles: styles, allowedBlockTypes, allowRightClickOverrides, focusMode: focusMode && ! forceDisableFocusMode, From e126a77e064f5ad90411a46dbdb86143e6f156bd Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Tue, 19 Mar 2024 15:18:29 -0500 Subject: [PATCH 06/10] Update global styles key in useBlockEditorSettings --- .../editor/src/components/provider/use-block-editor-settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index f46601638b09c..929f4843835a2 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -264,7 +264,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { ) ), // TODO: This key should have a better name - __globalStyles: styles, + __experimentalStyles: styles, allowedBlockTypes, allowRightClickOverrides, focusMode: focusMode && ! forceDisableFocusMode, From 61bf5b1c31386cddde854e42b0d95a8df146801e Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Tue, 19 Mar 2024 15:21:49 -0500 Subject: [PATCH 07/10] Remove TODO comment --- .../editor/src/components/provider/use-block-editor-settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 929f4843835a2..513822a7de26e 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -263,7 +263,6 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { BLOCK_EDITOR_SETTINGS.includes( key ) ) ), - // TODO: This key should have a better name __experimentalStyles: styles, allowedBlockTypes, allowRightClickOverrides, @@ -337,6 +336,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { postType, setIsInserterOpened, sectionRootClientId, + styles, ] ); } From 2183ab68f09046be3021a6e703c022e3f291f41e Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Tue, 19 Mar 2024 16:38:14 -0500 Subject: [PATCH 08/10] Fix default styles value in useStyles function --- packages/editor/src/components/use-styles/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/use-styles/index.js b/packages/editor/src/components/use-styles/index.js index 551ce815768bf..df6a2622e5b23 100644 --- a/packages/editor/src/components/use-styles/index.js +++ b/packages/editor/src/components/use-styles/index.js @@ -37,7 +37,7 @@ export function useStyles() { // Make sure to recompute the styles when hasResolved changes. const config = useMemo( () => { return { - styles: styles ?? 'no styless', + styles: styles ?? {}, isReady, }; }, [ isReady, styles ] ); From 4a5b69ae80bea2a2837b5b368fd02dd1b4f388d4 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 9 May 2024 15:54:07 +0900 Subject: [PATCH 09/10] Editor: Address feedback on addition of global styles to editor settings (#61022) --- package-lock.json | 4 + packages/block-editor/src/private-apis.js | 2 + .../block-editor/src/store/private-keys.js | 1 + packages/editor/package.json | 2 + packages/editor/src/components/index.js | 1 - .../provider/use-block-editor-settings.js | 15 ++-- .../use-global-styles-data/index.js | 79 +++++++++++++++++++ .../editor/src/components/use-styles/index.js | 46 ----------- 8 files changed, 97 insertions(+), 53 deletions(-) create mode 100644 packages/editor/src/components/use-global-styles-data/index.js delete mode 100644 packages/editor/src/components/use-styles/index.js diff --git a/package-lock.json b/package-lock.json index 1a4684312d137..7ad9d9ff111d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54209,6 +54209,8 @@ "@wordpress/wordcount": "file:../wordcount", "clsx": "^2.1.1", "date-fns": "^3.6.0", + "deepmerge": "^4.3.0", + "is-plain-object": "^5.0.0", "memize": "^2.1.0", "react-autosize-textarea": "^7.1.0", "remove-accents": "^0.5.0" @@ -69285,6 +69287,8 @@ "@wordpress/wordcount": "file:../wordcount", "clsx": "^2.1.1", "date-fns": "^3.6.0", + "deepmerge": "^4.3.0", + "is-plain-object": "^5.0.0", "memize": "^2.1.0", "react-autosize-textarea": "^7.1.0", "remove-accents": "^0.5.0" diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index f10fcc4df2c72..29cc5eecc3753 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -35,6 +35,7 @@ import { useFlashEditableBlocks } from './components/use-flash-editable-blocks'; import { selectBlockPatternsKey, reusableBlocksSelectKey, + globalStylesDataKey, } from './store/private-keys'; import { requiresWrapperOnCopy } from './components/writing-flow/utils'; import { PrivateRichText } from './components/rich-text/'; @@ -72,6 +73,7 @@ lock( privateApis, { useReusableBlocksRenameHint, usesContextKey, useFlashEditableBlocks, + globalStylesDataKey, selectBlockPatternsKey, requiresWrapperOnCopy, PrivateRichText, diff --git a/packages/block-editor/src/store/private-keys.js b/packages/block-editor/src/store/private-keys.js index f48612e7491c9..82264ebe19157 100644 --- a/packages/block-editor/src/store/private-keys.js +++ b/packages/block-editor/src/store/private-keys.js @@ -1,2 +1,3 @@ +export const globalStylesDataKey = Symbol( 'globalStylesDataKey' ); export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' ); export const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' ); diff --git a/packages/editor/package.json b/packages/editor/package.json index bab3a2c29107c..65fa7deae1828 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -66,6 +66,8 @@ "@wordpress/wordcount": "file:../wordcount", "clsx": "^2.1.1", "date-fns": "^3.6.0", + "deepmerge": "^4.3.0", + "is-plain-object": "^5.0.0", "memize": "^2.1.0", "react-autosize-textarea": "^7.1.0", "remove-accents": "^0.5.0" diff --git a/packages/editor/src/components/index.js b/packages/editor/src/components/index.js index b33a6f324f808..e84942345fb32 100644 --- a/packages/editor/src/components/index.js +++ b/packages/editor/src/components/index.js @@ -100,7 +100,6 @@ export { default as UnsavedChangesWarning } from './unsaved-changes-warning'; export { default as WordCount } from './word-count'; export { default as TimeToRead } from './time-to-read'; export { default as CharacterCount } from './character-count'; -export { useStyles } from './use-styles'; // State Related Components. export { default as EditorProvider } from './provider'; diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 513822a7de26e..550e0aa0ddccb 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -24,7 +24,7 @@ import inserterMediaCategories from '../media-categories'; import { mediaUpload } from '../../utils'; import { store as editorStore } from '../../store'; import { lock, unlock } from '../../lock-unlock'; -import { useStyles } from '../use-styles'; +import { useGlobalStylesData } from '../use-global-styles-data'; const EMPTY_BLOCKS_LIST = []; @@ -174,8 +174,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { [ postType, postId, isLargeViewport, renderingMode ] ); - // get the styles from the global styles - const { styles } = useStyles(); + const globalStylesData = useGlobalStylesData(); const settingsBlockPatterns = settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 @@ -255,6 +254,8 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { }, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] ); const forceDisableFocusMode = settings.focusMode === false; + const { globalStylesDataKey, selectBlockPatternsKey } = + unlock( privateApis ); return useMemo( () => { const blockEditorSettings = { @@ -263,7 +264,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { BLOCK_EDITOR_SETTINGS.includes( key ) ) ), - __experimentalStyles: styles, + [ globalStylesDataKey ]: globalStylesData, allowedBlockTypes, allowRightClickOverrides, focusMode: focusMode && ! forceDisableFocusMode, @@ -272,7 +273,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { keepCaretInsideBlock, mediaUpload: hasUploadPermissions ? mediaUpload : undefined, __experimentalBlockPatterns: blockPatterns, - [ unlock( privateApis ).selectBlockPatternsKey ]: ( select ) => { + [ selectBlockPatternsKey ]: ( select ) => { const { hasFinishedResolution, getBlockPatternsForPostType } = unlock( select( coreStore ) ); const patterns = getBlockPatternsForPostType( postType ); @@ -336,7 +337,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { postType, setIsInserterOpened, sectionRootClientId, - styles, + globalStylesData, + globalStylesDataKey, + selectBlockPatternsKey, ] ); } diff --git a/packages/editor/src/components/use-global-styles-data/index.js b/packages/editor/src/components/use-global-styles-data/index.js new file mode 100644 index 0000000000000..0a6d44c9cf8d9 --- /dev/null +++ b/packages/editor/src/components/use-global-styles-data/index.js @@ -0,0 +1,79 @@ +/** + * External dependencies + */ +import deepmerge from 'deepmerge'; +import { isPlainObject } from 'is-plain-object'; + +/** + * WordPress dependencies + */ +import { useSelect } from '@wordpress/data'; +import { useMemo } from '@wordpress/element'; +import { store as coreStore } from '@wordpress/core-data'; + +const DEFAULT_STYLES = {}; + +function useGlobalStylesBaseData() { + const baseConfig = useSelect( ( select ) => { + return select( + coreStore + ).__experimentalGetCurrentThemeBaseGlobalStyles(); + }, [] ); + + return [ !! baseConfig, baseConfig?.styles ?? DEFAULT_STYLES ]; +} + +function useGlobalStylesUserData() { + return useSelect( ( select ) => { + const { + getEditedEntityRecord, + hasFinishedResolution, + __experimentalGetCurrentGlobalStylesId, + } = select( coreStore ); + + const globalStylesId = __experimentalGetCurrentGlobalStylesId(); + const record = globalStylesId + ? getEditedEntityRecord( 'root', 'globalStyles', globalStylesId ) + : undefined; + + let hasResolved = false; + if ( + hasFinishedResolution( '__experimentalGetCurrentGlobalStylesId' ) + ) { + hasResolved = globalStylesId + ? hasFinishedResolution( 'getEditedEntityRecord', [ + 'root', + 'globalStyles', + globalStylesId, + ] ) + : true; + } + + return [ hasResolved, record?.styles ?? DEFAULT_STYLES ]; + }, [] ); +} + +function mergeBaseAndUserStyles( base, user ) { + return deepmerge( base, user, { + // We only pass as arrays the presets, + // in which case we want the new array of values + // to override the old array (no merging). + isMergeableObject: isPlainObject, + } ); +} + +export function useGlobalStylesData() { + const [ isBaseStylesReady, baseStyles ] = useGlobalStylesBaseData(); + const [ isUserStylesReady, userStyles ] = useGlobalStylesUserData(); + const mergedStyles = useMemo( + () => mergeBaseAndUserStyles( baseStyles, userStyles ), + [ baseStyles, userStyles ] + ); + + return { + isReady: isBaseStylesReady && isUserStylesReady, + base: baseStyles ?? DEFAULT_STYLES, + user: userStyles ?? DEFAULT_STYLES, + merged: mergedStyles, + }; +} diff --git a/packages/editor/src/components/use-styles/index.js b/packages/editor/src/components/use-styles/index.js deleted file mode 100644 index df6a2622e5b23..0000000000000 --- a/packages/editor/src/components/use-styles/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * WordPress dependencies - */ -import { useMemo } from '@wordpress/element'; -import { useSelect } from '@wordpress/data'; -import { store as coreStore } from '@wordpress/core-data'; - -export function useStyles() { - const { styles, isReady } = useSelect( ( select ) => { - const { getEditedEntityRecord, hasFinishedResolution } = - select( coreStore ); - const _globalStylesId = - select( coreStore ).__experimentalGetCurrentGlobalStylesId(); - const record = _globalStylesId - ? getEditedEntityRecord( 'root', 'globalStyles', _globalStylesId ) - : undefined; - - let hasResolved = false; - if ( - hasFinishedResolution( '__experimentalGetCurrentGlobalStylesId' ) - ) { - hasResolved = _globalStylesId - ? hasFinishedResolution( 'getEditedEntityRecord', [ - 'root', - 'globalStyles', - _globalStylesId, - ] ) - : true; - } - - return { - isReady: hasResolved, - styles: record?.styles, - }; - }, [] ); - - // Make sure to recompute the styles when hasResolved changes. - const config = useMemo( () => { - return { - styles: styles ?? {}, - isReady, - }; - }, [ isReady, styles ] ); - - return config; -} From 2e70b96d6422ed7c02f4645584a79bab1f6d0783 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 10 May 2024 10:17:39 +0900 Subject: [PATCH 10/10] Only return merged global styles data --- .../src/components/provider/use-block-editor-settings.js | 2 +- .../editor/src/components/use-global-styles-data/index.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 550e0aa0ddccb..3bdc01cb13c0a 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -174,7 +174,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { [ postType, postId, isLargeViewport, renderingMode ] ); - const globalStylesData = useGlobalStylesData(); + const { styles: globalStylesData } = useGlobalStylesData(); const settingsBlockPatterns = settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 diff --git a/packages/editor/src/components/use-global-styles-data/index.js b/packages/editor/src/components/use-global-styles-data/index.js index 0a6d44c9cf8d9..8553fa90ad1ab 100644 --- a/packages/editor/src/components/use-global-styles-data/index.js +++ b/packages/editor/src/components/use-global-styles-data/index.js @@ -72,8 +72,6 @@ export function useGlobalStylesData() { return { isReady: isBaseStylesReady && isUserStylesReady, - base: baseStyles ?? DEFAULT_STYLES, - user: userStyles ?? DEFAULT_STYLES, - merged: mergedStyles, + styles: mergedStyles, }; }