Repository navigation
feat: complete menu editor with nested items (sub-menus) via drag-and-drop #314
Replies: 1 comment
|
I’d like to include the plugin admin surface explicitly in this proposal, to make sure everything is covered. From the current implementation, plugin routing is already capable of supporting nested plugin pages. The admin router handles plugin paths through a catch-all route, with URLs like:
The constraint is not routing. The constraint is that the plugin admin contract and sidebar model are still flat:
That becomes limiting as soon as a plugin is more than a single page. In our case, a plugin wants at least:
Today those are all just separate flat entries, which makes the sidebar noisy and loses plugin-level IA. I think the right evolution is to model plugin admin as two separate concerns:
Backward compatibility can stay simple:
I would keep the rendered UI to 2 levels max to avoid insane nesting and edge cases. That would solve the real use case without committing the admin UI to arbitrary deep trees on day one. |
Uh oh!
There was an error while loading. Please reload this page.
What
Complete the menu editor admin UI to support nested menu items (one level deep),
enabling sub-menus in themes (e.g. Bootstrap 5 dropdowns, mega menus, etc.).
Why
The backend already fully supports this:
_emdash_menu_itemshas aparent_idcolumnbuildMenuTree()inpackages/core/src/menus/index.tsalready builds the hierarchyreorderMenuItemsAPI already acceptsparentIdper itemMenuItemtype already exposeschildren: MenuItem[]The admin component (
MenuEditor.tsx) itself has a comment:This PR completes what was already planned and partially implemented.
Implementation
fixOrphans()ensures structural validity after any drag operationNo new dependencies —
@dnd-kit/core,@dnd-kit/sortableare already inpackages/admin/package.json.Who
@gabrielepiccinnu — built this while developing a Bootstrap 5 starter theme for EmDash.
The feature was needed for Bootstrap dropdown navigation and proved the backend was already ready.
I have the code ready with all checks passing (
typecheck,lint:json,format).Happy to open a PR as soon as there's alignment on this approach.
All reactions