Skip to content

Commit

Permalink
Ensure Move to trash is always at end of list
Browse files Browse the repository at this point in the history
  • Loading branch information
mikachan committed Dec 6, 2024
1 parent 4ac3a3c commit 2cc8058
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
);
}

// Ensure "Move to trash" is always the last action.
actions = actions.sort( ( a, b ) => {
if ( b.id === 'move-to-trash' ) {
return -1;
}
return 0;
} );

// Filter actions based on provided context. If not provided
// all actions are returned. We'll have a single entry for getting the actions
// and the consumer should provide the context to filter the actions, if needed.
Expand Down

0 comments on commit 2cc8058

Please sign in to comment.