diff --git a/packages/edit-site/src/components/start-template-options/index.js b/packages/edit-site/src/components/start-template-options/index.js index e57a197ecade0b..39ae9a0d08911b 100644 --- a/packages/edit-site/src/components/start-template-options/index.js +++ b/packages/edit-site/src/components/start-template-options/index.js @@ -7,6 +7,7 @@ import { useState, useEffect, useMemo } from '@wordpress/element'; import { __experimentalBlockPatternsList as BlockPatternsList, store as blockEditorStore, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; import { useAsyncList } from '@wordpress/compose'; @@ -20,6 +21,9 @@ import { store as editSiteStore } from '../../store'; import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data'; import apiFetch from '@wordpress/api-fetch'; import { addQueryArgs } from '@wordpress/url'; +import { unlock } from '../../private-apis'; + +const { useGlobalStyle } = unlock( blockEditorPrivateApis ); function useFallbackTemplateContent( slug, isCustom = false ) { const [ templateContent, setTemplateContent ] = useState( '' ); @@ -55,6 +59,13 @@ function useStartPatterns( fallbackContent ) { return useMemo( () => { // filter patterns that are supposed to be used in the current template being edited. return [ + { + name: 'start-blank', + blocks: parse( + '
' + ), + title: START_BLANK_TITLE, + }, { name: 'fallback', blocks: parse( fallbackContent ), @@ -72,13 +83,6 @@ function useStartPatterns( fallbackContent ) { .map( ( pattern ) => { return { ...pattern, blocks: parse( pattern.content ) }; } ), - { - name: 'start-blank', - blocks: parse( - '' - ), - title: START_BLANK_TITLE, - }, ]; }, [ fallbackContent, slug, patterns ] ); } @@ -88,11 +92,18 @@ function PatternSelection( { fallbackContent, onChoosePattern, postType } ) { const blockPatterns = useStartPatterns( fallbackContent ); const shownBlockPatterns = useAsyncList( blockPatterns ); + const [ textColor = 'black' ] = useGlobalStyle( 'color.text' ); + const [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' ); + const [ gradientValue ] = useGlobalStyle( 'color.gradient' ); return (