Consume useGlobalStylesOutputWithConfig from private-apis

[MAILPOET-6319]
This commit is contained in:
Rostislav Wolny
2024-11-22 14:00:10 +01:00
committed by Oluwaseun Olorunsola
parent b631e509ef
commit 0431e5eb25
2 changed files with 19 additions and 7 deletions

View File

@ -1,16 +1,21 @@
/**
* WordPress dependencies
*/
import { useMemo } from '@wordpress/element'; import { useMemo } from '@wordpress/element';
import { useSelect } from '@wordpress/data'; import { useSelect } from '@wordpress/data';
/**
* WordPress private dependencies
*/
import { useGlobalStylesOutputWithConfig } from '../private-apis';
/**
* Internal dependencies
*/
import deepmerge from 'deepmerge'; import deepmerge from 'deepmerge';
import {
// @ts-expect-error No types for this exist yet.
privateApis as blockEditorPrivateApi,
} from '@wordpress/block-editor';
import { unlock } from '../lock-unlock';
import { EmailStyles, storeName } from '../store'; import { EmailStyles, storeName } from '../store';
import { useEmailTheme } from './use-email-theme'; import { useEmailTheme } from './use-email-theme';
const { useGlobalStylesOutputWithConfig } = unlock( blockEditorPrivateApi );
export function useEmailCss() { export function useEmailCss() {
const { templateTheme } = useEmailTheme(); const { templateTheme } = useEmailTheme();
const { editorTheme } = useSelect( const { editorTheme } = useSelect(

View File

@ -2,6 +2,7 @@
* WordPress dependencies * WordPress dependencies
*/ */
import { import {
privateApis as blockEditorPrivateApi,
// @ts-expect-error No types for this exist yet. // @ts-expect-error No types for this exist yet.
privateApis as blockEditorPrivateApis, privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor'; } from '@wordpress/block-editor';
@ -55,10 +56,16 @@ const unlockGetEnabledClientIdsTree = ( selectHook ) => {
*/ */
const { ColorPanel: StylesColorPanel } = unlock( blockEditorPrivateApis ); const { ColorPanel: StylesColorPanel } = unlock( blockEditorPrivateApis );
/**
* The useGlobalStylesOutputWithConfig is used to generate the CSS for the email editor content from the style settings.
*/
const { useGlobalStylesOutputWithConfig } = unlock( blockEditorPrivateApi );
export { export {
BlockCanvas, BlockCanvas,
Tabs, Tabs,
StylesColorPanel, StylesColorPanel,
unlockPatternsRelatedSelectorsFromCoreStore, unlockPatternsRelatedSelectorsFromCoreStore,
unlockGetEnabledClientIdsTree, unlockGetEnabledClientIdsTree,
useGlobalStylesOutputWithConfig,
}; };