Use one menu lifecycle and shared menu rows in the editors
Phase 4c. The Markdown, code, Read, and image menus open through showActionMenu. It closes a menu on an outside press, an outside scroll, a resize, and window blur. A host surface now gives its own focus return, so four copies of the listener code are gone. - menuItems.ts builds Undo, Redo, the clipboard rows, and the search row. The Markdown, code, Read, table cell, and table range menus use it. The Markdown and table menus now show the shortcuts for Cut, Copy, Paste, and Select all, as the other menus did. - writerSearch.ts is now editorSearch.ts, because it serves Write and Source. - Plugins still get only close() from api.ui.showActionMenu. The SDK menu types do not change. - The table range menu and the native spelling menu keep their own lifecycle, because their open state drives table editing and the native spelling protocol. - docs/ui-design.md names the shared rows and the search modules. The menu inventory has the new count for markdownMenu.ts. pnpm check, pnpm test (341 of 341), and the full smoke suite pass, except tables/formulas, which failed one time under load and passed on retry.
This commit is contained in:
+4
-2
@@ -27,9 +27,10 @@ Do not copy feature-specific colors into a shared control.
|
||||
| Icons | `src/lib/ui/Icon.svelte` and `src/lib/ui/actionIcons.ts` (one 24-pixel grid and stroke weight) |
|
||||
| Tooltip on a DOM control | `attachTooltip` in `src/lib/ui/tooltip.ts` |
|
||||
| Action menu | `src/lib/ui/actionMenu.ts`. Svelte callers can use `src/lib/layout/ContextMenu.svelte`. |
|
||||
| Menu with dismissal and focus return | `showActionMenu` in `src/lib/ui/managedActionMenu.ts`. Plugins call it as `api.ui.showActionMenu`. |
|
||||
| Menu with dismissal and focus return | `showActionMenu` in `src/lib/ui/managedActionMenu.ts`. Editor surfaces give their own focus return. Plugins call it as `api.ui.showActionMenu`. |
|
||||
| Undo, Redo, clipboard, and search rows | `src/lib/ui/menuItems.ts` |
|
||||
| Menu and picker presentation | `src/lib/ui/menu.css` |
|
||||
| Find | `src/lib/editor/FindPanel.svelte` and `src/lib/ui/find.css` |
|
||||
| Find | `src/lib/editor/FindPanel.svelte` and `src/lib/ui/find.css`. Write and Source search with `editorSearch.ts`. Read and plugin views search with `readingSearch.ts`. |
|
||||
| Dimensions and colors | `src/lib/theme/tokens.css` |
|
||||
|
||||
| Token | Default | Use |
|
||||
@@ -100,6 +101,7 @@ Use one menu design for context menus, action menus, and their submenus in the h
|
||||
- Give a recognizable action an icon and a short label. Use the same icon for the same function in every menu.
|
||||
- A menu with only text choices omits the icon column. A mixed menu reserves the icon column on every row.
|
||||
- Shortcut text and submenu arrows use separate trailing columns.
|
||||
- A common text action has the same label, icon, and shortcut in every menu. Build Undo, Redo, the clipboard rows, and the search row with `menuItems.ts`.
|
||||
- Use inset separators between related groups.
|
||||
- Enabled rows share one hover fill and one keyboard focus fill.
|
||||
- Disabled rows stay readable. Keyboard navigation skips them, and they do not run.
|
||||
|
||||
Reference in New Issue
Block a user