From 8f6386552544082203f058ab5cba52bd428c09d7 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 12 Sep 2023 09:03:41 +1200 Subject: [PATCH] Remove experimental prefixes from pattern package methods as they are not exported (#54338) --- packages/patterns/src/components/create-pattern-modal.js | 2 +- .../patterns/src/components/patterns-manage-button.js | 7 ++++--- packages/patterns/src/store/actions.js | 8 ++++---- packages/patterns/src/store/selectors.js | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/patterns/src/components/create-pattern-modal.js b/packages/patterns/src/components/create-pattern-modal.js index a6aa4007764fcc..5623a04fcba611 100644 --- a/packages/patterns/src/components/create-pattern-modal.js +++ b/packages/patterns/src/components/create-pattern-modal.js @@ -35,7 +35,7 @@ export default function CreatePatternModal( { } ) { const [ syncType, setSyncType ] = useState( SYNC_TYPES.full ); const [ title, setTitle ] = useState( '' ); - const { __experimentalCreatePattern: createPattern } = useDispatch( store ); + const { createPattern } = useDispatch( store ); const { createErrorNotice } = useDispatch( noticesStore ); const onCreate = useCallback( diff --git a/packages/patterns/src/components/patterns-manage-button.js b/packages/patterns/src/components/patterns-manage-button.js index bfa36521a28c1f..eae307f1838dec 100644 --- a/packages/patterns/src/components/patterns-manage-button.js +++ b/packages/patterns/src/components/patterns-manage-button.js @@ -51,8 +51,7 @@ function PatternsManageButton( { clientId } ) { [ clientId ] ); - const { __experimentalConvertSyncedPatternToStatic: convertBlockToStatic } = - useDispatch( editorStore ); + const { convertSyncedPatternToStatic } = useDispatch( editorStore ); if ( ! isVisible ) { return null; @@ -64,7 +63,9 @@ function PatternsManageButton( { clientId } ) { { __( 'Manage patterns' ) } { canRemove && ( - convertBlockToStatic( clientId ) }> + convertSyncedPatternToStatic( clientId ) } + > { innerBlockCount > 1 ? __( 'Detach patterns' ) : __( 'Detach pattern' ) } diff --git a/packages/patterns/src/store/actions.js b/packages/patterns/src/store/actions.js index 2128526b2b3194..0a0306c736621a 100644 --- a/packages/patterns/src/store/actions.js +++ b/packages/patterns/src/store/actions.js @@ -13,7 +13,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor'; * @param {'full'|'unsynced'} syncType They way block is synced, 'full' or 'unsynced'. * @param {string[]|undefined} clientIds Optional client IDs of blocks to convert to pattern. */ -export const __experimentalCreatePattern = +export const createPattern = ( title, syncType, clientIds ) => async ( { registry, dispatch } ) => { const meta = @@ -50,7 +50,7 @@ export const __experimentalCreatePattern = registry .dispatch( blockEditorStore ) .replaceBlocks( clientIds, newBlock ); - dispatch.__experimentalSetEditingPattern( newBlock.clientId, true ); + dispatch.setEditingPattern( newBlock.clientId, true ); return updatedRecord; }; @@ -59,7 +59,7 @@ export const __experimentalCreatePattern = * * @param {string} clientId The client ID of the block to attach. */ -export const __experimentalConvertSyncedPatternToStatic = +export const convertSyncedPatternToStatic = ( clientId ) => ( { registry } ) => { const oldBlock = registry @@ -90,7 +90,7 @@ export const __experimentalConvertSyncedPatternToStatic = * @param {boolean} isEditing Whether the block should be in editing state. * @return {Object} Action descriptor. */ -export function __experimentalSetEditingPattern( clientId, isEditing ) { +export function setEditingPattern( clientId, isEditing ) { return { type: 'SET_EDITING_PATTERN', clientId, diff --git a/packages/patterns/src/store/selectors.js b/packages/patterns/src/store/selectors.js index 3089737c856c86..63a4d5ff9dfbdf 100644 --- a/packages/patterns/src/store/selectors.js +++ b/packages/patterns/src/store/selectors.js @@ -5,6 +5,6 @@ * @param {number} clientId the clientID of the block. * @return {boolean} Whether the pattern is in the editing state. */ -export function __experimentalIsEditingPattern( state, clientId ) { +export function isEditingPattern( state, clientId ) { return state.isEditingPattern[ clientId ]; }