| 1 |
import { UpdateMenuConfirm } from '@agent/workflows/theme/components/UpdateMenuConfirm'; |
| 2 |
|
| 3 |
const { abilities, context } = window.extAgentData; |
| 4 |
|
| 5 |
const hasNavMenu = () => |
| 6 |
window.document.querySelectorAll('nav[data-extendify-menu-id]').length > 0; |
| 7 |
|
| 8 |
export default { |
| 9 |
available: () => |
| 10 |
abilities?.canEditPost && |
| 11 |
context?.usingBlockEditor && |
| 12 |
!context?.adminPage && |
| 13 |
['post', 'page'].includes(context.postType) && |
| 14 |
hasNavMenu() && |
| 15 |
context?.postId, |
| 16 |
id: 'add-post-to-menu', |
| 17 |
whenFinished: { component: UpdateMenuConfirm }, |
| 18 |
}; |
| 19 |
|