Skip to content

Commit

Permalink
Fix: Dont show pattern and template actions on the post editor. (#60568)
Browse files Browse the repository at this point in the history
Co-authored-by: jorgefilipecosta <[email protected]>
  • Loading branch information
jorgefilipecosta and jorgefilipecosta authored Apr 8, 2024
1 parent 1f5aa04 commit 7c25dc4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/editor/src/components/post-actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import { moreVertical } from '@wordpress/icons';
import { unlock } from '../../lock-unlock';
import { usePostActions } from './actions';
import { store as editorStore } from '../../store';
import {
TEMPLATE_POST_TYPE,
TEMPLATE_PART_POST_TYPE,
PATTERN_POST_TYPE,
} from '../../store/constants';

const {
DropdownMenuV2: DropdownMenu,
Expand Down Expand Up @@ -71,6 +76,15 @@ export default function PostActions( { onActionPerformed } ) {
{ primaryActions: [], secondaryActions: [] }
);
}, [ actions, item ] );
if (
[
TEMPLATE_POST_TYPE,
TEMPLATE_PART_POST_TYPE,
PATTERN_POST_TYPE,
].includes( postType )
) {
return null;
}
return (
<DropdownMenu
trigger={
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/store/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export const ONE_MINUTE_IN_MS = 60 * 1000;
export const AUTOSAVE_PROPERTIES = [ 'title', 'excerpt', 'content' ];
export const TEMPLATE_POST_TYPE = 'wp_template';
export const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
export const PATTERN_POST_TYPE = 'wp_block';

1 comment on commit 7c25dc4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 7c25dc4.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8603385900
📝 Reported issues:

Please sign in to comment.