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

Patterns: Remove experimental prefixes from patterns package #54338

Merged
merged 1 commit into from
Sep 11, 2023
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
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 ];
}