Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Commands docs with the existing contexts #66860

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ For example, when a user types "contact", the Command Palette needs to filter th

Static and dynamic commands can be contextual. This means that in a given context (for example, when navigating the Site Editor or editing a template), some specific commands are given more priority and are visible as soon as you open the Command Palette. Also, when typing the Command Palette, these contextual commands are shown above the rest of the commands.

At the moment, two contexts have been implemented:
At the moment, three contexts have been implemented:

- `site-editor`: This is the context that is set when you are navigating in the site editor (sidebar visible).
- `site-editor-edit`: This is the context that is set when you are editing a document (template, template part or page) in the site editor.
As the usage of the Command Palette expands, more contexts will be added.
- `entity-edit`: This is the context that is set when you are editing a document (template, template part or page).
- `block-selection-edit`: This is the context that is set when a block is selected.

As the usage of the Command Palette expands, more contexts will be added.

Attaching a command or command loader to a given context is as simple as adding the `context` property (with the right context value from the available contexts above) to the `useCommand` or `useCommandLoader` calls.

Expand Down
Loading