Skip to content

Commit

Permalink
Update: Move pattern actions to the editor package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Apr 16, 2024
1 parent 63926ec commit 78ba07b
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,30 @@ export default function DataviewsPatterns() {
const history = useHistory();
const onActionPerformed = useCallback(
( actionId, items ) => {
if ( actionId === 'edit-post' ) {
const post = items[ 0 ];
history.push( {
postId: post.id,
postType: post.type,
categoryId,
categoryType: type,
canvas: 'edit',
} );
switch ( actionId ) {
case 'edit-post':
{
const post = items[ 0 ];
history.push( {
postId: post.id,
postType: post.type,
categoryId,
categoryType: type,
canvas: 'edit',
} );
}
break;
case 'duplicate-pattern':
{
const pattern = items[ 0 ];
history.push( {
categoryType: PATTERN_TYPES.theme,
categoryId,
postType: PATTERN_TYPES.user,
postId: pattern.id,
} );
}
break;
}
},
[ categoryId, history, type ]
Expand Down

0 comments on commit 78ba07b

Please sign in to comment.