Skip to content

Commit

Permalink
Remove experimental prefixes from pattern package methods as they are…
Browse files Browse the repository at this point in the history
… not exported (#54338)
  • Loading branch information
glendaviesnz authored Sep 11, 2023
1 parent b18a270 commit 8f63865
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/patterns/src/components/create-pattern-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions packages/patterns/src/components/patterns-manage-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function PatternsManageButton( { clientId } ) {
[ clientId ]
);

const { __experimentalConvertSyncedPatternToStatic: convertBlockToStatic } =
useDispatch( editorStore );
const { convertSyncedPatternToStatic } = useDispatch( editorStore );

if ( ! isVisible ) {
return null;
Expand All @@ -64,7 +63,9 @@ function PatternsManageButton( { clientId } ) {
{ __( 'Manage patterns' ) }
</MenuItem>
{ canRemove && (
<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>
<MenuItem
onClick={ () => convertSyncedPatternToStatic( clientId ) }
>
{ innerBlockCount > 1
? __( 'Detach patterns' )
: __( 'Detach pattern' ) }
Expand Down
8 changes: 4 additions & 4 deletions packages/patterns/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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;
};

Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/patterns/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
}

0 comments on commit 8f63865

Please sign in to comment.