## What Adds a new custom component called `editMenuItems` that can be used in the document view. This options allows users to inject their own custom components into the dropdown menu found in the document controls (the 3 dot menu), the provided component(s) will be added below the default existing actions (Create New, Duplicate, Delete and so on). ## Why To increase flexibility and customization for users who wish to add functionality to this menu. This provides a clean and consistent way to add additional actions without needing to override or duplicate existing UI logic. ## How - Introduced the `editMenuItems` slot in the document controls dropdown (three-dot menu) - in edit and preview tabs. - Added documentation and tests to cover this new custom component #### Testing Use the `admin` test suite and go to the `edit menu items` collection
25 lines
485 B
TypeScript
25 lines
485 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import { editMenuItemsSlug, postsCollectionSlug, uploadCollectionSlug } from '../slugs.js'
|
|
|
|
export const EditMenuItems: CollectionConfig = {
|
|
slug: editMenuItemsSlug,
|
|
admin: {
|
|
components: {
|
|
edit: {
|
|
editMenuItems: [
|
|
{
|
|
path: '/components/EditMenuItems/index.js#EditMenuItems',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
},
|
|
],
|
|
}
|