You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f3ca21e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(hub): let dock entries add items to the context menu (#501)
* feat(hub): add contextMenu to dock entries
* feat(hub-ui): show dock entry contextMenu items in the dock menu
* chore(examples): demo dock contextMenu in hub-vite
* docs(hub): document dock contextMenu
Copy file name to clipboardExpand all lines: docs/content/1.guide/16.hub.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -160,6 +160,42 @@ async function runBuild() {
160
160
}
161
161
```
162
162
163
+
## Dock context menu
164
+
165
+
A user opens the context menu of a dock button with a right-click, Shift+F10 or the Menu key. The reference hub UI shows its own items there: pin, hide, refresh and edge mode. A dock entry can add items of its own with `contextMenu`. Each item runs a command, so a click on the dock button can toggle a tool and the context menu can open its settings.
|`command`| Id of a server command or a client command. |
191
+
|`args`| Arguments for the command: strings, numbers, booleans or `null`. |
192
+
|`title`, `titleLocales`| Label of the item. The default is the title of the command. |
193
+
|`icon`| Icon of the item. The default is the icon of the command. |
194
+
|`when`| The item shows only when this expression is true. |
195
+
|`checked`| Shows a check mark. To change it, call `dock.update({ contextMenu })` with the new value. |
196
+
197
+
The hub UI hides an item when its `when` is false or when the `when` of the command is false. It also hides an item when no command has its id, or when a client command has no `action`. The menu does not show the children of a command. A `{ type: 'separator' }` item draws a line. The hub UI removes separators at the start and the end, and merges two or more in a row into one. The items of the entry come first, then a separator, then the built-in items.
198
+
163
199
## Mounting a devframe into a hub
164
200
165
201
`ctx.install(def)` registers a `DevframeDefinition` as a dock and runs its `setup(ctx)`, the imperative counterpart to `initHub`'s `devframes` list.
0 commit comments