Skip to content
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

Block Editor: Unlock private setting keys at the file level #61813

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { useSettings } from '../use-settings';
import { unlock } from '../../lock-unlock';

const { Tabs } = unlock( componentsPrivateApis );
const colorsAndGradientKeys = [
'colors',
'disableCustomColors',
Expand Down Expand Up @@ -106,11 +107,6 @@ function ColorGradientControlInner( {
</div>
);

// Unlocking `Tabs` too early causes the `unlock` method to receive an empty
// object, due to circular dependencies.
// See https://github.com/WordPress/gutenberg/issues/52692
const { Tabs } = unlock( componentsPrivateApis );

return (
<BaseControl
__nextHasNoMarginBottom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ const popoverProps = {
shift: true,
};

const { Tabs } = unlock( componentsPrivateApis );

const LabeledColorIndicators = ( { indicators, label } ) => (
<HStack justify="flex-start">
<ZStack isLayered={ false } offset={ -8 }>
Expand Down Expand Up @@ -207,10 +209,6 @@ function ColorPanelDropdown( {
panelId,
} ) {
const currentTab = tabs.find( ( tab ) => tab.userValue !== undefined );
// Unlocking `Tabs` too early causes the `unlock` method to receive an empty
// object, due to circular dependencies.
// See https://github.com/WordPress/gutenberg/issues/52692
const { Tabs } = unlock( componentsPrivateApis );

return (
<ToolsPanelItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const BLOCK_EDITOR_SETTINGS = [
'__experimentalArchiveTitleNameLabel',
];

const { globalStylesDataKey, selectBlockPatternsKey, reusableBlocksSelectKey } =
unlock( privateApis );

/**
* React hook used to compute the block editor settings to use for the post editor.
*
Expand Down Expand Up @@ -256,8 +259,6 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );

const forceDisableFocusMode = settings.focusMode === false;
const { globalStylesDataKey, selectBlockPatternsKey } =
unlock( privateApis );

return useMemo( () => {
const blockEditorSettings = {
Expand All @@ -283,8 +284,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
? patterns
: undefined;
},
[ unlock( privateApis ).reusableBlocksSelectKey ]:
__experimentalReusableBlocksSelect,
[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,
__experimentalBlockPatternCategories: blockPatternCategories,
__experimentalUserPatternCategories: userPatternCategories,
__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>
Expand Down Expand Up @@ -340,8 +340,6 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
setIsInserterOpened,
sectionRootClientId,
globalStylesData,
globalStylesDataKey,
selectBlockPatternsKey,
] );
}

Expand Down
Loading